diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-12-17 23:51:49 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-12-17 23:51:49 +0100 |
commit | 39d159d3718b4be8839a17b06838d046a45c4b29 (patch) | |
tree | a89bf629a12afa79dce7bd0c7dc4e31a7b6c3fe4 | |
parent | 171e80c6c7c334a6fac22e835d72e31a5cf2d2ec (diff) |
I keep breaking the RIS...
-rw-r--r-- | index.pl | 82 |
1 files changed, 54 insertions, 28 deletions
@@ -322,34 +322,60 @@ sub handle_request { if ($info) { $info =~ s{ (?: ca\. \s* )? \+ (\d+) }{Verspätung ca $1 Min.}x; } - push( - @departures, - { - time => $time, - train => $result->train, - via => [ $result->route_interesting(3) ], - destination => $result->destination, - platform => $platform, - info => $info, - is_cancelled => $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 - ], - }, - moreinfo => $moreinfo, - delay => $delay, - additional_stops => [ $result->additional_stops ], - canceled_stops => [ $result->canceled_stops ], - } - ); + if ($backend eq 'iris') { + push( + @departures, + { + time => $time, + train => $result->train, + via => [ $result->route_interesting(3) ], + destination => $result->destination, + platform => $platform, + info => $info, + is_cancelled => $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 + ], + }, + moreinfo => $moreinfo, + delay => $delay, + additional_stops => [ $result->additional_stops ], + canceled_stops => [ $result->canceled_stops ], + } + ); + } + else { + push( + @departures, + { + time => $time, + train => $result->train, + via => [ $result->route_interesting(3) ], + destination => $result->destination, + platform => $platform, + info => $info, + is_cancelled => $result->can('is_cancelled') + ? $result->is_cancelled + : undef, + messages => { + delay => [ ], + qos => [ ], + }, + moreinfo => $moreinfo, + delay => $delay, + additional_stops => [ ], + canceled_stops => [ ], + } + ); + } } if ( $template eq 'json' ) { |