diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/efa | 70 |
1 files changed, 43 insertions, 27 deletions
@@ -157,6 +157,7 @@ GetOptions( $opt, qw{ arrive|a=s + auto-url|discover-and-print|A bike|b date|d=s depart=s @@ -221,7 +222,7 @@ if ( $opt->{exclude} ) { $opt->{exclude} = [ split( /,/, join( ',', @{ $opt->{exclude} } ) ) ]; } -if ( $opt->{discover} ) { +if ( $opt->{discover} or $opt->{'auto-url'} ) { for my $pair ( Travel::Routing::DE::EFA::get_efa_urls() ) { my ( $url, $name ) = @{$pair}; $efa = eval { @@ -249,36 +250,42 @@ if ( $opt->{discover} ) { ); }; if ($efa) { + if ( $opt->{'auto-url'} ) { + last; + } printf( "%-55s (%s)\n", $url, $name ); } } - exit 0; + if ( $opt->{'discover'} ) { + exit 0; + } +} +else { + $efa = eval { + Travel::Routing::DE::EFA->new( + efa_url => $efa_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} }, + ); + }; } - -$efa = eval { - Travel::Routing::DE::EFA->new( - efa_url => $efa_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} }, - ); -}; check_for_error($@); @@ -375,6 +382,15 @@ Journey end time (overrides --time/--depart) Journey date +=item B<-A>|B<--auto-url>|B<--discover-and-print> + +Probe all known EFA entry points for the specified connection. Print the first +result which was not an error. + +Note that this may take a while and will not neccessarily return the best +result. Also, using this option by default is not recommended, as it puts +EFA services under considerable additional load. + =item B<-b>|B<--bike> Choose connections allowing to carry a bike |