From 385b25b93a3f10a4044df9fc73027b8ae70dbc8a Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 25 Sep 2024 21:29:00 +0200 Subject: add primitive stopseq output TODO: Proper classes, locality/parent handling, et cetera --- bin/efa-m | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'bin/efa-m') diff --git a/bin/efa-m b/bin/efa-m index 9df1e37..9ddb70b 100755 --- a/bin/efa-m +++ b/bin/efa-m @@ -258,6 +258,26 @@ sub display_result { return; } +sub show_stopseq { + my $trip = $efa->result; + + printf( "%s %s → %s\n", + $trip->line, $trip->number // q{}, + $trip->dest_name ); + + for my $stop ( $trip->route ) { + printf( "%s → %s %s\n", + $stop->{sched_arr} + ? ( $stop->{rt_arr} // $stop->{sched_arr} )->strftime('%H:%M') + : q{ }, + $stop->{sched_dep} + ? ( $stop->{rt_dep} // $stop->{sched_dep} )->strftime('%H:%M') + : q{ }, + $stop->{name_full}, + ); + } +} + sub show_lines { my @output; @@ -449,7 +469,10 @@ if ( my $err = $efa->errstr ) { exit 2; } -if ($list_lines) { +if ($stopseq) { + show_stopseq(); +} +elsif ($list_lines) { show_lines(); } else { -- cgit v1.2.3