summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-01-25 15:46:42 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-01-25 15:46:42 +0100
commit3e9807b393d8e1acc6b6f839aacc720c8908322b (patch)
treefe28e90aa7a65050772c7b187bd85dc801716666 /lib/Travelynx.pm
parent1028e47a35a472fc4835f324f3ad195970b45b17 (diff)
map, journey view: handle renamed stations1.13.8
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 97c9384..96b45be 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -197,8 +197,7 @@ sub startup {
$self->attr(
coordinates_by_station => sub {
- my $legacy_names = JSON->new->utf8->decode(
- scalar read_file('share/old_station_names.json') );
+ my $legacy_names = $self->app->renamed_station;
my %location;
for
my $station ( Travel::Status::DE::IRIS::Stations::get_stations() )
@@ -226,6 +225,14 @@ sub startup {
);
$self->attr(
+ renamed_station => sub {
+ my $legacy_to_new = JSON->new->utf8->decode(
+ scalar read_file('share/old_station_names.json') );
+ return $legacy_to_new;
+ }
+ );
+
+ $self->attr(
station_by_eva => sub {
my %map;
for
@@ -2710,6 +2717,12 @@ sub startup {
}
if ( $opt{verbose} ) {
+ my $rename = $self->app->renamed_station;
+ for my $stop ( @{ $ref->{route} } ) {
+ if ( $rename->{ $stop->[0] } ) {
+ $stop->[0] = $rename->{ $stop->[0] };
+ }
+ }
$ref->{cancelled} = $entry->{cancelled};
my @parsed_messages;
for my $message ( @{ $ref->{messages} // [] } ) {