summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/db-zugbildung-to-json8
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';
}