diff options
-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 ]; } } |