summaryrefslogtreecommitdiff
path: root/bin/efa-m
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-06-15 18:56:13 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2025-06-15 18:56:13 +0200
commit22d7855641ece6dfda7eb5689df88802ee1ce8ff (patch)
tree668f554a8ead4d128fe83b1194ab0322d679158c /bin/efa-m
parentef9542106adb6b8ea6cc40f9a98c808b305e6a28 (diff)
Stop: Add is_cancelled accessor
Diffstat (limited to 'bin/efa-m')
-rwxr-xr-xbin/efa-m20
1 files changed, 17 insertions, 3 deletions
diff --git a/bin/efa-m b/bin/efa-m
index 1890db9..3367a2f 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -233,7 +233,13 @@ sub format_route {
if ( $stop->delay ) {
$delay = sprintf( '(%+3d)', $stop->delay );
}
- if ( defined $stop->arr and defined $stop->dep ) {
+ if ( $stop->is_cancelled ) {
+ $output .= sprintf(
+ " --:-- %s %s %35s %s\n",
+ $delay, $occupancy, $stop->full_name, $stop->platform // q{},
+ );
+ }
+ elsif ( defined $stop->arr and defined $stop->dep ) {
if ( $stop->arr->epoch == $stop->dep->epoch ) {
$output .= sprintf(
" %5s %s %s %35s %s\n",
@@ -355,6 +361,10 @@ sub show_stopseq {
$delay_len = length( sprintf( '(%+d)', $max_delay ) ) + 1;
}
+ if ( first { $_->is_cancelled } $trip->route and $delay_len < 3 ) {
+ $delay_len = 3;
+ }
+
for my $stop ( $trip->route ) {
printf(
"%s → %s%${delay_len}s %s (%s) %s\n",
@@ -362,8 +372,12 @@ sub show_stopseq {
: q{ },
$stop->dep ? $stop->dep->strftime('%H:%M')
: q{ },
- $stop->delay ? sprintf( " (%+${inner_delay_len}d)", $stop->delay )
- : q{},
+ $stop->is_cancelled ? 'XX'
+ : (
+ $stop->delay
+ ? sprintf( " (%+${inner_delay_len}d)", $stop->delay )
+ : q{}
+ ),
$stop->full_name,
$stop->niveau,
$stop->platform