diff options
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-x | lib/Travelynx.pm | 17 |
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} // [] } ) { |