Loading lib/DBInfoscreen/Controller/Stationboard.pm +25 −13 Original line number Diff line number Diff line Loading @@ -322,6 +322,7 @@ sub get_results_p { if ( $opt{hafas} ) { return Travel::Status::DE::HAFAS->new_p( station => $station, arrivals => $opt{arrivals}, cache => $opt{cache_iris_rt}, lwp_options => { timeout => 10, Loading Loading @@ -395,6 +396,10 @@ sub handle_request { $opt{lookahead} += 60; } if ( $self->param('admode') and $self->param('admode') eq 'arr' ) { $opt{arrivals} = 1; } my $api_version = $Travel::Status::DE::IRIS::VERSION; $self->stash( departures => [] ); Loading Loading @@ -1317,6 +1322,7 @@ sub handle_result { my $apiver = $self->param('version') // 0; my $callback = $self->param('callback'); my $via = $self->param('via'); my $hafas = $self->param('hafas'); my $now = DateTime->now( time_zone => 'Europe/Berlin' ); Loading Loading @@ -1348,7 +1354,7 @@ sub handle_result { } if ($show_realtime) { if ( $self->param('hafas') ) { if ($hafas) { @results = sort { $a->datetime <=> $b->datetime } @results; } elsif ( $admode eq 'arr' ) { Loading @@ -1370,10 +1376,11 @@ sub handle_result { for my $result (@results) { my $platform = ( split( qr{ }, $result->platform // '' ) )[0]; my $delay = $result->delay; if ( $admode eq 'arr' and not $result->arrival ) { if ( $admode eq 'arr' and not $hafas and not $result->arrival ) { next; } if ( $admode eq 'dep' and not $hafas and not $result->departure ) { next; Loading Loading @@ -1422,12 +1429,12 @@ sub handle_result { # ->time defaults to dep, so we only need to overwrite $time # if we want arrival times if ( $admode eq 'arr' ) { if ( $admode eq 'arr' and not $hafas ) { $time = $result->sched_arrival->strftime('%H:%M'); } if ($show_realtime) { if ( $self->param('hafas') ) { if ($hafas) { $time = $result->datetime->strftime('%H:%M'); } elsif ( ( $admode eq 'arr' and $result->arrival ) Loading Loading @@ -1625,10 +1632,12 @@ sub handle_result { @departures, { time => $time, sched_departure => $result->sched_datetime sched_departure => ( $result->sched_datetime and $admode ne 'arr' ) ? $result->sched_datetime->strftime('%H:%M') : undef, departure => $result->rt_datetime departure => ( $result->rt_datetime and $admode ne 'arr' ) ? $result->rt_datetime->strftime('%H:%M') : undef, train => $result->name, Loading @@ -1640,8 +1649,8 @@ sub handle_result { map { $_->{name} =~ s{,$city}{}r } $result->route_interesting(3) ], destination => $result->destination =~ s{,$city}{}r, origin => $result->origin, destination => $result->route_end =~ s{,$city}{}r, origin => $result->route_end =~ s{,$city}{}r, platform => $result->platform, scheduled_platform => $result->sched_platform, info => $info, Loading @@ -1652,8 +1661,11 @@ sub handle_result { delay => $delay, replaced_by => [], replacement_for => [], route_pre => [], route_post => [ map { $_->{name} } $result->route ], route_pre => $admode eq 'arr' ? [ map { $_->{name} } $result->route ] : [], route_post => $admode eq 'arr' ? [] : [ map { $_->{name} } $result->route ], wr_link => $result->sched_datetime ? $result->sched_datetime->strftime('%Y%m%d%H%M') : undef, Loading Loading
lib/DBInfoscreen/Controller/Stationboard.pm +25 −13 Original line number Diff line number Diff line Loading @@ -322,6 +322,7 @@ sub get_results_p { if ( $opt{hafas} ) { return Travel::Status::DE::HAFAS->new_p( station => $station, arrivals => $opt{arrivals}, cache => $opt{cache_iris_rt}, lwp_options => { timeout => 10, Loading Loading @@ -395,6 +396,10 @@ sub handle_request { $opt{lookahead} += 60; } if ( $self->param('admode') and $self->param('admode') eq 'arr' ) { $opt{arrivals} = 1; } my $api_version = $Travel::Status::DE::IRIS::VERSION; $self->stash( departures => [] ); Loading Loading @@ -1317,6 +1322,7 @@ sub handle_result { my $apiver = $self->param('version') // 0; my $callback = $self->param('callback'); my $via = $self->param('via'); my $hafas = $self->param('hafas'); my $now = DateTime->now( time_zone => 'Europe/Berlin' ); Loading Loading @@ -1348,7 +1354,7 @@ sub handle_result { } if ($show_realtime) { if ( $self->param('hafas') ) { if ($hafas) { @results = sort { $a->datetime <=> $b->datetime } @results; } elsif ( $admode eq 'arr' ) { Loading @@ -1370,10 +1376,11 @@ sub handle_result { for my $result (@results) { my $platform = ( split( qr{ }, $result->platform // '' ) )[0]; my $delay = $result->delay; if ( $admode eq 'arr' and not $result->arrival ) { if ( $admode eq 'arr' and not $hafas and not $result->arrival ) { next; } if ( $admode eq 'dep' and not $hafas and not $result->departure ) { next; Loading Loading @@ -1422,12 +1429,12 @@ sub handle_result { # ->time defaults to dep, so we only need to overwrite $time # if we want arrival times if ( $admode eq 'arr' ) { if ( $admode eq 'arr' and not $hafas ) { $time = $result->sched_arrival->strftime('%H:%M'); } if ($show_realtime) { if ( $self->param('hafas') ) { if ($hafas) { $time = $result->datetime->strftime('%H:%M'); } elsif ( ( $admode eq 'arr' and $result->arrival ) Loading Loading @@ -1625,10 +1632,12 @@ sub handle_result { @departures, { time => $time, sched_departure => $result->sched_datetime sched_departure => ( $result->sched_datetime and $admode ne 'arr' ) ? $result->sched_datetime->strftime('%H:%M') : undef, departure => $result->rt_datetime departure => ( $result->rt_datetime and $admode ne 'arr' ) ? $result->rt_datetime->strftime('%H:%M') : undef, train => $result->name, Loading @@ -1640,8 +1649,8 @@ sub handle_result { map { $_->{name} =~ s{,$city}{}r } $result->route_interesting(3) ], destination => $result->destination =~ s{,$city}{}r, origin => $result->origin, destination => $result->route_end =~ s{,$city}{}r, origin => $result->route_end =~ s{,$city}{}r, platform => $result->platform, scheduled_platform => $result->sched_platform, info => $info, Loading @@ -1652,8 +1661,11 @@ sub handle_result { delay => $delay, replaced_by => [], replacement_for => [], route_pre => [], route_post => [ map { $_->{name} } $result->route ], route_pre => $admode eq 'arr' ? [ map { $_->{name} } $result->route ] : [], route_post => $admode eq 'arr' ? [] : [ map { $_->{name} } $result->route ], wr_link => $result->sched_datetime ? $result->sched_datetime->strftime('%Y%m%d%H%M') : undef, Loading