summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-01-06 20:58:20 +0100
committerDaniel Friesel <derf@finalrewind.org>2020-01-06 20:58:20 +0100
commit9c7d87e0a67dadec3c13435c743b4498a5be1b91 (patch)
tree2bd81e117a2b8bc78a5564d1ba9d933cfc284d06 /lib/DBInfoscreen.pm
parentf5d1b92ac24883a72864ea65255a14c870f63794 (diff)
show planned IC/ICE subtype if available (experimental!)
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r--lib/DBInfoscreen.pm16
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 ) = @_;