From 867560dca3d507b7e56c41acd709b575139d3c70 Mon Sep 17 00:00:00 2001 From: Derf Null Date: Fri, 21 Apr 2023 18:30:06 +0200 Subject: HAFAS: use locationSearch rather than StopFinder --- lib/DBInfoscreen/Controller/Stationboard.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index d2cca8d..6ef2adb 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -16,7 +16,6 @@ use Mojo::JSON qw(decode_json); use Mojo::Promise; use Mojo::UserAgent; use Travel::Status::DE::HAFAS; -use Travel::Status::DE::HAFAS::StopFinder; use Travel::Status::DE::IRIS; use Travel::Status::DE::IRIS::Stations; use XML::LibXML; @@ -37,15 +36,15 @@ sub handle_no_results { if ($hafas) { $self->render_later; - Travel::Status::DE::HAFAS::StopFinder->new_p( - url => 'https://reiseauskunft.bahn.de/bin/ajax-getstop.exe', - input => $station, - promise => 'Mojo::Promise', - user_agent => $self->ua, + Travel::Status::DE::HAFAS->new_p( + locationSearch => $station, + promise => 'Mojo::Promise', + user_agent => $self->ua, )->then( sub { - my (@candidates) = @_; - @candidates = map { [ $_->{name}, $_->{id} ] } @candidates; + my ($status) = @_; + my @candidates = $status->results; + @candidates = map { [ $_->name, $_->eva ] } @candidates; if ( @candidates == 1 and $candidates[0][0] ne $station ) { my $s = $candidates[0][0]; my $params = $self->req->params->to_string; -- cgit v1.2.3