diff options
author | Daniel Friesel <derf@finalrewind.org> | 2013-02-26 21:27:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2013-02-26 21:27:35 +0100 |
commit | 046b1b0f77dccc884033a18a1907d4ca20413c48 (patch) | |
tree | 1b9910d0f339675034cd9fe872d9f1a477c85629 /cgi/index.pl | |
parent | d06126063590da2487b2e1664d56136b9e545208 (diff) |
add option to hide delays < 5 minutes
Diffstat (limited to 'cgi/index.pl')
-rw-r--r-- | cgi/index.pl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cgi/index.pl b/cgi/index.pl index a525cf6..40ab878 100644 --- a/cgi/index.pl +++ b/cgi/index.pl @@ -6,7 +6,7 @@ use Travel::Status::DE::DeutscheBahn; use 5.014; use utf8; -our $VERSION = '0.03'; +our $VERSION = '0.04'; my $refresh_interval = 900; @@ -37,6 +37,7 @@ sub handle_request { my @platforms = split( /,/, $self->param('platforms') // q{} ); my $template = $self->param('mode') // 'multi'; + my $hide_low_delay = $self->param('hidelowdelay') // 0; $self->stash( departures => [] ); $self->stash( title => 'db-fakedisplay' ); @@ -89,10 +90,12 @@ sub handle_request { if ( $info eq '+0' ) { $info = undef; } + if ($hide_low_delay and $info) { + $info =~ s{ ^ (?: ca\. \s* )? \+ [ 1 2 3 4 ] $ }{}x; + } if ($info) { $info =~ s{ ^ (?: ca\. \s* )? \+ (\d+) }{Verspätung ca. $1 Min}x; - $info =~ s{ 1 \s Minute\Kn }{}x; } push( @departures, |