summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-01-15 17:52:48 +0100
committerDaniel Friesel <derf@finalrewind.org>2015-01-15 17:52:48 +0100
commitc7aa0f86a873a3f86d5eab1be4a0d40d49181b00 (patch)
treeaae7a63ad55722cec8733f771ceb094da243b698 /index.pl
parent334cdd809e665db47dde838765c2669f9a52d3cf (diff)
initial ASEAG support (more to follow)
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl16
1 files changed, 11 insertions, 5 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 => {