Skip to content
Commits on Source (5)
......@@ -82,6 +82,7 @@ for my $efield (@edata_pre) {
elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $full_routes = 1 }
elsif ( $efield eq 'f' ) { $edata{fullroute} = 1; $full_routes = 1 }
elsif ( $efield eq 'r' ) { $edata{route} = 1; $full_routes = 1 }
elsif ( $efield eq 'm' ) { $edata{messages} = 1 }
else { $edata{$efield} = 1 }
}
if ($filter_via) {
......@@ -145,6 +146,14 @@ sub show_version {
exit 0;
}
sub format_delay {
my ( $delay, $len ) = @_;
if ( $delay and $len ) {
return sprintf( "(%+${len}d)", $delay );
}
return q{};
}
sub format_route {
my (@route) = @_;
......@@ -193,7 +202,7 @@ sub display_result {
for my $line (@lines) {
if ( length( $line->[5] ) ) {
if ( $edata{messages} and length( $line->[5] ) ) {
$line->[5] =~ tr{\n\x0d}{ }s;
chomp $line->[5];
print "\n";
......@@ -243,6 +252,17 @@ sub show_lines {
sub show_results {
my @output;
my $delay_len = 0;
my $delay_fmt = 0;
for my $d ( $efa->results ) {
if ( $d->delay ) {
$delay_len = max( $delay_len, length( $d->delay ) + 1 );
}
}
if ($delay_len) {
$delay_fmt = $delay_len + 3;
}
for my $d ( $efa->results ) {
my @output_line;
......@@ -250,7 +270,7 @@ sub show_results {
my $dtime = (
$relative_times
? sprintf( '%2d min', $d->countdown )
: $d->sched_time
: $d->time
);
if ( $d->platform_db ) {
......@@ -276,7 +296,7 @@ sub show_results {
next;
}
else {
$dtime .= ' CANCELED';
$dtime = '--:--';
}
}
elsif ($track_via) {
......@@ -284,12 +304,7 @@ sub show_results {
$dtime .= '' . $via->arr_time;
}
if ( $d->delay ) {
if ($relative_times) {
$dtime .= ' (+' . $d->delay . ')';
}
else {
$dtime .= ' +' . $d->delay;
}
$dtime .= ' ' . format_delay( $d->delay, $delay_len );
}
@output_line
......@@ -509,6 +524,12 @@ Show up to three stops between the requested station and the departure's
destination. B<efa-m> tries to display the three most important stops,
however these are heuristically determined and may not be optimal.
=item m / messages
Show free-text messages associated with individual departures. These can
include generic information such is bicycle transportation options or Wi-Fi
availability, delay reasons, and more.
=back
=item B<-p>, B<--platform> I<platforms>
......
......@@ -20,7 +20,7 @@ VVS Stuttgart Schwabstraße"
echo $checks | while read service name place; do
echo -n "${service} ... "
if bin/efa-m -s $service $name $place > /dev/null; then
if perl -Ilib bin/efa-m -s $service $name $place > /dev/null; then
echo OK
fi
done