summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.pl34
-rw-r--r--templates/main.html.ep6
2 files changed, 19 insertions, 21 deletions
diff --git a/index.pl b/index.pl
index c36d92e..f1d9fad 100644
--- a/index.pl
+++ b/index.pl
@@ -11,7 +11,7 @@ use List::Util qw(first);
use List::MoreUtils qw(any);
use App::VRR::Fakedisplay;
-use Travel::Status::DE::DeutscheBahn;
+use Travel::Status::DE::HAFAS;
use Travel::Status::DE::ASEAG;
use Travel::Status::DE::EFA;
@@ -52,12 +52,19 @@ sub get_results {
lock_level => Cache::File::LOCK_LOCAL(),
);
- if ( $backend =~ m{ [.] }x ) {
- ($sub_backend) = ( $backend =~ m{ [.] (.+) $ }x );
+ # legacy values
+ if ( not defined $backend or $backend eq 'vrr' ) {
+ $backend = 'efa.VRR';
+ }
+
+ if ( $backend =~ s{ [.] (.+) $ }{}x ) {
+ $sub_backend = $1;
- if ( not $sub_backend ~~ \@efa_services ) {
- $sub_backend = undef;
- $backend =~ s{ [.] (.+) $ }{}x;
+ if ( $backend eq 'efa' and not $sub_backend ~~ \@efa_services ) {
+ return {
+ results => [],
+ errstr => "efa sub-backend '$sub_backend' not supported"
+ };
}
}
@@ -72,18 +79,9 @@ sub get_results {
}
my $status;
if ( $backend eq 'db' ) {
- $status = Travel::Status::DE::DeutscheBahn->new(
- station => "${stop}, ${city}",
- mot => {
- ice => 0,
- ic_ec => 0,
- d => 0,
- nv => 0,
- s => 1,
- bus => 1,
- u => 1,
- tram => 1,
- },
+ $status = Travel::Status::DE::HAFAS->new(
+ station => "${stop}, ${city}",
+ excluded_mots => [qw[ice ic_ec d regio]],
);
}
elsif ( $backend eq 'aseag' ) {
diff --git a/templates/main.html.ep b/templates/main.html.ep
index 7dc9cb9..13dda0e 100644
--- a/templates/main.html.ep
+++ b/templates/main.html.ep
@@ -51,7 +51,7 @@ Data is cached for 1 minute. JSON format:
% if (param('backend') and param('backend') eq 'db') {
serialized
<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">
-Travel::Status::DE::DeutscheBahn</a>-objects, see the
+Travel::Status::DE::HAFAS</a>-objects, see the
<a href="http://man.finalrewind.org/3/Travel-Status-DE-DeutscheBahn-Result/">::Result</a>
documentation
% }
@@ -186,8 +186,8 @@ v<%= $version %><br/>
Backends:<br/>
<a href="http://finalrewind.org/projects/Travel-Status-DE-URA/">Travel::Status::DE::ASEAG</a>
v<%= $Travel::Status::DE::ASEAG::VERSION %><br/>
-<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">Travel::Status::DE::DeutscheBahn</a>
-v<%= $Travel::Status::DE::DeutscheBahn::VERSION %><br/>
+<a href="http://finalrewind.org/projects/Travel-Status-DE-DeutscheBahn/">Travel::Status::DE::HAFAS</a>
+v<%= $Travel::Status::DE::HAFAS::VERSION %><br/>
<a href="http://finalrewind.org/projects/Travel-Status-DE-VRR/">Travel::Status::DE::EFA</a>
v<%= $Travel::Status::DE::EFA::VERSION %><br/>
</div>