summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.pl29
-rw-r--r--public/infoscreen.css2
-rw-r--r--templates/infoscreen.html.ep16
3 files changed, 29 insertions, 18 deletions
diff --git a/index.pl b/index.pl
index c550905..73919e7 100644
--- a/index.pl
+++ b/index.pl
@@ -5,6 +5,7 @@ use utf8;
use DateTime;
use DateTime::Format::Strptime;
+use Encode qw(decode);
use List::MoreUtils qw(any);
use App::VRR::Fakedisplay;
@@ -75,8 +76,11 @@ sub get_results {
}
$data = {
results => [ $status->results ],
- errstr => $status->errstr
+ errstr => $status->errstr,
};
+ if ( $status->can('identified_data') ) {
+ ( $data->{id_name}, $data->{id_stop} ) = $status->identified_data;
+ }
$cache->freeze( $sstr, $data );
}
@@ -173,7 +177,6 @@ sub get_filtered_departures {
$opt{cache_expiry} );
my $results = $data->{results};
- my $errstr = $data->{errstr};
if ( $opt{filter_line} ) {
my @lines = split( qr{,}, $opt{filter_line} );
@@ -203,7 +206,9 @@ sub get_filtered_departures {
push( @filtered_results, $d );
}
- return ( \@filtered_results, $errstr );
+ $data->{filtered_results} = \@filtered_results;
+
+ return $data;
}
sub make_infoboard_lines {
@@ -310,7 +315,7 @@ sub render_html {
my $color = $self->param('color') || '255,208,0';
my $template = $self->param('template') || 'display';
- my ( $raw_departures, $errstr ) = get_filtered_departures(
+ my $data = get_filtered_departures(
city => $self->stash('city') // q{},
stop => $self->stash('stop'),
backend => scalar $self->param('backend'),
@@ -326,7 +331,7 @@ sub render_html {
no_lines => scalar $self->param('no_lines'),
offset => scalar $self->param('offset'),
want_crop => scalar $self->param('want_crop'),
- data => $raw_departures
+ data => $data->{filtered_results},
);
for my $d (@departures) {
@@ -340,7 +345,9 @@ sub render_html {
title => "vrr-fakedisplay v${VERSION}",
color => [ split( qr{,}, $color ) ],
departures => \@departures,
- raw => $raw_departures,
+ id_name => decode( 'UTF-8', $data->{id_name} ),
+ id_stop => decode( 'UTF-8', $data->{id_stop} ),
+ raw => $data->{filtered_results},
scale => $self->param('scale') || '4.3',
version => $VERSION,
);
@@ -351,7 +358,7 @@ sub render_html {
sub render_json {
my $self = shift;
- my ( $raw_departures, $errstr ) = get_filtered_departures(
+ my $data = get_filtered_departures(
city => $self->stash('city') // q{},
stop => $self->stash('stop'),
backend => scalar $self->param('backend'),
@@ -360,7 +367,9 @@ sub render_json {
filter_platform => scalar $self->param('platform'),
hide_regional => 0,
);
- my @departures = make_infoboard_lines(
+ my $raw_departures = $data->{filtered_results};
+ my $errstr = $data->{errstr};
+ my @departures = make_infoboard_lines(
no_lines => scalar $self->param('no_lines'),
offset => scalar $self->param('offset'),
want_crop => scalar $self->param('want_crop'),
@@ -392,7 +401,7 @@ sub render_image {
my $color = $self->param('color') || '255,208,0';
my $scale = $self->param('scale');
- my ( $raw_departures, $errstr ) = get_filtered_departures(
+ my $data = get_filtered_departures(
city => $self->stash('city') // q{},
stop => $self->stash('stop'),
backend => scalar $self->param('backend'),
@@ -400,6 +409,8 @@ sub render_image {
filter_platform => scalar $self->param('platform'),
hide_regional => 0,
);
+ my $raw_departures = $data->{filtered_results};
+ my $errstr = $data->{errstr};
my @departures = make_infoboard_lines(
city => $self->stash('city') // q{},
diff --git a/public/infoscreen.css b/public/infoscreen.css
index 38d78cd..3c2752a 100644
--- a/public/infoscreen.css
+++ b/public/infoscreen.css
@@ -120,7 +120,7 @@ div.displayclean li .countdown .delay {
padding-right:7px;
}
-div.displayclean li .time {
+div.displayclean li > .time {
color:#444444;
font-size: 2.4em;
position:absolute;
diff --git a/templates/infoscreen.html.ep b/templates/infoscreen.html.ep
index e87cc5e..5495cc3 100644
--- a/templates/infoscreen.html.ep
+++ b/templates/infoscreen.html.ep
@@ -58,18 +58,18 @@
</div> <!-- mheader -->
% if ($departure->can('route_pre')) {
Fahrplan:
- <ul>
+ <table class="scheduled">
% for my $stop ($departure->route_pre) {
- <li><%= $stop->{dep_time} %> <%= $stop->{stop} %></li>
+ <tr><td class="time"><%= $stop->{dep_time} %></td>
+ <td class="stop"><%= $stop->{stop} %></td></tr>
% }
- </ul>
-% }
-% if ($departure->can('route_post')) {
- <ul>
+ <tr><td class="time"></td>
+ <td class="stop"><%= $id_name %> <%= $id_stop %></td></tr>
% for my $stop ($departure->route_post) {
- <li><%= $stop->{arr_time} %> <%= $stop->{stop} %></li>
+ <tr><td class="time"><%= $stop->{arr_time} %></td>
+ <td class="stop"><%= $stop->{stop} %></td></tr>
% }
- </ul>
+ </table>
% }
</span> <!-- moreinfo -->
<span class="route">