diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-09-19 18:54:12 +0200 |
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-09-19 18:54:12 +0200 |
| commit | 8dc1d553eb854329a832b81ea7deed833679218f (patch) | |
| tree | f4e8b437edd604f0ef72252d5bd98bcf0f3a0e86 | |
| parent | d3cf2b60688294b306f84e86cab7f3c64d5c1011 (diff) | |
share/enhance: switch to DBRIS (DB HAFAS is dead)
| -rwxr-xr-x | share/enhance | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/share/enhance b/share/enhance index 545ac65..388594f 100755 --- a/share/enhance +++ b/share/enhance @@ -5,7 +5,7 @@ use warnings; use 5.010; use File::Slurp qw(read_file write_file); -use Travel::Status::DE::HAFAS; +use Travel::Status::DE::DBRIS; my $json_str = read_file('stations.json'); my $stations = JSON->new->utf8->decode($json_str); @@ -17,15 +17,17 @@ $ua->env_proxy; for my $station ( @{$stations} ) { if ( not $station->{latlong} ) { say "Requesting location for $station->{name} ..."; - my $hafas = Travel::Status::DE::HAFAS->new( + my $dbris = Travel::Status::DE::DBRIS->new( locationSearch => $station->{name}, ); - if ( not scalar $hafas->results ) { + if ( not scalar $dbris->results ) { say ' not found'; next; } - for my $result ( $hafas->results ) { - if ( $result->name eq $station->{name} ) { + for my $result ( $dbris->results ) { + if ( $result->name eq $station->{name} + or defined $result->eva and $result->eva == $station->{eva} ) + { $station->{latlong} = [ $result->lat, $result->lon ]; last; } |
