Loading Changelog +6 −0 Original line number Diff line number Diff line git HEAD * Line: Add mot and mot_name accessors * Result: Add mot and mot_name accessors * efa-m: Add -m / --mot option Travel::Status::DE::VRR 1.11 - Tue Jun 30 2015 * efa-m: Remove -V alias for --version Loading bin/efa-m +21 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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, Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -207,6 +215,7 @@ sub show_results { if ( ( @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 ) Loading Loading @@ -326,6 +335,15 @@ using B<--date> and B<--time> are guaranteed to be included. Only show departures of I<lines> (comma-separatad list, option may be repeated) =item B<-m>, B<--mot> I<motlist> Only show departures whose type appears in I<motlist> (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<minutes> Ignore departures which are less than I<minutes> from now. Loading lib/Travel/Status/DE/EFA.pm +4 −0 Original line number Diff line number Diff line Loading @@ -293,6 +293,7 @@ sub lines { my $direction = $e->getAttribute('direction'); my $valid = $e->getAttribute('valid'); my $type = $e_info->getAttribute('name'); my $mot = $e->getAttribute('motType'); my $route = ( $e_route ? $e_route->textContent : undef ); my $operator = ( $e_oper ? $e_oper->textContent : undef ); my $identifier = $e->getAttribute('stateless'); Loading @@ -304,6 +305,7 @@ sub lines { direction => decode( 'UTF-8', $direction ), valid => $valid, type => decode( 'UTF-8', $type ), mot => $mot, route => decode( 'UTF-8', $route ), operator => decode( 'UTF-8', $operator ), identifier => $identifier, Loading Loading @@ -408,6 +410,7 @@ sub results { my $countdown = $e->getAttribute('countdown'); my $delay = $e_info->getAttribute('delay'); my $type = $e_info->getAttribute('name'); my $mot = $e_line->getAttribute('motType'); my $platform_is_db = 0; Loading Loading @@ -467,6 +470,7 @@ sub results { sched_date => $date, sched_time => $time, type => $type, mot => $mot, prev_route => \@prev_route, next_route => \@next_route, ) Loading lib/Travel/Status/DE/EFA/Line.pm +12 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,12 @@ use parent 'Class::Accessor'; our $VERSION = '1.11'; Travel::Status::DE::EFA::Line->mk_ro_accessors( qw(direction name operator route type valid)); qw(direction mot name operator route type valid)); my @mot_mapping = qw{ zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus schnellbus seilbahn schiff ast sonstige }; sub new { my ( $obj, %conf ) = @_; Loading @@ -19,6 +24,12 @@ sub new { return bless( $ref, $obj ); } sub mot_name { my ($self) = @_; return $mot_mapping[ $self->{mot} ] // 'sonstige'; } sub TO_JSON { my ($self) = @_; Loading lib/Travel/Status/DE/EFA/Result.pm +12 −1 Original line number Diff line number Diff line Loading @@ -12,9 +12,14 @@ our $VERSION = '1.11'; Travel::Status::DE::EFA::Result->mk_ro_accessors( qw(countdown date delay destination is_cancelled info key line lineref platform platform_db platform_name sched_date sched_time time type) mot platform platform_db platform_name sched_date sched_time time type) ); my @mot_mapping = qw{ zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus schnellbus seilbahn schiff ast sonstige }; sub new { my ( $obj, %conf ) = @_; Loading @@ -31,6 +36,12 @@ sub new { return bless( $ref, $obj ); } sub mot_name { my ($self) = @_; return $mot_mapping[ $self->{mot} ] // 'sonstige'; } sub route_pre { my ($self) = @_; Loading Loading
Changelog +6 −0 Original line number Diff line number Diff line git HEAD * Line: Add mot and mot_name accessors * Result: Add mot and mot_name accessors * efa-m: Add -m / --mot option Travel::Status::DE::VRR 1.11 - Tue Jun 30 2015 * efa-m: Remove -V alias for --version Loading
bin/efa-m +21 −3 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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, Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -207,6 +215,7 @@ sub show_results { if ( ( @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 ) Loading Loading @@ -326,6 +335,15 @@ using B<--date> and B<--time> are guaranteed to be included. Only show departures of I<lines> (comma-separatad list, option may be repeated) =item B<-m>, B<--mot> I<motlist> Only show departures whose type appears in I<motlist> (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<minutes> Ignore departures which are less than I<minutes> from now. Loading
lib/Travel/Status/DE/EFA.pm +4 −0 Original line number Diff line number Diff line Loading @@ -293,6 +293,7 @@ sub lines { my $direction = $e->getAttribute('direction'); my $valid = $e->getAttribute('valid'); my $type = $e_info->getAttribute('name'); my $mot = $e->getAttribute('motType'); my $route = ( $e_route ? $e_route->textContent : undef ); my $operator = ( $e_oper ? $e_oper->textContent : undef ); my $identifier = $e->getAttribute('stateless'); Loading @@ -304,6 +305,7 @@ sub lines { direction => decode( 'UTF-8', $direction ), valid => $valid, type => decode( 'UTF-8', $type ), mot => $mot, route => decode( 'UTF-8', $route ), operator => decode( 'UTF-8', $operator ), identifier => $identifier, Loading Loading @@ -408,6 +410,7 @@ sub results { my $countdown = $e->getAttribute('countdown'); my $delay = $e_info->getAttribute('delay'); my $type = $e_info->getAttribute('name'); my $mot = $e_line->getAttribute('motType'); my $platform_is_db = 0; Loading Loading @@ -467,6 +470,7 @@ sub results { sched_date => $date, sched_time => $time, type => $type, mot => $mot, prev_route => \@prev_route, next_route => \@next_route, ) Loading
lib/Travel/Status/DE/EFA/Line.pm +12 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,12 @@ use parent 'Class::Accessor'; our $VERSION = '1.11'; Travel::Status::DE::EFA::Line->mk_ro_accessors( qw(direction name operator route type valid)); qw(direction mot name operator route type valid)); my @mot_mapping = qw{ zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus schnellbus seilbahn schiff ast sonstige }; sub new { my ( $obj, %conf ) = @_; Loading @@ -19,6 +24,12 @@ sub new { return bless( $ref, $obj ); } sub mot_name { my ($self) = @_; return $mot_mapping[ $self->{mot} ] // 'sonstige'; } sub TO_JSON { my ($self) = @_; Loading
lib/Travel/Status/DE/EFA/Result.pm +12 −1 Original line number Diff line number Diff line Loading @@ -12,9 +12,14 @@ our $VERSION = '1.11'; Travel::Status::DE::EFA::Result->mk_ro_accessors( qw(countdown date delay destination is_cancelled info key line lineref platform platform_db platform_name sched_date sched_time time type) mot platform platform_db platform_name sched_date sched_time time type) ); my @mot_mapping = qw{ zug s-bahn u-bahn stadtbahn tram stadtbus regionalbus schnellbus seilbahn schiff ast sonstige }; sub new { my ( $obj, %conf ) = @_; Loading @@ -31,6 +36,12 @@ sub new { return bless( $ref, $obj ); } sub mot_name { my ($self) = @_; return $mot_mapping[ $self->{mot} ] // 'sonstige'; } sub route_pre { my ($self) = @_; Loading