diff options
| -rw-r--r-- | index.pl | 18 | ||||
| -rw-r--r-- | templates/clean.html.ep | 4 | ||||
| -rw-r--r-- | templates/layouts/default.html.ep | 4 | ||||
| -rw-r--r-- | templates/multi.html.ep | 4 | ||||
| -rw-r--r-- | templates/single.html.ep | 4 | 
5 files changed, 18 insertions, 16 deletions
| @@ -3,7 +3,7 @@ use Mojolicious::Lite;  use Cache::File;  use File::Slurp qw(read_file write_file);  use List::MoreUtils qw(); -use Travel::Status::DE::DeutscheBahn; +use Travel::Status::DE::HAFAS;  use Travel::Status::DE::IRIS;  use Travel::Status::DE::IRIS::Stations;  use 5.014; @@ -68,8 +68,9 @@ sub get_results_for {  			$cache->freeze( $cache_str, $data );  		}  		else { -			my $status = Travel::Status::DE::DeutscheBahn->new( -				station => $station, +			my $status = Travel::Status::DE::HAFAS->new( +				station       => $station, +				excluded_mots => [qw[bus ferry ondemand tram u]],  				%opt  			);  			$data = { @@ -175,7 +176,7 @@ sub handle_request {  	my $api_version  	  = $backend eq 'iris'  	  ? $Travel::Status::DE::IRIS::VERSION -	  : $Travel::Status::DE::DeutscheBahn::VERSION; +	  : $Travel::Status::DE::HAFAS::VERSION;  	$self->stash( departures => [] );  	$self->stash( title      => 'db-infoscreen' ); @@ -322,7 +323,7 @@ sub handle_request {  		my $platform = ( split( / /, $result->platform ) )[0];  		my $line     = $result->line;  		my $delay    = $result->delay; -		if ($via) { +		if ( $via and $result->can('route') ) {  			my @route = $result->route;  			if ( $result->isa('Travel::Status::DE::IRIS::Result') ) {  				@route = $result->route_post; @@ -416,6 +417,9 @@ sub handle_request {  			if ($info) {  				$moreinfo = [ [ 'RIS', $info ] ];  			} +			if ( $result->delay and $result->delay > 0 ) { +				$info = 'ca. +' . $result->delay . ': ' . $info; +			}  		}  		my $time = $result->time; @@ -618,7 +622,6 @@ sub handle_request {  					time         => $time,  					train        => $result->train,  					train_type   => $result->type, -					via          => [ $result->route_interesting(3) ],  					destination  => $result->destination,  					platform     => $platform,  					info         => $info, @@ -635,8 +638,7 @@ sub handle_request {  					canceled_stops   => [],  					replaced_by      => [],  					replacement_for  => [], -					route_timetable  => [ $result->route_timetable ], -					route_info       => $result->route_info, +					route_info       => [ $result->messages ],  				}  			);  		} diff --git a/templates/clean.html.ep b/templates/clean.html.ep index a05cc08..43f3c54 100644 --- a/templates/clean.html.ep +++ b/templates/clean.html.ep @@ -7,9 +7,9 @@  % for my $departure (@{$departures}) {  %   $i++;  %   my $route_str = q{}; -%   my $via_max = @{$departure->{via}}; +%   my $via_max = @{$departure->{via} // []};  %   my $via_cur = 0; -%   for my $stop (@{$departure->{via}}) { +%   for my $stop (@{$departure->{via} // []}) {  %     $via_cur++;  %     $route_str .= $stop . ($via_cur < $via_max ? ' - ' : q{});  %   } diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index 90a017a..a169699 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -182,8 +182,8 @@ nur Züge via Bochum oder Hamm)</li>  <a href="http://finalrewind.org/projects/db-fakedisplay/">db-infoscreen</a>  v<%= stash('version') // '???' %><br/>  Backends:<br/> -<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">Travel::Status::DE::DeutscheBahn</a> -v<%= $Travel::Status::DE::DeutscheBahn::VERSION %><br/> +<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">Travel::Status::DE::HAFAS</a> +v<%= $Travel::Status::DE::HAFAS::VERSION %><br/>  <a href="http://finalrewind.org/projects/Travel-Status-DE-IRIS/">Travel::Status::DE::IRIS</a>  v<%= $Travel::Status::DE::IRIS::VERSION %><br/>  </div> diff --git a/templates/multi.html.ep b/templates/multi.html.ep index 6e58325..704c589 100644 --- a/templates/multi.html.ep +++ b/templates/multi.html.ep @@ -21,9 +21,9 @@  </div>  <div class="via"> -% my $via_max = @{$departure->{via}}; +% my $via_max = @{$departure->{via} // []};  % my $via_cur = 0; -% for my $stop (@{$departure->{via}}) { +% for my $stop (@{$departure->{via} // []}) {  % $via_cur++;  <span><%= $stop %><% if ($via_cur < $via_max) { %> - <% } %></span>  % } diff --git a/templates/single.html.ep b/templates/single.html.ep index 9c60f20..a4e370c 100644 --- a/templates/single.html.ep +++ b/templates/single.html.ep @@ -15,9 +15,9 @@  %= $departure->{train}  </div>  <div class="via"> -% my $via_max = @{$departure->{via}}; +% my $via_max = @{$departure->{via} // []};  % my $via_cur = 0; -% for my $stop (@{$departure->{via}}) { +% for my $stop (@{$departure->{via} // []}) {  % $via_cur++;  <span><%= $stop %><% if ($via_cur < $via_max) { %> - <% } %></span>  % } | 
