diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-12-27 21:07:35 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-12-27 21:07:35 +0100 |
commit | be687b25c5d8816b710a44feb3e1ee0ce2a80e92 (patch) | |
tree | 0a94927af1dd112d068acce930193e4cf19c40b4 /index.pl | |
parent | 03814b1e7d9e59160ad38f20ba4b02ca29f8e607 (diff) |
fix hide_low_delay in most cases
Diffstat (limited to 'index.pl')
-rw-r--r-- | index.pl | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -425,11 +425,10 @@ sub handle_request { } elsif ( $result->delay and $result->delay > 0 ) { if ( $template eq 'clean' ) { - $info = $delaymsg; - $delay = $result->delay; + $info = $delaymsg; } else { - $info = sprintf( 'Verspätung ca. %d Min.%s%s', + $info = sprintf( 'ca. +%d%s%s', $result->delay, $delaymsg ? q{: } : q{}, $delaymsg ); } } @@ -514,14 +513,13 @@ sub handle_request { } } - if ( $template eq 'clean' - and $info - and $info =~ s{ (?: ca [.] \s* )? [+] (\d+) :? \s* }{}x ) - { - $delay = $1; - } - if ( $hide_low_delay and $info ) { - $info =~ s{ (?: ca [.] \s* )? [+] [ 1 2 3 4 ] $ }{}x; + if ($hide_low_delay) { + if ($info) { + $info =~ s{ (?: ca [.] \s* )? [+] [ 1 2 3 4 ] $ }{}x; + } + if ( $delay and $delay < 5 ) { + $delay = undef; + } } if ($info) { $info =~ s{ (?: ca [.] \s* )? [+] (\d+) }{Verspätung ca $1 Min.}x; @@ -762,6 +760,7 @@ sub handle_request { title => "departures for ${station}", refresh_interval => $refresh_interval + 3, hide_opts => $hide_opts, + hide_low_delay => $hide_low_delay, show_realtime => $show_realtime, ); } |