From 9b51395e43b1339ea07c8569b32428767a444d6a Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 7 Jul 2024 18:06:40 +0200 Subject: share/enhance: handle multi-stop stations --- share/enhance | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/share/enhance b/share/enhance index 25533c6..545ac65 100755 --- a/share/enhance +++ b/share/enhance @@ -20,16 +20,16 @@ for my $station ( @{$stations} ) { my $hafas = Travel::Status::DE::HAFAS->new( locationSearch => $station->{name}, ); - if (not scalar $hafas->results) { + if ( not scalar $hafas->results ) { say ' not found'; next; } - my $result = ($hafas->results)[0]; - if ($result->name ne $station->{name}) { - say ' name mismatch: got ' . $result->name; - next; + for my $result ( $hafas->results ) { + if ( $result->name eq $station->{name} ) { + $station->{latlong} = [ $result->lat, $result->lon ]; + last; + } } - $station->{latlong} = [ $result->lat, $result->lon ]; } } -- cgit v1.2.3