diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-02-06 21:26:34 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-02-06 21:26:34 +0100 |
commit | fbd2756660a31e7cf900e57f63fd4a376ad3e81e (patch) | |
tree | 42f3d6f283754194b71967f41163c7ecdc7f1d0b /lib/DBInfoscreen/Controller | |
parent | c0a7d8a062518292c798fe6d5f0e6b0d21fee7d0 (diff) |
hafas: strip common city suffix4.15.7
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index e708305..56bf2c7 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1588,6 +1588,10 @@ sub handle_result { ); } else { + my $city = q{}; + if ( $result->station =~ m{ , ([^,]+) $ }x ) { + $city = $1; + } push( @departures, { @@ -1603,11 +1607,13 @@ sub handle_result { train_line => $result->line, train_no => $result->number, journey_id => $result->id, - via => - [ map { $_->{name} } $result->route_interesting(3) ], - destination => $result->destination, - origin => $result->origin, - platform => $result->platform, + via => [ + map { $_->{name} =~ s{,$city}{}r } + $result->route_interesting(3) + ], + destination => $result->destination =~ s{,$city}{}r, + origin => $result->origin, + platform => $result->platform, scheduled_platform => $result->sched_platform, info => $info, is_cancelled => $result->is_cancelled, |