summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrtplay12
-rw-r--r--srtplay.1.scd2
2 files changed, 8 insertions, 6 deletions
diff --git a/srtplay b/srtplay
index 0291e53..c2cd87d 100755
--- a/srtplay
+++ b/srtplay
@@ -3,7 +3,7 @@
use 5.038;
use utf8;
use autodie;
-use Time::HiRes qw(time sleep);
+use Time::HiRes qw(time);
use IO::Poll;
use Term::ReadKey;
use XML::Parser;
@@ -130,18 +130,20 @@ while (1) {
$timeout -= $elapsed;
my $next_second = 1 - $elapsed % 1;
$timeout = $next_second if $timeout > $next_second;
- $timeout = $length if $paused;
- next unless $poll->poll($timeout) > 0;
+ if ($paused) {
+ $poll->poll();
+ } else {
+ $poll->poll($timeout);
+ }
next unless defined(my $key = ReadKey(-1));
if ($key eq 'q') {
last;
} elsif ($key eq 'j') {
$start += 10;
- $start = $now if $now - $start < 0;
+ $start = $now if $start > $now;
} elsif ($key eq 'l') {
$start -= 10;
- $start = $now if $now - $start < 0;
} elsif ($key eq 'k' || $key eq ' ') {
if ($paused) {
my $time = time;
diff --git a/srtplay.1.scd b/srtplay.1.scd
index ce7f529..fe5ee9c 100644
--- a/srtplay.1.scd
+++ b/srtplay.1.scd
@@ -2,7 +2,7 @@ srtplay(1)
# NAME
-srtplay - play .srt subtitle files in a TUI
+srtplay - play .srt subtitle files in a terminal
# SYNOPSIS