Commit 9c9c9cb9 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

efa: Added --prefer option (choose connection based on speed/interchanges/walking)

parent 713f157b
Loading
Loading
Loading
Loading
+34 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ my (@from, @to, @via);
my ($time, $time_depart, $time_arrive);
my $date;
my $restrict;
my $prefer;
my $debug = 0;
my $ignore_info = 'Fahrradmitnahme';
my ($i, $j, $con, $part);
@@ -119,6 +120,7 @@ GetOptions(
	'help'      => sub {exec('perldoc', $0)},
	'ignore-info=s' => \$ignore_info,
	'post=s'    => \%post,
	'prefer=s'  => \$prefer,
	'restrict=s' => \$restrict,
	'time=s'    => \$time,
	'to=s{2}'   => \@to,
@@ -159,6 +161,17 @@ if ($date) {
	@post{'itdDateDay','itdDateMonth','itdDateYear'} = split(/\./, $date);
}

if ($prefer) {
	given($prefer) {
		when('speed') { $post{routeType} = 'LEASTTIME' }
		when('nowait') { $post{routeType} = 'LEASTINTERCHANGE' }
		when('nowalk') { $post{routeType} = 'LEASTWALKING' }
		default {
			print STDERR "--prefer usage: speed / nowait / nowalk\n";
		}
	}
}

if ($restrict) {
	given ($restrict) {
		when('local') { $post{lineRestriction} = 403 }
@@ -267,13 +280,33 @@ Journey end time (overrides --time/--depart)

Journey date

=item B<--prefer> I<type>

Prefer connections of I<type>:

=over

=item * speed (default)

The faster, the better

=item * nowait

Prefer connections with less interchanges

=item * nowalk

Prefer connections with less walking (at interchanges)

=back

=item B<--restrict> I<type>

Only accept connections using trains of type I<type>, where I<type> may be:

=over

=item * local
=item * local (default)

only take local trains ("Verbund-/Nahverkehrslinien"). Slow, but the cheapest
method if you're not travelling long distance
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ arguments=(
	'(--depart --time)--arrive:time'
	'(--arrive --time)--depart:time'
	'--date:date'
	'--prefer:type:(speed nowait nowalk)'
	'--restrict:type:(local ic ice)'
	'--ignore-info:regex'
	'*--post:POST key=value'