From 059789620c0ffaa8f69d59a3137a10e342ead366 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 13 Dec 2016 13:58:56 +0100 Subject: experimental manual line number mapping (not provided by IRIS at the moment) --- lib/Travel/Status/DE/IRIS/Result.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib') diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 75bff00..847682f 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -98,6 +98,30 @@ my %translation = ( 900 => 'Anschlussbus wartet(?)', ); +my %linemap = ( + RE => { + 100 => 11, + 101 => 1, + 102 => 2, + 104 => 4, + 105 => 5, + 106 => 6, + 112 => 42, + }, + S => { + 301 => 1, + 303 => 3, + 306 => 6, + 308 => '8', + 309 => 9, + 311 => 1, + 312 => 2, + 313 => 3, + 315 => 5, + 316 => 6, + } +); + Travel::Status::DE::IRIS::Result->mk_ro_accessors( qw(arrival date datetime delay departure is_cancelled is_transfer is_unscheduled is_wing line_no old_train_id old_train_no platform raw_id @@ -178,6 +202,11 @@ sub new { $ref->{is_cancelled} = 0; + if ( not defined $ref->{line_no} ) { + my $train_prefix = substr( $ref->{train_no}, 0, 3 ); + $ref->{line_no} = $linemap{ $ref->{type} }{$train_prefix}; + } + return bless( $ref, $obj ); } -- cgit v1.2.3