Commit 6c99da06 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

efa: add --auto-url / --discover-and-print option

parent 9e453dec
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ git HEAD
    * Support EFA services which do not distinguish between scheduled
      and realtime data (also pointed out by Gregor Herrmann)
    * efa: Add -D/--discover option
    * efa: Add -A/--auto-url option
    * Travel::Routing::DE::EFA: Add get_efa_urls method

Travel::Routing::DE::VRR 2.06 - Sat Aug 02 2014
+43 −27
Original line number Diff line number Diff line
@@ -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,12 +250,17 @@ if ( $opt->{discover} ) {
			);
		};
		if ($efa) {
			if ( $opt->{'auto-url'} ) {
				last;
			}
			printf( "%-55s (%s)\n", $url, $name );
		}
	}
	if ( $opt->{'discover'} ) {
		exit 0;
	}

}
else {
	$efa = eval {
		Travel::Routing::DE::EFA->new(
			efa_url => $efa_url,
@@ -279,6 +285,7 @@ $efa = eval {
			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