diff options
author | Derf Null <derf@finalrewind.org> | 2023-04-21 18:30:06 +0200 |
---|---|---|
committer | Derf Null <derf@finalrewind.org> | 2023-04-21 18:30:06 +0200 |
commit | 867560dca3d507b7e56c41acd709b575139d3c70 (patch) | |
tree | 8be30f48b1d7e5c1466339d905f5d0f3e325e9c8 /lib/DBInfoscreen | |
parent | fd6a3f3711b09ade5d074e6fcd5d1d133c9b16e8 (diff) |
HAFAS: use locationSearch rather than StopFinder
Diffstat (limited to 'lib/DBInfoscreen')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 15 |
1 files 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; |