diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-20 05:38:36 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-20 05:38:36 +0200 |
commit | 2c0bed6d0f642cab07da4a27adfb70428020e015 (patch) | |
tree | 54fa57992773901e75b82b136fa96bc485eee423 /lib/DBInfoscreen/Helper/EFA.pm | |
parent | 027b943323d0b71763eb5f4dc926ff32e0731106 (diff) |
Add partial EFA map support
No live position yet
Diffstat (limited to 'lib/DBInfoscreen/Helper/EFA.pm')
-rw-r--r-- | lib/DBInfoscreen/Helper/EFA.pm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Helper/EFA.pm b/lib/DBInfoscreen/Helper/EFA.pm index 13944cd..0e7f7d7 100644 --- a/lib/DBInfoscreen/Helper/EFA.pm +++ b/lib/DBInfoscreen/Helper/EFA.pm @@ -29,6 +29,39 @@ sub new { } +sub get_polyline_p { + my ( $self, %opt ) = @_; + + my $stopseq = $opt{stopseq}; + my $service = $opt{service}; + my $promise = Mojo::Promise->new; + + Travel::Status::DE::EFA->new_p( + service => $service, + stopseq => $stopseq, + cache => $self->{realtime_cache}, + promise => 'Mojo::Promise', + user_agent => $self->{user_agent}->request_timeout(10) + )->then( + sub { + my ($efa) = @_; + my $journey = $efa->result; + + $promise->resolve($journey); + return; + } + )->catch( + sub { + my ($err) = @_; + $self->{log}->debug("EFA->new_p($stopseq) error: $err"); + $promise->reject($err); + return; + } + )->wait; + + return $promise; +} + sub get_coverage { my ( $self, $service ) = @_; |