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: 69d1ea89cc844ba8b196ea4326984121ee105cd6
Parent: a25ab75455e076960476d497e679ca0c12d2d98a
Author: Ren Tatsumoto
Date:   Tue, 18 May 2021 23:38:59 +0300

bindings overhaul

Diffstat:
MREADME.md | 55++++++++++++++++++++++++++++++++++---------------------
Msubs2srs.lua | 22++++++++++++----------
2 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/README.md b/README.md @@ -216,47 +216,60 @@ See [Usage](#usage) for the explanation of what they do. Default bindings: ``` -Ctrl+c script-binding mpvacious-copy-sub-to-clipboard -Ctrl+e script-binding mpvacious-export-note -Ctrl+h script-binding mpvacious-sub-rewind -Ctrl+Shift+h script-binding mpvacious-sub-replay a script-binding mpvacious-menu-open + +Ctrl+e script-binding mpvacious-export-note + +Ctrl+m script-binding mpvacious-update-last-note +Ctrl+M script-binding mpvacious-overwrite-last-note + +Ctrl+c script-binding mpvacious-copy-sub-to-clipboard +Ctrl+t script-binding mpvacious-autocopy-toggle + H script-binding mpvacious-sub-seek-back L script-binding mpvacious-sub-seek-forward + Alt+h script-binding mpvacious-sub-seek-back-pause Alt+l script-binding mpvacious-sub-seek-forward-pause -``` - -These additional bindings aren't enabled by default but can be accessed via the menu by pressing `a`. -``` -Ctrl+s script-binding mpvacious-set-starting-line -Ctrl+r script-binding mpvacious-reset-timings -Ctrl+t script-binding mpvacious-toggle-sub-autocopy -Ctrl+u script-binding mpvacious-update-last-note +Ctrl+h script-binding mpvacious-sub-rewind +Ctrl+Shift+h script-binding mpvacious-sub-replay ``` ## Usage ### Global bindings -These bindings work everywhere, even if the menu (covered later) is closed. +Menu: +* `a` - Open `advanced menu`. + +Make a card: +* `Ctrl+e` - Export a card with the currently visible subtitle line on the front. +Use this when your subs are well timed, +and the target sentence doesn't span multiple subs. + +Update the last card: +* `Ctrl+m` - Append to the media fields of the newly added Anki card. +* `Ctrl+Shift+m` - Overwrite media fields of the newly added Anki card. + +Clipboard: +* `Ctrl+c` - Copy current subtitle string to the system clipboard. +* `Ctrl+t` - Toggle automatic copying of subtitles to the clipboard. + +Seeking: * `Shift+h` and `Shift+l` - Seek to the previous or the next subtitle. * `Alt+h` and `Alt+l` - Seek to the previous, or the next subtitle, and pause. * `Ctrl+h` - Seek to the start of the currently visible subtitle. Use it if you missed something. * `Ctrl+Shift+h` - Replay current subtitle line, and pause. -* `Ctrl+e` - Export a card with the currently visible subtitle line on the front. -Use this when your subs are perfectly timed, and the target sentence doesn't span multiple subs. -* `Ctrl+c` - Copy current subtitle string to the system clipboard. For automatic copying see -[Modifying cards added with Yomichan](#modifying-cards-added-with-yomichan). ### Menu options -* `a` - Open `advanced menu` with a list of all available keybindings. - -Let's say your subs are still perfectly timed, +Let's say your subs are well timed, but the sentence you want to add is split between multiple subs. We need to combine the lines before making a card. + +Advanced menu has the following options: + * `c` - Set timings to the current sub and remember the corresponding line. It does nothing if there are no subs on screen. @@ -296,7 +309,7 @@ Now as subtitles appear on the screen, they will be immediately copied to the cl You can use it in combination with [Yomichan](https://foosoft.net/projects/yomichan/) clipboard monitor. -#### The process: +**The process:** 1) Open `Yomichan Search` by pressing `Alt+Insert` in your web browser. 2) Enable `Clipboard autocopy` in mpvacious by pressing `t` in the `advanced menu`. diff --git a/subs2srs.lua b/subs2srs.lua @@ -1562,9 +1562,16 @@ local main = (function() end -- Key bindings - mp.add_forced_key_binding("ctrl+e", "mpvacious-export-note", export_to_anki) - mp.add_forced_key_binding("ctrl+c", "mpvacious-copy-sub-to-clipboard", copy_sub_to_clipboard) - mp.add_key_binding("a", "mpvacious-menu-open", menu.open) -- a for advanced + mp.add_forced_key_binding("Ctrl+e", "mpvacious-export-note", export_to_anki) + mp.add_forced_key_binding("Ctrl+c", "mpvacious-copy-sub-to-clipboard", copy_sub_to_clipboard) + mp.add_key_binding("Ctrl+t", "mpvacious-autocopy-toggle", clip_autocopy.toggle) + + -- Open advanced menu + mp.add_key_binding("a", "mpvacious-menu-open", menu.open) + + -- Note updating + mp.add_key_binding("Ctrl+m", "mpvacious-update-last-note", _ { update_last_note, false }) + mp.add_key_binding("Ctrl+M", "mpvacious-overwrite-last-note", _ { update_last_note, true }) -- Vim-like seeking between subtitle lines mp.add_key_binding("H", "mpvacious-sub-seek-back", _ { sub_seek, 'backward' }) @@ -1573,14 +1580,9 @@ local main = (function() mp.add_key_binding("Alt+h", "mpvacious-sub-seek-back-pause", _ { sub_seek, 'backward', true }) mp.add_key_binding("Alt+l", "mpvacious-sub-seek-forward-pause", _ { sub_seek, 'forward', true }) - mp.add_key_binding("ctrl+h", "mpvacious-sub-rewind", _ { sub_rewind }) - mp.add_key_binding("ctrl+H", "mpvacious-sub-replay", _ { sub_replay }) + mp.add_key_binding("Ctrl+h", "mpvacious-sub-rewind", _ { sub_rewind }) + mp.add_key_binding("Ctrl+H", "mpvacious-sub-replay", _ { sub_replay }) - -- Unset by default - mp.add_key_binding(nil, "mpvacious-set-starting-line", subs.set_starting_line) - mp.add_key_binding(nil, "mpvacious-reset-timings", subs.clear_and_notify) - mp.add_key_binding("ctrl+m", "mpvacious-update-last-note", _ {update_last_note, false}) - mp.add_key_binding("ctrl+M", "mpvacious-overwrite-last-note", _ {update_last_note, true}) end end)()