From 15fa71dbca78899ec4214178440312dd024a5931 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Tue, 26 Mar 2024 21:46:28 +0100 Subject: train details: support non-DB HAFAS backends --- lib/DBInfoscreen/Controller/Stationboard.pm | 8 +++++++- lib/DBInfoscreen/Helper/HAFAS.pm | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/DBInfoscreen') diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index e2e5bb5..77b0f8d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1101,7 +1101,8 @@ sub station_train_details { # /z/:train sub train_details { my ($self) = @_; - my $train = $self->stash('train'); + my $train = $self->stash('train'); + my $hafas = $self->param('hafas'); # TODO error handling @@ -1139,6 +1140,11 @@ sub train_details { $opt{train_no} = $train_no; } + my $service = 'DB'; + if ( $hafas ne '1' and Travel::Status::DE::HAFAS::get_service($hafas) ) { + $opt{service} = $hafas; + } + if ( $self->languages =~ m{^en} ) { $opt{language} = 'en'; } diff --git a/lib/DBInfoscreen/Helper/HAFAS.pm b/lib/DBInfoscreen/Helper/HAFAS.pm index ad21c58..302cb9c 100644 --- a/lib/DBInfoscreen/Helper/HAFAS.pm +++ b/lib/DBInfoscreen/Helper/HAFAS.pm @@ -39,6 +39,7 @@ sub get_route_p { if ( $opt{trip_id} ) { $hafas_promise = Travel::Status::DE::HAFAS->new_p( + service => $opt{service}, journey => { id => $opt{trip_id}, }, -- cgit v1.2.3