diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-01-13 20:32:29 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-01-13 20:32:29 +0100 |
commit | 1af26b2fdcfb9233503a1c0e630b41ced5864069 (patch) | |
tree | 141e3a4b1ab20b45327a71cf60f3cc0e18d7af5d /lib/DBInfoscreen.pm | |
parent | 4ae2f6dacd2190a48f5d41b6f53028ba11044c8c (diff) |
remove bundled zugbildungsplan, use daily updates from dbdb instead3.10.1
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r-- | lib/DBInfoscreen.pm | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 3a429e7..acb741b 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -101,25 +101,31 @@ sub startup { $self->attr( ice_type_map => sub { - my $ice_type_map = JSON->new->utf8->decode( - scalar read_file('share/zugbildungsplan.json') ); - my $ret; - while ( my ( $k, $v ) = each %{ $ice_type_map->{train} } ) { - if ( $v->{type} ) { - $ret->{$k} = [ - $v->{type}, $v->{shortType}, - exists $v->{wagons} ? 1 : 0 - ]; + if ( -r 'share/zugbildungsplan.json' ) { + my $ice_type_map = JSON->new->utf8->decode( + scalar read_file('share/zugbildungsplan.json') ); + my $ret; + while ( my ( $k, $v ) = each %{ $ice_type_map->{train} } ) { + if ( $v->{type} ) { + $ret->{$k} = [ + $v->{type}, $v->{shortType}, + exists $v->{wagons} ? 1 : 0 + ]; + } } + return $ret; } - return $ret; + return {}; } ); $self->attr( train_details_db => sub { - return JSON->new->utf8->decode( - scalar read_file('share/zugbildungsplan.json') )->{train}; + if ( -r 'share/zugbildungsplan.json' ) { + return JSON->new->utf8->decode( + scalar read_file('share/zugbildungsplan.json') )->{train}; + } + return {}; } ); |