summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.pl16
-rw-r--r--templates/infoscreen.html.ep18
-rw-r--r--templates/main.html.ep2
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 @@
<ul>
% for my $departure (@{$raw}) {
% my $linetype = q{};
-% given ($departure->type) {
-% when ($_ =~ m{enbahn$}) { $linetype = 'tram' }
-% when ('S-Bahn') { $linetype = 'sbahn' }
-% when ([qw[NE Niederflurbus SB Bus]]) { $linetype = 'bus' }
-% when ('U-Bahn') { $linetype = 'ubahn' }
+% if ($departure->can('type')) {
+% given ($departure->type) {
+% when ($_ =~ m{enbahn$}) { $linetype = 'tram' }
+% when ('S-Bahn') { $linetype = 'sbahn' }
+% when ([qw[NE Niederflurbus SB Bus]]) { $linetype = 'bus' }
+% when ('U-Bahn') { $linetype = 'ubahn' }
+% }
% }
<li>
<span class="line <%= $linetype %>">
%= $departure->line
</span>
<span class="route">
-% if ($departure->lineref) {
+% if ($departure->can('lineref') and $departure->lineref) {
%= $departure->lineref->route
% }
</span>
@@ -44,10 +46,10 @@
%= $departure->destination
</span>
<span class="countdown">
-% if ($departure->delay) {
+% if ($departure->can('delay') and $departure->delay) {
<span class="delay"> (+<%= $departure->delay %>) </span>
% }
-% if ($departure->is_cancelled) {
+% if ($departure->can('is_cancelled') and $departure->is_cancelled) {
<span class="delay"> FĂ„LLT AUS </span>
% }
% else {
diff --git a/templates/main.html.ep b/templates/main.html.ep
index 8f42291..a3678de 100644
--- a/templates/main.html.ep
+++ b/templates/main.html.ep
@@ -131,7 +131,7 @@ other German transit networks.
<div class="field">
<div class="desc">backend</div>
<div>
- %= select_field backend => [['EFA (VRR)' => 'vrr'], ['HAFAS (DB)' => 'db']]
+ %= select_field backend => [['EFA / VRR' => 'vrr'], ['DB (HAFAS)' => 'db'], ['ASEAG (URA)' => 'aseag']]
</div>
</div>
<div class="field">