From ffbf7ca613885ce8093cc4325d04cd14e147ab80 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 16 Jun 2015 22:28:53 +0200 Subject: parse footpaths, print them when efa -E is used --- bin/efa | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'bin/efa') diff --git a/bin/efa b/bin/efa index 6c1649f..3cbd03c 100755 --- a/bin/efa +++ b/bin/efa @@ -114,6 +114,29 @@ sub check_for_error { return; } +sub format_footpath { + my @parts = @_; + my $str = q{}; + + for my $path_elem (@parts) { + my ( $type, $level ) = @{$path_elem}; + if ( $level eq 'UP' ) { + $str .= ' ↗'; + } + elsif ( $level eq 'DOWN' ) { + $str .= ' ↘'; + } + elsif ( $level eq 'LEVEL' ) { + $str .= ' →'; + } + else { + $str .= " [unhandled level, please report a bug : $level]"; + } + } + + return $str; +} + sub display_connection { my ($c) = @_; @@ -153,6 +176,14 @@ sub display_connection { printf( "%-5s an %s\n", $c->arrival_time, $c->arrival_stop_and_platform, ); print "\n"; + if ( $opt->{'extended-info'} + and $c->footpath_duration + and $c->footpath_type ne 'IDEST' ) + { + printf( "%5d min Umsteigedauer: %s\n\n", + $c->footpath_duration, format_footpath( $c->footpath_parts ) ); + } + return; } -- cgit v1.2.3