From de828666cfafcf2d767e67c5f0d568f9e6eb9be0 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 26 Jul 2015 20:31:12 +0200 Subject: add mot filter support --- bin/efa-m | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/efa-m b/bin/efa-m index 8c527a4..520d03a 100755 --- a/bin/efa-m +++ b/bin/efa-m @@ -20,7 +20,7 @@ my ( $date, $time, $input_type, $list_lines, $offset, $relative_times ); my ($full_routes); my ( $filter_via, $track_via ); my ( $timeout, $developer_mode ); -my ( @grep_lines, @grep_platforms ); +my ( @grep_lines, @grep_platforms, @grep_mots ); my ( %edata, @edata_pre ); @ARGV = map { decode( 'UTF-8', $_ ) } @ARGV; @@ -30,6 +30,7 @@ GetOptions( 'h|help' => sub { show_help(0) }, 'l|line=s@' => \@grep_lines, 'L|linelist' => \$list_lines, + 'm|mot=s@' => \@grep_mots, 'o|offset=i' => \$offset, 'O|output=s@' => \@edata_pre, 'p|platform=s@' => \@grep_platforms, @@ -51,6 +52,7 @@ if ( @ARGV != 2 ) { # --line=foo,bar support @edata_pre = split( qr{,}, join( q{,}, @edata_pre ) ); @grep_lines = split( qr{,}, join( q{,}, @grep_lines ) ); +@grep_mots = split( qr{,}, join( q{,}, @grep_mots ) ); @grep_platforms = split( qr{,}, join( q{,}, @grep_platforms ) ); my ( $place, $input ) = @ARGV; @@ -174,7 +176,13 @@ sub show_lines { for my $l ( $status->lines ) { - if ( @grep_lines and not( $l->name ~~ \@grep_lines ) ) { + if ( ( @grep_lines and not( $l->name ~~ \@grep_lines ) ) + or ( @grep_mots and not( $l->mot_name ~~ \@grep_mots ) ) ) + { + next; + } + + if ( @grep_mots and not( $l->mot_name ~~ \@grep_mots ) ) { next; } @@ -206,7 +214,8 @@ sub show_results { } if ( - ( @grep_lines and not( $d->line ~~ \@grep_lines ) ) + ( @grep_lines and not( $d->line ~~ \@grep_lines ) ) + or ( @grep_mots and not( $d->mot_name ~~ \@grep_mots ) ) or ( @grep_platforms and not( $platform ~~ \@grep_platforms ) ) or ( $offset and $d->countdown < $offset ) @@ -326,6 +335,15 @@ using B<--date> and B<--time> are guaranteed to be included. Only show departures of I (comma-separatad list, option may be repeated) +=item B<-m>, B<--mot> I + +Only show departures whose type appears in I (comma-separated list, +this option may be repeated). + +The following departure types ("modes of transport") are supported: +zug, s-bahn, u-bahn, stadtbahn, tram, stadtbus, regionalbus, schnellbus, +seilbahn, schiff, ast, sonstige + =item B<-o>, B<--offset> I Ignore departures which are less than I from now. -- cgit v1.2.3