summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-07-07 18:06:40 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-07-07 18:06:40 +0200
commit9b51395e43b1339ea07c8569b32428767a444d6a (patch)
tree2ac8f2efc88d34bd711bbce027d9ff43510c8391 /share
parent4c41144a139605a141e5806188ce86aad9573da4 (diff)
share/enhance: handle multi-stop stations
Diffstat (limited to 'share')
-rwxr-xr-xshare/enhance12
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 ];
}
}