diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-07-07 18:06:40 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-07-07 18:06:40 +0200 |
commit | 9b51395e43b1339ea07c8569b32428767a444d6a (patch) | |
tree | 2ac8f2efc88d34bd711bbce027d9ff43510c8391 /share | |
parent | 4c41144a139605a141e5806188ce86aad9573da4 (diff) |
share/enhance: handle multi-stop stations
Diffstat (limited to 'share')
-rwxr-xr-x | share/enhance | 12 |
1 files 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 ]; } } |