diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 13:56:39 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 13:56:39 +0100 |
commit | 454d09591294dfdaa75a5364780abe525bbe77b3 (patch) | |
tree | 7ce0a6735678c49952786d22b83f3ddeda26541d /bin | |
parent | 1ec021dd436c004405387d55771a7de4ff867be1 (diff) |
fix bogus data when an IC2 is carried by an 146.5 locomotive
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/db-wagenreihung-to-json | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/db-wagenreihung-to-json b/bin/db-wagenreihung-to-json index 55f980c..3427066 100755 --- a/bin/db-wagenreihung-to-json +++ b/bin/db-wagenreihung-to-json @@ -368,7 +368,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])? ) \s* (?<number> \d+ )? (?: $ | \s{3} (?<rest> .* ) $ ) }x + =~ 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 ) { $state = "wagonorder"; @@ -509,7 +509,7 @@ for my $train_number ( keys %map ) { my %type_by_wagon_number; for my $wagon ( @{ $wagon_map{$train_number} // [] } ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; - if ( $wagon_type =~ m{40[1-9]} ) { + if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { next; } if ( not $wagon_number ) { @@ -523,7 +523,7 @@ for my $train_number ( keys %map ) { if ($wagon_numbers_ok) { for my $wagon ( @{ $wagon_map{$train_number} // [] } ) { my ( $wagon_type, $wagon_number ) = @{$wagon}; - if ( $wagon_type =~ m{40[1-9]} ) { + if ( $wagon_type =~ m{ 40[1-9] | 146 }x ) { next; } @@ -548,6 +548,9 @@ for my $train_number ( keys %map ) { } } +# broken umlauf (indentation changes on page break) +delete $map{77689}{cycle}; + # use canonical output (i.e., sort hash keys) to allow for easy diffing. say JSON->new->utf8->canonical->encode( { |