diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/DBInfoscreen.pm | 16 | ||||
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 1 | 
2 files changed, 17 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 ) = @_; diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 4af9ff4..60caf8d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1270,6 +1270,7 @@ sub handle_request {  		$self->render(  			$template,  			departures       => \@departures, +			ice_type         => $self->app->ice_type_map,  			version          => $dbf_version,  			title            => $via ? "$station_name → $via" : $station_name,  			refresh_interval => $template eq 'app' ? 0 : 120, | 
