From 23f2b872698cd2584dbf9ca4fda3878f2c87eaec Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 8 Oct 2012 20:53:28 +0200 Subject: Show "no departures" instead of empty screen --- cgi/index.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'cgi') diff --git a/cgi/index.pl b/cgi/index.pl index edb112d..27d0fb1 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -11,7 +11,7 @@ use Travel::Status::DE::VRR; no warnings 'uninitialized'; -our $VERSION = '0.05'; +our $VERSION = '0.06'; my %default = ( backend => 'vrr', @@ -152,6 +152,7 @@ sub render_image { my ( @grep_line, @grep_platform ); my $offset = 0; + my $displayed_lines = 0; my ( $results, $errstr ) = get_results( $backend, $city, $stop ); @@ -258,6 +259,7 @@ sub render_image { $png->draw_at( 0, $line ); $png->draw_at( 25, $destination ); + $displayed_lines++; if ( length($etr) > 2 ) { $png->draw_at( 145, $etr ); @@ -275,6 +277,11 @@ sub render_image { $png->new_line(); } + if ($displayed_lines == 0) { + $png->new_line(); + $png->new_line(); + $png->draw_at(50, 'no departures'); + } $self->render( data => $png->png ); } -- cgit v1.2.3