diff options
author | Daniel Friesel <derf@finalrewind.org> | 2014-08-03 23:08:27 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2014-08-03 23:08:27 +0200 |
commit | 9e453dec999ac7fd5fc7b526bb7fe04d9c20112e (patch) | |
tree | 22943f30cfb55d73b7074e6c068801a65083e9c7 /bin | |
parent | 23b5098a8528ae7c5ad5299ce2e108699f96e9fc (diff) |
add --discover option and get_efa_urls method
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/efa | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -160,6 +160,7 @@ GetOptions( bike|b date|d=s depart=s + discover|D efa-url|u=s exclude|e=s@ extended-info|E @@ -220,6 +221,40 @@ if ( $opt->{exclude} ) { $opt->{exclude} = [ split( /,/, join( ',', @{ $opt->{exclude} } ) ) ]; } +if ( $opt->{discover} ) { + for my $pair ( Travel::Routing::DE::EFA::get_efa_urls() ) { + my ( $url, $name ) = @{$pair}; + $efa = eval { + Travel::Routing::DE::EFA->new( + efa_url => $url, + + origin => [ @from, $from_type ], + destination => [ @to, $to_type ], + via => ( @via ? [ @via, $via_type ] : undef ), + + arrival_time => $opt->{arrive}, + departure_time => $opt->{depart} // $opt->{time}, + date => $opt->{date}, + exclude => $opt->{exclude}, + train_type => $opt->{include}, + with_bike => $opt->{bike}, + + select_interchange_by => $opt->{prefer}, + use_near_stops => $opt->{proximity}, + walk_speed => $opt->{'walk-speed'}, + max_interchanges => $opt->{'max-change'}, + num_results => $opt->{'num-connections'}, + + lwp_options => { timeout => $opt->{timeout} }, + ); + }; + if ($efa) { + printf( "%-55s (%s)\n", $url, $name ); + } + } + exit 0; +} + $efa = eval { Travel::Routing::DE::EFA->new( efa_url => $efa_url, @@ -344,6 +379,12 @@ Journey date Choose connections allowing to carry a bike +=item B<-D>|B<--discover> + +Probe all known EFA entry points for the specified connection. No routes are +returned in this case. Instead, B<efa> will print the URLs and names of all +entry points which did not return an error. + =item B<-e>|B<--exclude> I<transports> Exclude I<transports> (comma separated list). |