diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-12-21 11:46:09 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-12-21 11:46:09 +0100 |
commit | 9822b5300bd676c92e24401ce0781c46e51c4913 (patch) | |
tree | 9491f8d9751a097a2b950a274a407cff8e8c283d /bin | |
parent | 31bf4dc87160c589a7da6cea66eef68ea2e40b25 (diff) |
add train/line name / description
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/db-zugbildung-to-json | 8 |
1 files changed, 7 insertions, 1 deletions
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{ ^ (?<type> [EINR][CJN][ A-Z-]{6} | TGV \s*+ ) (?<number> [ 0-9]{2,12}) }x + =~ m{ ^ (?<type> [EINR][CJN][ A-Z-]{6} | TGV \s*+ ) (?<number> [ 0-9]{2,12}) (?: \s+ (?<name> \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'; } |