From c7aa0f86a873a3f86d5eab1be4a0d40d49181b00 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 15 Jan 2015 17:52:48 +0100 Subject: initial ASEAG support (more to follow) --- index.pl | 16 +++++++++++----- templates/infoscreen.html.ep | 18 ++++++++++-------- templates/main.html.ep | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/index.pl b/index.pl index c4928b1..2aa80ed 100644 --- a/index.pl +++ b/index.pl @@ -9,6 +9,7 @@ use List::MoreUtils qw(any); use App::VRR::Fakedisplay; use Travel::Status::DE::DeutscheBahn; +use Travel::Status::DE::ASEAG; use Travel::Status::DE::VRR; no warnings 'uninitialized'; @@ -57,6 +58,11 @@ sub get_results { }, ); } + elsif ( $backend eq 'aseag' ) { + $status = Travel::Status::DE::ASEAG->new( + stop => ( $city ? "${city} ${stop}" : $stop ), + ); + } else { $status = Travel::Status::DE::VRR->new( place => $city, @@ -170,8 +176,9 @@ sub get_filtered_departures { for my $d ( @{$results} ) { - my $line = $d->line; - my $platform = ( split( qr{ }, $d->platform ) )[-1]; + my $line = $d->line; + my $platform + = $d->can('platform') ? ( split( qr{ }, $d->platform ) )[-1] : q{}; my $destination = $d->destination; my $time = $d->time; my $etr; @@ -219,7 +226,6 @@ sub make_infoboard_lines { for my $d ( @{$results} ) { my $line = $d->line; - my $platform = ( split( qr{ }, $d->platform ) )[-1]; my $destination = $d->destination; my $time = $d->time; my $etr; @@ -471,11 +477,11 @@ get '/_redirect' => sub { return; }; -get '/' => \&handle_request; +get '/' => \&handle_request; get '/:city/(:stop).html' => \&render_html; get '/:city/(:stop).json' => \&render_json; get '/:city/(:stop).png' => \&render_image; -get '/:city/:stop' => \&handle_request; +get '/:city/:stop' => \&handle_request; app->config( hypnotoad => { diff --git a/templates/infoscreen.html.ep b/templates/infoscreen.html.ep index 47c435c..6d4ff72 100644 --- a/templates/infoscreen.html.ep +++ b/templates/infoscreen.html.ep @@ -25,18 +25,20 @@