summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-09-18 22:31:56 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-09-18 22:31:56 +0200
commitf12b977e9996439d8fc7d5987ca9581b07966a2d (patch)
tree7f3350270b5cd7ab96fdc3705355b2ade1b59489 /index.pl
parent438505f1cb7c5542104f36626a14c6d59b7f475a (diff)
switch to HAFAS backend, also improved legacy / sub-backend support
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl34
1 files changed, 16 insertions, 18 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' ) {