From f4e2c4cf23b2c8063d45340673eef66461a16bf9 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 12 Aug 2024 18:58:08 +0200 Subject: update mot names --- lib/DBInfoscreen/Controller/Stationboard.pm | 33 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 93c9546..8fc36c1 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1316,19 +1316,19 @@ sub train_details { my $prod = $self->class_to_product($hafas_obj)->{ $product->class } // q{}; - if ( $prod eq 'ice' or $prod eq 'ic_ec' ) { + if ( $prod =~ m{ ^ ice? | inter-?cit }ix ) { $linetype = 'fern'; } - elsif ( $prod eq 's' ) { + elsif ( $prod =~ m{ s-bahn | urban | rapid }ix ) { $linetype = 'sbahn'; } - elsif ( $prod eq 'bus' ) { + elsif ( $prod =~ m{ bus }ix ) { $linetype = 'bus'; } - elsif ( $prod eq 'u' ) { + elsif ( $prod =~ m{ metro | u-bahn | subway }ix ) { $linetype = 'ubahn'; } - elsif ( $prod eq 'tram' ) { + elsif ( $prod =~ m{ tram }ix ) { $linetype = 'tram'; } } @@ -1501,17 +1501,20 @@ sub handle_efa { } my $linetype = $result->mot_name // 'bahn'; - if ( $linetype eq 's-bahn' ) { + if ( $linetype =~ m{ s-bahn | urban | rapid }ix ) { $linetype = 'sbahn'; } - elsif ( $linetype eq 'u-bahn' ) { + elsif ( $linetype =~ m{ metro | u-bahn | subway }ix ) { $linetype = 'ubahn'; } - elsif ( $linetype =~ m{bus} ) { + elsif ( $linetype =~ m{ bus }ix ) { $linetype = 'bus'; } - elsif ( $linetype eq 'zug' ) { - $linetype = 'bahn'; + elsif ( $linetype =~ m{ tram }ix ) { + $linetype = 'tram'; + } + elsif ( $linetype =~ m{ ^ ice? | inter-?cit }ix ) { + $linetype = 'fern'; } elsif ( $linetype eq 'sonstige' ) { $linetype = 'ext'; @@ -1673,19 +1676,19 @@ sub handle_result { } elsif ( $result->can('class') ) { my $prod = $class_to_product->{ $result->class } // q{}; - if ( $prod eq 'ice' or $prod eq 'ic_ec' ) { + if ( $prod =~ m{ ^ ice? | inter-?cit }ix ) { $linetype = 'fern'; } - elsif ( $prod eq 's' ) { + elsif ( $prod =~ m{ s-bahn | urban | rapid }ix ) { $linetype = 'sbahn'; } - elsif ( $prod eq 'bus' ) { + elsif ( $prod =~ m{ bus }ix ) { $linetype = 'bus'; } - elsif ( $prod eq 'u' ) { + elsif ( $prod =~ m{ metro | u-bahn | subway }ix ) { $linetype = 'ubahn'; } - elsif ( $prod eq 'tram' ) { + elsif ( $prod =~ m{ tram }ix ) { $linetype = 'tram'; } } -- cgit v1.2.3