diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/DBInfoscreen.pm | 10 | ||||
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 4 | ||||
| -rw-r--r-- | lib/DBInfoscreen/Controller/Wagenreihung.pm | 14 | 
3 files changed, 20 insertions, 8 deletions
| diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 8bd7022..aea71a9 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -39,7 +39,8 @@ sub startup {  			spare   => $ENV{DBFAKEDISPLAY_SPARE}   // 2,  			workers => $ENV{DBFAKEDISPLAY_WORKERS} // 2,  		}, -		version => $ENV{DBFAKEDISPLAY_VERSION} // qx{git describe --dirty} // '???', +		version => $ENV{DBFAKEDISPLAY_VERSION} // qx{git describe --dirty} +		  // '???',  	);  	chomp $self->config->{version}; @@ -103,10 +104,11 @@ sub startup {  			my $ice_type_map = JSON->new->utf8->decode(  				scalar read_file('share/zugbildungsplan.json') );  			my $ret; -			while ( my ( $k, $v ) = each %{$ice_type_map} ) { +			while ( my ( $k, $v ) = each %{ $ice_type_map->{train} } ) {  				if ( $v->{type} ) {  					$ret->{$k} -					  = [ $v->{type}, $v->{short}, exists $v->{wagon} ? 1 : 0 ]; +					  = [ $v->{type}, $v->{short}, +						exists $v->{wagons} ? 1 : 0 ];  				}  			}  			return $ret; @@ -116,7 +118,7 @@ sub startup {  	$self->attr(  		train_details_db => sub {  			return JSON->new->utf8->decode( -				scalar read_file('share/zugbildungsplan.json') ); +				scalar read_file('share/zugbildungsplan.json') )->{train};  		}  	); diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 752b099..b168b6b 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -673,7 +673,9 @@ sub render_train {  				departure => $departure,  				linetype  => $linetype,  				icetype => $self->app->ice_type_map->{ $departure->{train_no} }, -				dt_now  => DateTime->now( time_zone => 'Europe/Berlin' ), +				details => +				  $self->app->train_details_db->{ $departure->{train_no} }, +				dt_now       => DateTime->now( time_zone => 'Europe/Berlin' ),  				station_name => $station_name,  				nav_link     => '/' . $station_name,  			); diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm index 63366a2..36f486b 100644 --- a/lib/DBInfoscreen/Controller/Wagenreihung.pm +++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm @@ -6,6 +6,8 @@ package DBInfoscreen::Controller::Wagenreihung;  use Mojo::Base 'Mojolicious::Controller'; +use utf8; +  use Travel::Status::DE::DBWagenreihung;  use Travel::Status::DE::DBWagenreihung::Wagon; @@ -24,11 +26,12 @@ sub zugbildung_db {  	my @wagons; -	for my $wagon_number ( sort { $a <=> $b } keys %{ $details->{wagon} } ) { +	for my $wagon ( @{ $details->{wagons} } ) { +		my ( $wagon_type, $wagon_number ) = @{$wagon};  		my %wagon = (  			fahrzeugnummer      => "", -			fahrzeugtyp         => $details->{wagon}{$wagon_number}, -			kategorie           => "", +			fahrzeugtyp         => $wagon_type, +			kategorie           => $wagon_type =~ m{^[0-9.]+$} ? 'LOK' : '',  			train_no            => $train_no,  			wagenordnungsnummer => $wagon_number,  			positionamhalt      => { @@ -56,10 +59,15 @@ sub zugbildung_db {  	my $train_type = $details->{raw};  	$train_type =~ s{ - .* }{}x; +	my $route_start = $details->{route}{start} // $details->{route}{preStart}; +	my $route_end   = $details->{route}{end}   // $details->{route}{postEnd}; +	my $route       = "${route_start} → ${route_end}"; +  	$self->render(  		'zugbildung_db',  		wr_error  => undef,  		title     => $train_type . ' ' . $train_no, +		route     => $route,  		zb        => $details,  		train_no  => $train_no,  		wagons    => [@wagons], | 
