Loading lib/DBInfoscreen/Controller/Stationboard.pm +35 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,29 @@ sub log_api_access { return; } sub check_wagonorder { my ( $ua, $cache, $train, $wr_link ) = @_; my $url = "https://lib.finalrewind.org/dbdb/has_wagonorder/${train}/${wr_link}"; if ( my $content = $cache->get($url) ) { return $content eq 'y' ? 1 : undef; } $ua->request_timeout(2); my $res = $ua->head($url)->result; if ( $res->is_error ) { $cache->set( $url, 'n' ); return; } else { $cache->set( $url, 'y' ); return 1; } } sub hafas_json_req { my ( $ua, $cache, $url ) = @_; Loading Loading @@ -946,6 +969,18 @@ sub handle_request { [ $result->sched_route_post ] ) ]; if ( $departures[-1]{wr_link} and not check_wagonorder( $self->ua, $self->app->cache_iris_main, $result->train_no, $departures[-1]{wr_link} ) ) { $departures[-1]{wr_link} = undef; } my ( $route_ts, $route_info ) = get_route_timestamps( $self->ua, $self->app->cache_iris_main, Loading templates/_train_details.html.ep +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ % } % } </div> <!-- timeinfo --> % if (($linetype eq 'fern' or $linetype eq 'ext') and $departure->{wr_link}) { % if ($departure->{wr_link}) { <div class="verbose"> <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>">Wagenreihung</a> </div> Loading templates/wagenreihung.html.ep +3 −11 Original line number Diff line number Diff line Loading @@ -14,19 +14,11 @@ %= join( ' / ', map { $_->{name} } $wr->destinations ) </div> <%= $wr->station_name %> Gleis <%= $wr->platform %><br/> % if ($wr->train_type =~ m{^IC|EC}) { Zugtyp: <%= $wr->train_subtype // 'IC?' %> % } </div> </div> % if ($wr->train_type ne 'ICE') { <div class="container"> <div class="warning"> <strong>⚠ Keine zuverlässigen Daten vorhanden.</strong> IC/EC-Wagenreihungen werden vom Backend noch nicht offiziell unterstützt. Sowohl die hier angegebenen Daten als auch die am Bahnsteig angezeigte Wagenreihung können fehlerhaft sein. </div> </div> % } <div class="container"> <div style="position: relative; width: 100%; height: 70ex;"> % if (not $wr->has_bad_wagons) { Loading Loading
lib/DBInfoscreen/Controller/Stationboard.pm +35 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,29 @@ sub log_api_access { return; } sub check_wagonorder { my ( $ua, $cache, $train, $wr_link ) = @_; my $url = "https://lib.finalrewind.org/dbdb/has_wagonorder/${train}/${wr_link}"; if ( my $content = $cache->get($url) ) { return $content eq 'y' ? 1 : undef; } $ua->request_timeout(2); my $res = $ua->head($url)->result; if ( $res->is_error ) { $cache->set( $url, 'n' ); return; } else { $cache->set( $url, 'y' ); return 1; } } sub hafas_json_req { my ( $ua, $cache, $url ) = @_; Loading Loading @@ -946,6 +969,18 @@ sub handle_request { [ $result->sched_route_post ] ) ]; if ( $departures[-1]{wr_link} and not check_wagonorder( $self->ua, $self->app->cache_iris_main, $result->train_no, $departures[-1]{wr_link} ) ) { $departures[-1]{wr_link} = undef; } my ( $route_ts, $route_info ) = get_route_timestamps( $self->ua, $self->app->cache_iris_main, Loading
templates/_train_details.html.ep +1 −1 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ % } % } </div> <!-- timeinfo --> % if (($linetype eq 'fern' or $linetype eq 'ext') and $departure->{wr_link}) { % if ($departure->{wr_link}) { <div class="verbose"> <a href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>">Wagenreihung</a> </div> Loading
templates/wagenreihung.html.ep +3 −11 Original line number Diff line number Diff line Loading @@ -14,19 +14,11 @@ %= join( ' / ', map { $_->{name} } $wr->destinations ) </div> <%= $wr->station_name %> Gleis <%= $wr->platform %><br/> % if ($wr->train_type =~ m{^IC|EC}) { Zugtyp: <%= $wr->train_subtype // 'IC?' %> % } </div> </div> % if ($wr->train_type ne 'ICE') { <div class="container"> <div class="warning"> <strong>⚠ Keine zuverlässigen Daten vorhanden.</strong> IC/EC-Wagenreihungen werden vom Backend noch nicht offiziell unterstützt. Sowohl die hier angegebenen Daten als auch die am Bahnsteig angezeigte Wagenreihung können fehlerhaft sein. </div> </div> % } <div class="container"> <div style="position: relative; width: 100%; height: 70ex;"> % if (not $wr->has_bad_wagons) { Loading