From 342b90110040fd39dd3b3f7093bae949a6fe9085 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 17 Mar 2024 13:11:42 +0100 Subject: Add preliminary support for non-DB HAFAS services --- lib/DBInfoscreen/Controller/Stationboard.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/DBInfoscreen') 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, -- cgit v1.2.3