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: 458ee71542f8ace799f6265e948233a3ff85faa5
Parent: dd662d6f8ffe90c3d496e8b6b5485074479fadbb
Author: Ren Tatsumoto
Date:   Wed, 26 Aug 2020 09:23:08 +0300

divide code in sections to aid readability

Diffstat:
Msubs2srs.lua | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -41,6 +41,8 @@ local clip_autocopy local ffmpeg local ankiconnect +------------------------------------------------------------ +-- utility functions local function check_config_sanity() if config.collection_path[-1] ~= '/' then @@ -203,6 +205,9 @@ local function sub_rewind() ) end +------------------------------------------------------------ +-- ffmpeg helper + ffmpeg = {prefix = {"ffmpeg", "-hide_banner", "-nostdin", "-y", "-loglevel", "quiet"}} ffmpeg.execute = function(args) @@ -254,6 +259,9 @@ ffmpeg.create_audio = function(sub, audio_filename) } end +------------------------------------------------------------ +-- ankiconnect requests + ankiconnect = {} ankiconnect.execute = function(request) @@ -330,6 +338,9 @@ ankiconnect.add_note = function(subtitle_string, audio_filename, snapshot_filena end end +------------------------------------------------------------ +-- subtitles and timings + subs = {list = {}} subs.get_current = function() @@ -403,6 +414,8 @@ subs.reset_starting_point = function() mp.osd_message("Starting point is reset.", 2) end +------------------------------------------------------------ +-- send subs to clipboard as they appear clip_autocopy = {} @@ -426,6 +439,9 @@ clip_autocopy.toggle = function() end end +------------------------------------------------------------ +-- main + local function export_to_anki() local sub = subs.get() subs.clear()