summaryrefslogtreecommitdiff
path: root/bin/efa
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-11-29 14:41:18 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-11-29 14:41:18 +0100
commit7e8258ae6c0cb53cdde02cf48f506eb9f7a29660 (patch)
tree5c72ea934d7b9f05799f8f63299fdf7953bcfecf /bin/efa
parent1d5e4aedb8d4e114b02d508fa52371d3218a1119 (diff)
Fix display and parsing of delay connections
Diffstat (limited to 'bin/efa')
-rwxr-xr-xbin/efa58
1 files changed, 35 insertions, 23 deletions
diff --git a/bin/efa b/bin/efa
index 1844102..24026a3 100755
--- a/bin/efa
+++ b/bin/efa
@@ -105,6 +105,40 @@ sub check_for_error {
return;
}
+sub display_connection {
+ my ($c) = @_;
+
+ if ( $c->delay ) {
+ printf( "# +%d, scheduled: %s -> %s\n",
+ $c->delay, $c->departure_stime, $c->arrival_stime );
+ }
+
+ for my $extra ( $c->extra ) {
+
+ if ( not( length $ignore_info and $extra =~ /$ignore_info/i ) ) {
+ say "# $extra";
+ }
+ }
+
+ printf(
+ "%-5s ab %-30s %-20s %s\n",
+ $c->departure_time, $c->departure_stop_and_platform,
+ $c->train_line, $c->train_destination,
+ );
+
+ if ( $opt->{'extended-info'} and $opt->{'extended-info'} == 2 ) {
+ for my $via ( @{ $c->{via} } ) {
+ printf( "%-5s %-22s %s\n", @{$via}[ 1 .. 3 ] );
+ }
+ }
+
+ printf( "%-5s an %s\n\n",
+ $c->arrival_time, $c->arrival_stop_and_platform,
+ );
+
+ return;
+}
+
#<<<
GetOptions(
$opt,
@@ -206,29 +240,7 @@ for my $i ( 0 .. $#routes ) {
}
for my $c ( $route->parts ) {
-
- for my $extra ( $c->extra ) {
-
- if ( not( length $ignore_info and $extra =~ /$ignore_info/i ) ) {
- say "# $extra";
- }
- }
-
- printf(
- "%-5s ab %-30s %-20s %s\n",
- $c->departure_time, $c->departure_stop_and_platform,
- $c->train_line, $c->train_destination,
- );
-
- if ( $opt->{'extended-info'} and $opt->{'extended-info'} == 2 ) {
- for my $via ( @{ $c->{via} } ) {
- printf( "%-5s %-22s %s\n", @{$via}[ 1 .. 3 ] );
- }
- }
-
- printf( "%-5s an %s\n\n",
- $c->arrival_time, $c->arrival_stop_and_platform,
- );
+ display_connection($c);
}
if ( $i != $#routes ) {
print "------\n\n";