diff options
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 12 | ||||
-rw-r--r-- | lib/DBInfoscreen/Helper/DBRIS.pm | 20 |
2 files changed, 20 insertions, 12 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index afcb293..d05a5b1 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1300,17 +1300,7 @@ sub train_details_dbris { $self->render_later; - Travel::Status::DE::DBRIS->new_p( - journey => $trip_id, - cache => $self->app->cache_iris_rt, - lwp_options => { - timeout => 10, - agent => 'dbf.finalrewind.org/2' - }, - promise => 'Mojo::Promise', - user_agent => Mojo::UserAgent->new, - developer_mode => 1, - )->then( + $self->dbris->get_journey_p( id => $trip_id )->then( sub { my ($dbris) = @_; my $trip = $dbris->result; diff --git a/lib/DBInfoscreen/Helper/DBRIS.pm b/lib/DBInfoscreen/Helper/DBRIS.pm index 17f0084..e780213 100644 --- a/lib/DBInfoscreen/Helper/DBRIS.pm +++ b/lib/DBInfoscreen/Helper/DBRIS.pm @@ -29,6 +29,25 @@ sub new { } +sub get_journey_p { + my ( $self, %opt ) = @_; + + my $agent = $self->{user_agent}; + + if ( my $proxy = $ENV{DBFAKEDISPLAY_DBRIS_PROXY} ) { + $agent = Mojo::UserAgent->new; + $agent->proxy->http($proxy); + $agent->proxy->https($proxy); + } + + return Travel::Status::DE::DBRIS->new_p( + journey => $opt{id}, + cache => $self->{realtime_cache}, + promise => 'Mojo::Promise', + user_agent => $agent->request_timeout(10) + ); +} + # Input: TripID # Output: Promise returning a Travel::Status::DE::DBRIS::Journey instance on success sub get_polyline_p { @@ -40,7 +59,6 @@ sub get_polyline_p { my $agent = $self->{user_agent}; if ( my $proxy = $ENV{DBFAKEDISPLAY_DBRIS_PROXY} ) { - say "set up proxy $proxy"; $agent = Mojo::UserAgent->new; $agent->proxy->http($proxy); $agent->proxy->https($proxy); |