diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 16:08:37 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 16:08:37 +0100 |
commit | bb0ff3a9c76afdaafe8269ccf8377b5f68579f6f (patch) | |
tree | 105318055bb1113ad8b7e4dad1bada767de7bbdc | |
parent | e1a01ac41386ae6696e62c0fcec9830347763ed4 (diff) |
handle TGV trains
-rwxr-xr-x | bin/db-wagenreihung-to-json | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/db-wagenreihung-to-json b/bin/db-wagenreihung-to-json index 3427066..18d509e 100755 --- a/bin/db-wagenreihung-to-json +++ b/bin/db-wagenreihung-to-json @@ -219,7 +219,8 @@ for my $line (@lines) { } if ( $line - =~ m{ ^ (?<type> [EINR][CJN][ A-Z-]{6}) (?<number> [ 0-9]{2,12}) }x ) + =~ m{ ^ (?<type> [EINR][CJN][ A-Z-]{6} | TGV \s*+ ) (?<number> [ 0-9]{2,12}) }x + ) { $type = $+{type}; $type =~ tr{ }{}d; @@ -368,7 +369,7 @@ for my $line (@lines) { if ( $number and $line - =~ m{ ^ \d* \s{1,10} (?<type> ( D? (WL)? (A|AB|B|W) R? D? [acdehimpvw] \S* ) | 40[1-9]([.][0-9])? | 146([.][0-9])? ) \s* (?<number> \d+ )? (?: $ | \s{3} (?<rest> .* ) $ ) }x + =~ m{ ^ \d* \s{1,10} (?<type> ( D? (WL)? (A|AB|B|W) R? D? [acdehimpuvw] \S* ) | 40[1-9]([.][0-9])? | 146([.][0-9])? ) \s* (?<number> \d+ )? (?: $ | \s{3} (?<rest> .* ) $ ) }x ) { $state = "wagonorder"; @@ -510,6 +511,8 @@ for my $train_number ( keys %map ) { for my $wagon ( @{ $wagon_map{$train_number} // [] } ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { + + #push( @{ $type_by_wagon_number{$wagon_number} }, $wagon_type ); next; } if ( not $wagon_number ) { @@ -550,6 +553,7 @@ for my $train_number ( keys %map ) { # broken umlauf (indentation changes on page break) delete $map{77689}{cycle}; +delete $map{78112}{cycle}; # use canonical output (i.e., sort hash keys) to allow for easy diffing. say JSON->new->utf8->canonical->encode( |