summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS/Result.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-12-13 13:58:56 +0100
committerDaniel Friesel <derf@finalrewind.org>2016-12-13 13:58:56 +0100
commit059789620c0ffaa8f69d59a3137a10e342ead366 (patch)
treef8d151b0ac4cfc55c836bc2c4f179b3383593342 /lib/Travel/Status/DE/IRIS/Result.pm
parenteabf885d15ce6bbafc0a737f1ecd171f6067d5ed (diff)
experimental manual line number mapping (not provided by IRIS at the moment)
Diffstat (limited to 'lib/Travel/Status/DE/IRIS/Result.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS/Result.pm29
1 files changed, 29 insertions, 0 deletions
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 );
}