diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-03-17 13:11:42 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-03-17 13:11:42 +0100 |
commit | 342b90110040fd39dd3b3f7093bae949a6fe9085 (patch) | |
tree | 7018f0e9e16587f61ab63d0b2419f0879980cfbe /lib/DBInfoscreen | |
parent | 55d8255748a68d6d2d942ce4071eb8f8ae0db246 (diff) |
Add preliminary support for non-DB HAFAS services
Diffstat (limited to 'lib/DBInfoscreen')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 53519a0..e2e5bb5 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -36,8 +36,14 @@ sub handle_no_results { if ($hafas) { $self->render_later; + my $service = 'DB'; + if ( $hafas ne '1' and Travel::Status::DE::HAFAS::get_service($hafas) ) + { + $service = $hafas; + } Travel::Status::DE::HAFAS->new_p( locationSearch => $station, + service => $service, promise => 'Mojo::Promise', user_agent => $self->ua, )->then( @@ -324,7 +330,14 @@ sub get_results_p { my $data; if ( $opt{hafas} ) { + my $service = 'DB'; + if ( $opt{hafas} ne '1' + and Travel::Status::DE::HAFAS::get_service( $opt{hafas} ) ) + { + $service = $opt{hafas}; + } return Travel::Status::DE::HAFAS->new_p( + service => $service, station => $station, arrivals => $opt{arrivals}, cache => $opt{cache_iris_rt}, @@ -385,7 +398,7 @@ sub handle_request { my $station = $self->stash('station'); my $template = $self->param('mode') // 'app'; - my $hafas = !!$self->param('hafas'); + my $hafas = $self->param('hafas'); my $with_related = !$self->param('no_related'); my %opt = ( cache_iris_main => $self->app->cache_iris_main, |