diff options
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r-- | lib/DBInfoscreen.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index c1455ff..d8f5b87 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -5,6 +5,8 @@ use Mojo::Base 'Mojolicious'; # License: 2-Clause BSD use Cache::File; +use File::Slurp qw(read_file); +use JSON; use Travel::Status::DE::HAFAS; use Travel::Status::DE::HAFAS::StopFinder; use Travel::Status::DE::IRIS::Stations; @@ -60,6 +62,20 @@ sub startup { } ); + $self->attr( + ice_type_map => sub { + my $ice_type_map = JSON->new->utf8->decode( + scalar read_file('share/ice_type.json') ); + my $ret; + while ( my ( $k, $v ) = each %{$ice_type_map} ) { + if ( $v->{short} ) { + $ret->{$k} = $v->{short}; + } + } + return $ret; + } + ); + $self->helper( 'handle_no_results' => sub { my ( $self, $backend, $station, $errstr ) = @_; |