From 6d8a390dcff71ef1c4b7755dac97c0e1111e5230 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 27 Apr 2015 18:14:57 +0200 Subject: parse in fchg, add replacement support to backend and frontend --- bin/db-iris | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) (limited to 'bin/db-iris') diff --git a/bin/db-iris b/bin/db-iris index f2b65b0..91a1d88 100755 --- a/bin/db-iris +++ b/bin/db-iris @@ -85,17 +85,18 @@ if ($time) { for my $efield (@edata_pre) { given ($efield) { - when ('a') { $edata{additional} = 1 } - when ('c') { $edata{canceled} = 1 } - when ('d') { $edata{delay} = 1 } - when ('D') { $edata{delays} = 1 } - when ('f') { $edata{fullroute} = 1 } - when ('m') { $edata{messages} = 1 } - when ('q') { $edata{qos} = 1 } - when ('r') { $edata{route} = 1 } - when ('t') { $edata{times} = 1 } - when ('!') { $edata{debug} = 1 } - default { $edata{$efield} = 1 } + when ('a') { $edata{additional} = 1 } + when ('c') { $edata{canceled} = 1 } + when ('d') { $edata{delay} = 1 } + when ('D') { $edata{delays} = 1 } + when ('f') { $edata{fullroute} = 1 } + when ('m') { $edata{messages} = 1 } + when ('q') { $edata{qos} = 1 } + when ('r') { $edata{route} = 1 } + when ('R') { $edata{replacements} = 1 } + when ('t') { $edata{times} = 1 } + when ('!') { $edata{debug} = 1 } + default { $edata{$efield} = 1 } } } @@ -263,6 +264,23 @@ sub display_result { print "\n"; } + if ( $edata{replacements} ) { + for my $e ( $d->replaced_by ) { + printf( + "Ersatzzug: %s%s %s\n", + $e->type, $e->line_no // q{}, + $e->train_no + ); + } + for my $e ( $d->replacement_for ) { + printf( + "Ersatzzug für: %s%s %s\n", + $e->type, $e->line_no // q{}, + $e->train_no + ); + } + } + if ( $edata{additional} and $d->additional_stops ) { printf( "Zusätzlicher Halt in: %s\n", join( q{, }, $d->additional_stops ) ); @@ -368,9 +386,12 @@ for my $d ( $status->results() ) { push( @output, [ - $timestr, $d->train . ($d->is_unscheduled ? ' !' : q{}), + $timestr, + $d->train . ( $d->is_unscheduled ? ' !' : q{} ), $edata{route} ? join( q{ }, $d->route_interesting ) : q{}, - $d->route_end, $platformstr // q{}, $d + $d->route_end, + $platformstr // q{}, + $d ] ); @@ -507,6 +528,11 @@ omitted, use the m / messages type to see those as well. Show up to three stops between I and the train's destination. +=item R / replacements + +For cancelled trains: Print their replacement train(s), if present. +For unplanned trains: Print the train(s) they replace, if present. + =item t / times Show both scheduled and expected arrival and departure times. -- cgit v1.2.3