diff options
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-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; } |