From 9822b5300bd676c92e24401ce0781c46e51c4913 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 21 Dec 2020 11:46:09 +0100 Subject: add train/line name / description --- bin/db-zugbildung-to-json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/db-zugbildung-to-json b/bin/db-zugbildung-to-json index 5ed33c0..c00b784 100755 --- a/bin/db-zugbildung-to-json +++ b/bin/db-zugbildung-to-json @@ -220,7 +220,7 @@ for my $line (@lines) { } if ( $line - =~ m{ ^ (? [EINR][CJN][ A-Z-]{6} | TGV \s*+ ) (? [ 0-9]{2,12}) }x + =~ m{ ^ (? [EINR][CJN][ A-Z-]{6} | TGV \s*+ ) (? [ 0-9]{2,12}) (?: \s+ (? \S .* ) )? }x ) { $type = $+{type}; @@ -228,6 +228,8 @@ for my $line (@lines) { $number = $+{number}; $number =~ tr{ }{}d; + my $name = $+{name}; + if ( $number !~ m{ ^ \d+ $ }x ) { next; } @@ -239,6 +241,10 @@ for my $line (@lines) { rawType => $type, }; + if ($name) { + $map{$number}{name} = $name; + } + if ( $type eq 'ICE-A' ) { $map{$number}{type} = 'ICE 1/2/4'; } -- cgit v1.2.3