diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-03-21 05:10:16 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-03-21 05:10:16 +0100 |
commit | d4f528767cc904320c26b30abf8bb5d83548514b (patch) | |
tree | 1b11e1be1d6e37b3d90c59215f0bebe7c2fe7dfc /lib/DBInfoscreen/Controller | |
parent | c96fcbecb0e438da3fdc94355ed9c6992dc8284c (diff) |
Remove no longer used JSON API versions 1 and 2
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 95 |
1 files changed, 8 insertions, 87 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 28ab239..1abe998 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1053,94 +1053,15 @@ sub handle_result { my @json_route = $self->json_route_diff( [ $result->route ], [ $result->sched_route ] ); - if ( $apiver eq '1' ) { - push( - @departures, - { - delay => $delay, - destination => $result->destination, - isCancelled => $result->can('is_cancelled') - ? $result->is_cancelled - : undef, - messages => { - delay => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->delay_messages - ], - qos => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->qos_messages - ], - }, - platform => $result->platform, - route => \@json_route, - scheduledPlatform => $result->sched_platform, - time => $time, - train => $result->train, - via => [ $result->route_interesting(3) ], - } - ); - } - elsif ( $apiver eq '2' ) { - my ( $delay_arr, $delay_dep, $sched_arr, $sched_dep ); - if ( $result->arrival ) { - $delay_arr = $result->arrival->subtract_datetime( - $result->sched_arrival )->in_units('minutes'); - } - if ( $result->departure ) { - $delay_dep = $result->departure->subtract_datetime( - $result->sched_departure )->in_units('minutes'); - } - if ( $result->sched_arrival ) { - $sched_arr = $result->sched_arrival->strftime('%H:%M'); - } - if ( $result->sched_departure ) { - $sched_dep = $result->sched_departure->strftime('%H:%M'); - } - push( - @departures, - { - delayArrival => $delay_arr, - delayDeparture => $delay_dep, - destination => $result->destination, - isCancelled => $result->can('is_cancelled') - ? $result->is_cancelled - : undef, - messages => { - delay => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->delay_messages - ], - qos => [ - map { - { - timestamp => $_->[0], - text => $_->[1] - } - } $result->qos_messages - ], - }, - platform => $result->platform, - route => \@json_route, - scheduledPlatform => $result->sched_platform, - scheduledArrival => $sched_arr, - scheduledDeparture => $sched_dep, - train => $result->train, - via => [ $result->route_interesting(3) ], - } + if ( $apiver eq '1' or $apiver eq '2' ) { + + # no longer supported + $self->handle_no_results_json( + $backend, undef, + "JSON API version=${apiver} is no longer supported", + $Travel::Status::DE::IRIS::VERSION ); + return; } else { # apiver == 3 my ( $delay_arr, $delay_dep, $sched_arr, $sched_dep ); |