summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/efa70
1 files changed, 43 insertions, 27 deletions
diff --git a/bin/efa b/bin/efa
index 3d8a377..89f3d81 100755
--- a/bin/efa
+++ b/bin/efa
@@ -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