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

db-ris: Add option to ignore delayed trains

parent 999b777f
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -9,10 +9,13 @@ use Getopt::Long qw(:config no_ignore_case);
use List::Util qw(first max);
use Travel::Status::DE::DeutscheBahn;

my ( $date, $time );
my $types = q{};
my %train_type;

my ( $date, $time );
my $filter_via;
my $ignore_late = 0;
my $types       = q{};

my @output;

binmode( STDOUT, ':encoding(utf-8)' );
@@ -20,6 +23,7 @@ binmode( STDOUT, ':encoding(utf-8)' );
GetOptions(
	'd|date=s'      => \$date,
	'h|help'        => sub { show_help(0) },
	'L|ignore-late' => \$ignore_late,
	'm|mot=s'       => \$types,
	't|time=s'      => \$time,
	'v|via=s'       => \$filter_via,
@@ -132,12 +136,18 @@ for my $d ( $status->results() ) {

	my ( @via, @via_main, @via_show );

	my $re_late = qr{ (?: ^ | , ) ca[.] \s \d+ \s Minuten \s sp.ter}ox;

	@via = $d->route;

	if ( $filter_via and not( first { $_ =~ m{$filter_via}io } @via ) ) {
		next;
	}

	if ( $ignore_late and $d->info =~ $re_late ) {
		next;
	}

	push(
		@output,
		[