diff options
author | Cassidy Dingenskirchen <admin@15318.de> | 2025-05-02 18:47:12 +0200 |
---|---|---|
committer | Birte Friesel <derf@chaosdorf.de> | 2025-05-06 18:10:05 +0200 |
commit | 6377b7bff399b2114c54d36d44206a54766485d6 (patch) | |
tree | 016f956ecc81a0fede5d0308b397543de77aff10 /lib/Travel | |
parent | 014cc6bd5551987a94e34dc4a04a0e86cb8e9669 (diff) |
Journey: remove train number from train type if detected
Diffstat (limited to 'lib/Travel')
-rw-r--r-- | lib/Travel/Status/DE/DBRIS/Journey.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm index ad3fad4..22cf7ff 100644 --- a/lib/Travel/Status/DE/DBRIS/Journey.pm +++ b/lib/Travel/Status/DE/DBRIS/Journey.pm @@ -42,6 +42,14 @@ sub new { ( $ref->{type}, $ref->{number} ) = split( qr{\s+}, $ref->{train} ); } + # For some trains, the train type also contains the train number like "MEX19161" + # If we can detect this, remove the number from the train type + if ( $ref->{train_no} and $ref->{type} + and $ref->{type} =~ qr{ (?<actualtype> [^\d]+ ) $ref->{train_no} $ }x ) + { + $ref->{type} = $+{actualtype}; + } + # The line number seems to be encoded in the trip ID if ( not defined $ref->{number} and $opt{id} =~ m{ [#] ZE [#] (?<line> [^#]+ ) [#] ZB [#] }x ) |