diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-12-12 11:00:54 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-12-12 11:00:54 +0100 |
commit | 67fffbb4d97e8b353f2696273f62da6087ae2fba (patch) | |
tree | 50c5f6605734c69adac43794ff5249822a20aec1 /bin/db-wagenreihung-to-json | |
parent | ab20cf7c89c2c4d6cd1729423a0a3b99b1374994 (diff) |
add conditions and details to json (raw data so far)
Diffstat (limited to 'bin/db-wagenreihung-to-json')
-rwxr-xr-x | bin/db-wagenreihung-to-json | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/db-wagenreihung-to-json b/bin/db-wagenreihung-to-json index 893132e..9827523 100755 --- a/bin/db-wagenreihung-to-json +++ b/bin/db-wagenreihung-to-json @@ -172,6 +172,9 @@ for my $line (@lines) { $map{$number}{route} .= $+{route}; } elsif ( $state eq "route" and $line eq "" ) { + $state = "conditions"; + } + elsif ( $state eq "conditions" and $line =~ m{ Hg | Tfz | BrH }x ) { $state = "details"; } @@ -180,11 +183,23 @@ for my $line (@lines) { =~ m{ ^ \d* \s{1,10} (?<type> D? (WL)? (A|AB|B|W) R? D? [aceimpvw] \S* ) \s* (?<number> \d+ )? (?: $ | \s{6} ) }x ) { + $state = "wagonorder"; push( @{ $wagon_map{$number} }, [ $+{type}, $+{number} ] ); #$map{$number}{has_wagon}{$1} = \1; $map{$number}{wagons}{$1} = \1; } + + if ( $state eq "conditions" and length($line) and $line =~ m{ \S }x ) { + push( @{ $map{$number}{conditions} }, $line ); + } + + if ( $state eq "details" + and length($line) + and $line =~ m{ Hg | Tfz | BrH }x ) + { + push( @{ $map{$number}{details} }, $line ); + } } for my $train_number ( keys %map ) { |