mpv2oboeru

mpv helpers to create flashcards from movies and TV shows
git clone anongit@rnpnr.xyz:mpv2oboeru.git
Log | Files | Refs | Feed | README | LICENSE

Commit: 0080d7efd7a76e2c36bd0f9c7a08741e7bc0a9aa
Parent: 40658f503d884430cd517f402136b6904fc92764
Author: Ren Tatsumoto
Date:   Mon, 17 Aug 2020 03:54:02 +0300

rewind by pressing ctrl+h

Diffstat:
MREADME.md | 2++
Msubs2srs.lua | 10++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -100,6 +100,7 @@ Ctrl+e script-binding anki-export-note Ctrl+s script-binding set-starting-point Ctrl+r script-binding reset-starting-point Ctrl+t script-binding toggle-sub-autocopy +Ctrl+h script-binding sub-rewind ``` ## Usage * `Ctrl+t` - **T**oggles the `autoclip` option. @@ -113,6 +114,7 @@ After pressing `Ctrl+s`, wait for the next line(s) to appear and then press `Ctrl+e` to set the **e**nding line and create the card. * `Ctrl+r` - If you pressed `Ctrl+s` but changed your mind, it **r**esets the starting line. +* Ctrl+h - Seeks to the starting point of the currently visible subtitle. After the card is created, you can find it by typing ```tag:subs2srs added:1``` in the Anki Browser. Then use [qolibri](https://aur.archlinux.org/packages/qolibri/) diff --git a/subs2srs.lua b/subs2srs.lua @@ -191,6 +191,15 @@ function get_audio_track_number() return audio_track_number end +function sub_rewind() + pcall( + function () + local sub_start_time = subs.get_current()['start'] + mp.commandv('seek', sub_start_time, 'absolute') + end + ) +end + ffmpeg.execute = function(args) if next(args) ~= nil then for i, value in ipairs(ffmpeg.prefix) do @@ -432,3 +441,4 @@ mp.add_key_binding("ctrl+e", "anki-export-note", export_to_anki) mp.add_key_binding("ctrl+s", "set-starting-point", subs.set_starting_point) mp.add_key_binding("ctrl+r", "reset-starting-point", subs.reset_starting_point) mp.add_key_binding("ctrl+t", "toggle-sub-autocopy", clip_autocopy.toggle) +mp.add_key_binding("ctrl+h", "sub-rewind", sub_rewind)