From 58fe3b8be3c434610354e9954e630da3146cc01a Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 11 Nov 2023 00:44:22 +0100 Subject: expose transfer times between consecutive connection sections --- bin/hafas | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/hafas b/bin/hafas index 0d89c9f..b36b337 100755 --- a/bin/hafas +++ b/bin/hafas @@ -254,8 +254,22 @@ for my $res ( @{ $hafas->{results} } ) { # say "# cancelled\n"; #} - my $glance = join( ' - ', - map { $_->name } grep { $_->type eq 'JNY' } $res->sections ); + my $glance = q{}; + for my $sec ( $res->sections ) { + if ( $sec->type ne 'JNY' ) { + next; + } + if ( defined $sec->transfer_duration ) { + $glance .= sprintf( + ' (%01d:%02d) %s', + $sec->transfer_duration->in_units( 'hours', 'minutes' ), + $sec->name + ); + } + else { + $glance .= $sec->name; + } + } printf( "# %02d:%02d %s %s\n", -- cgit v1.2.3