diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-01-04 23:33:11 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-01-04 23:33:11 +0100 |
commit | 8053eb8835a0fec2171d153a4a99db72156c34aa (patch) | |
tree | b3194ce32f4689d8e63fccde4a2ae676d393dc5b | |
parent | 45f4e39216d05217de9341bd991860d1cc95a3d5 (diff) |
Use correct Trip ID request for arrival-only trains2.5.1
-rw-r--r-- | lib/DBInfoscreen/Controller/Map.pm | 4 | ||||
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/DBInfoscreen/Controller/Map.pm b/lib/DBInfoscreen/Controller/Map.pm index df749bf..81c3b20 100644 --- a/lib/DBInfoscreen/Controller/Map.pm +++ b/lib/DBInfoscreen/Controller/Map.pm @@ -21,8 +21,8 @@ sub get_hafas_polyline { #say $url; my $res = $ua->get( -"https://2.db.transport.rest/trips/${trip_id}?lineName=${line}&polyline=true" - => { 'User-Agent' => "dbf.finalrewind.org/${dbf_version}" } )->result; + $url => { 'User-Agent' => "dbf.finalrewind.org/${dbf_version}" } ) + ->result; if ( $res->is_error ) { return; } diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index d593105..fb778dd 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -124,16 +124,19 @@ sub get_hafas_trip_id { my $eva = $train->station_uic; my $dep_ts = DateTime->now( time_zone => 'Europe/Berlin' ); + my $url + = "https://2.db.transport.rest/stations/${eva}/departures?duration=5&when=$dep_ts"; if ( $train->sched_departure ) { $dep_ts = $train->sched_departure->epoch; + $url + = "https://2.db.transport.rest/stations/${eva}/departures?duration=5&when=$dep_ts"; } elsif ( $train->sched_arrival ) { $dep_ts = $train->sched_arrival->epoch; + $url + = "https://2.db.transport.rest/stations/${eva}/arrivals?duration=5&when=$dep_ts"; } - my $url - = "https://2.db.transport.rest/stations/${eva}/departures?duration=5&when=$dep_ts"; - if ( my $content = $cache->get($url) ) { return $content; } @@ -141,8 +144,8 @@ sub get_hafas_trip_id { $ua->request_timeout(2); my $res = $ua->get( -"https://2.db.transport.rest/stations/${eva}/departures?duration=5&when=$dep_ts" - => { 'User-Agent' => "dbf.finalrewind.org/${dbf_version}" } )->result; + $url => { 'User-Agent' => "dbf.finalrewind.org/${dbf_version}" } ) + ->result; if ( $res->is_error ) { return; } |