From: Dobrica Pavlinusic Date: Wed, 16 Dec 2009 19:39:55 +0000 (+0100) Subject: jump to current position in subtitle.srt.yaml X-Git-Url: http://git.rot13.org/?p=HTML5TV.git;a=commitdiff_plain;h=26c64edd3a795816dfc6ede7beeec7ff5f39320d;ds=sidebyside jump to current position in subtitle.srt.yaml --- diff --git a/bin/mplayer.pl b/bin/mplayer.pl index cfebbd8..7f476dd 100755 --- a/bin/mplayer.pl +++ b/bin/mplayer.pl @@ -557,7 +557,14 @@ sub load_subtitles { sub edit_subtitles { print $to_mplayer qq|pause\n|; focus_term; - system( qq|vi "$subtitles.yaml"| ) == 0 and load_subtitles; + my $line = 1; + open( my $fh, '<', "$subtitles.yaml" ) || die $1; + while(<$fh>) { + last if /^-\s([\d\.]+)/ && $1 > $pos; + $line++; + } + close($fh); + system( qq|vi +$line "$subtitles.yaml"| ) == 0 and load_subtitles; focus_mplayer; }