Commit 8f6e84a4 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

db-ris: Add -f/--full-route option

parent ca37cdd0
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
git HEAD

    [db-ris]
    * Add --full-route option

    [Travel::Status::DE::DeutscheBahn]
    * Fix bug when receiving no platform numbers from the DB RIS
    * Result: Add route_timetable accessor containing station names and

    [Travel::Status::DE::DeutscheBahn::Result]
    * Add route_timetable accessor containing station names and
      their corresponding arrival times

Travel::Status::DE::DeutscheBahn 0.05 - Tue Aug 09 2011
+24 −7
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ my %train_type;
my ( $date, $time );
my $filter_via;
my $ignore_late     = 0;
my $show_full_route = 0;
my $types           = q{};

my @output;
@@ -22,6 +23,7 @@ binmode( STDOUT, ':encoding(utf-8)' );

GetOptions(
	'd|date=s'      => \$date,
	'f|full-route'  => \$show_full_route,
	'h|help'        => sub { show_help(0) },
	'L|ignore-late' => \$ignore_late,
	'm|mot=s'       => \$types,
@@ -77,8 +79,14 @@ sub display_result {
	}

	for my $line (@lines) {
		printf( join( q{  }, ( map { "%-${_}s" } @line_length ) ) . "\n",
			@{$line}, );
		printf(
			join( q{  }, ( map { "%-${_}s" } @line_length ) ) . "\n",
			@{$line}[ 0 .. 5 ]
		);

		if ($show_full_route) {
			print "\n" . $line->[6] . "\n\n\n";
		}
	}

	return;
@@ -106,9 +114,14 @@ for my $d ( $status->results() ) {
	push(
		@output,
		[
			$d->time, $d->train,
			join( q{  }, $d->route_interesting ), $d->destination,
			$d->platform, $d->info,
			$d->time,
			$d->train,
			join( q{  }, $d->route_interesting ),
			$d->destination,
			$d->platform,
			$d->info,
			join( "\n",
				map { sprintf( '%-5s  %s', @{$_} ) } $d->route_timetable ),
		]
	);
}
@@ -147,6 +160,10 @@ departure screens installed at most main stations.

Date to list departures for.  Default: today.

=item B<-f>, B<--full-route>

Display complete routes (including arrival times) of all trains.

=item B<-L>, B<--ignore-late>

Do not display delayed trains.