Loading bin/efa-m +27 −25 Original line number Diff line number Diff line Loading @@ -24,6 +24,14 @@ my ( %edata, @edata_pre ); my ( $list_services, $discover_and_print, $discover ); my $efa; my %occupancy_map = ( MANY_SEATS => '.', FEW_SEATS => 'o', STANDING_ONLY => '*', FULL => '!', unknown => '?', ); @ARGV = map { decode( 'UTF-8', $_ ) } @ARGV; GetOptions( Loading Loading @@ -179,40 +187,42 @@ sub format_route { say 'BUG'; next; } my $occupancy = $stop->occupancy ? format_occupancy( $stop->occupancy ) : q{ }; if ( defined $stop->arr and defined $stop->dep ) { if ( $stop->arr->epoch == $stop->dep->epoch ) { $output .= sprintf( " %5s %40s %s\n", " %5s %s %40s %s\n", $stop->arr->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } else { $output .= sprintf( "%5s → %5s %40s %s\n", "%5s → %5s %s %40s %s\n", $stop->arr->strftime('%H:%M'), $stop->dep->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } } elsif ( defined $stop->arr ) { $output .= sprintf( "%5s %40s %s\n", "%5s %s %40s %s\n", $stop->arr->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } elsif ( defined $stop->dep ) { $output .= sprintf( " %5s %40s %s\n", " %5s %s %40s %s\n", $stop->dep->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } elsif ( $stop->full_name ) { $output .= sprintf( " %40s %s\n", $stop->full_name, $stop->platform, ); $output .= sprintf( " %s %40s %s\n", $occupancy, $stop->full_name, $stop->platform, ); } else { $output .= "?\n"; Loading Loading @@ -309,6 +319,12 @@ sub show_lines { return; } sub format_occupancy { my ($occupancy) = @_; return $occupancy_map{$occupancy} // $occupancy_map{unknown}; } sub show_results { my @output; Loading Loading @@ -396,21 +412,7 @@ sub show_results { = join( q{ }, map { $_->name } $d->route_interesting ); } elsif ( $d->occupancy ) { if ( $d->occupancy eq 'MANY_SEATS' ) { $output_line[3] = '.'; } elsif ( $d->occupancy eq 'FEW_SEATS' ) { $output_line[3] = 'o'; } elsif ( $d->occupancy eq 'STANDING_ONLY' ) { $output_line[3] = '*'; } elsif ( $d->occupancy eq 'FULL' ) { $output_line[3] = '!'; } else { $output_line[3] = '?'; } $output_line[3] = format_occupancy( $d->occupancy ); } if ( $edata{fullroute} ) { Loading lib/Travel/Status/DE/EFA/Departure.pm +1 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ sub parse_route { full_name => $stop->{name}, place => $stop->{place}, name => $stop->{nameWO}, occupancy => $stop->{occupancy}, platform => $ref->{platform} || $stop->{platformName} || undef, ) ); Loading lib/Travel/Status/DE/EFA/Stop.pm +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ our $VERSION = '2.02'; Travel::Status::DE::EFA::Stop->mk_ro_accessors( qw(sched_arr rt_arr arr sched_dep rt_dep dep occupancy place name full_name id latlon platform niveau) ); Loading Loading
bin/efa-m +27 −25 Original line number Diff line number Diff line Loading @@ -24,6 +24,14 @@ my ( %edata, @edata_pre ); my ( $list_services, $discover_and_print, $discover ); my $efa; my %occupancy_map = ( MANY_SEATS => '.', FEW_SEATS => 'o', STANDING_ONLY => '*', FULL => '!', unknown => '?', ); @ARGV = map { decode( 'UTF-8', $_ ) } @ARGV; GetOptions( Loading Loading @@ -179,40 +187,42 @@ sub format_route { say 'BUG'; next; } my $occupancy = $stop->occupancy ? format_occupancy( $stop->occupancy ) : q{ }; if ( defined $stop->arr and defined $stop->dep ) { if ( $stop->arr->epoch == $stop->dep->epoch ) { $output .= sprintf( " %5s %40s %s\n", " %5s %s %40s %s\n", $stop->arr->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } else { $output .= sprintf( "%5s → %5s %40s %s\n", "%5s → %5s %s %40s %s\n", $stop->arr->strftime('%H:%M'), $stop->dep->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } } elsif ( defined $stop->arr ) { $output .= sprintf( "%5s %40s %s\n", "%5s %s %40s %s\n", $stop->arr->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } elsif ( defined $stop->dep ) { $output .= sprintf( " %5s %40s %s\n", " %5s %s %40s %s\n", $stop->dep->strftime('%H:%M'), $stop->full_name, $stop->platform, $occupancy, $stop->full_name, $stop->platform, ); } elsif ( $stop->full_name ) { $output .= sprintf( " %40s %s\n", $stop->full_name, $stop->platform, ); $output .= sprintf( " %s %40s %s\n", $occupancy, $stop->full_name, $stop->platform, ); } else { $output .= "?\n"; Loading Loading @@ -309,6 +319,12 @@ sub show_lines { return; } sub format_occupancy { my ($occupancy) = @_; return $occupancy_map{$occupancy} // $occupancy_map{unknown}; } sub show_results { my @output; Loading Loading @@ -396,21 +412,7 @@ sub show_results { = join( q{ }, map { $_->name } $d->route_interesting ); } elsif ( $d->occupancy ) { if ( $d->occupancy eq 'MANY_SEATS' ) { $output_line[3] = '.'; } elsif ( $d->occupancy eq 'FEW_SEATS' ) { $output_line[3] = 'o'; } elsif ( $d->occupancy eq 'STANDING_ONLY' ) { $output_line[3] = '*'; } elsif ( $d->occupancy eq 'FULL' ) { $output_line[3] = '!'; } else { $output_line[3] = '?'; } $output_line[3] = format_occupancy( $d->occupancy ); } if ( $edata{fullroute} ) { Loading
lib/Travel/Status/DE/EFA/Departure.pm +1 −0 Original line number Diff line number Diff line Loading @@ -155,6 +155,7 @@ sub parse_route { full_name => $stop->{name}, place => $stop->{place}, name => $stop->{nameWO}, occupancy => $stop->{occupancy}, platform => $ref->{platform} || $stop->{platformName} || undef, ) ); Loading
lib/Travel/Status/DE/EFA/Stop.pm +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ our $VERSION = '2.02'; Travel::Status::DE::EFA::Stop->mk_ro_accessors( qw(sched_arr rt_arr arr sched_dep rt_dep dep occupancy place name full_name id latlon platform niveau) ); Loading