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: b1ff6f34db095dcb3dd0e5294fa2bc4738e97927
Parent: 092161028cccb7e96f2fe2ce066885d4ac72a005
Author: Ren Tatsumoto
Date:   Wed,  5 Jan 2022 23:14:55 +0300

fix the duplicates problem

Diffstat:
M.github/RELEASE/subs2srs.conf | 3+++
Msubs2srs.lua | 5+++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.github/RELEASE/subs2srs.conf b/.github/RELEASE/subs2srs.conf @@ -41,6 +41,9 @@ use_ffmpeg=no # Automatically create the deck for new cards (see deck_name option) create_deck=yes +# Allow making notes with the same sentence field. +allow_duplicates=no + # When mpv starts, automatically copy subs to the clipboard as they appear on screen. # This option can be also toggled in the addon's OSD menu. autoclip=no diff --git a/subs2srs.lua b/subs2srs.lua @@ -57,6 +57,7 @@ local config = { -- Anki create_deck = false, -- automatically create a deck for new cards + allow_duplicates = false, -- allow making notes with the same sentence field deck_name = "Learning", -- name of the deck for new cards model_name = "Japanese sentences", -- Tools -> Manage note types sentence_field = "SentKanji", @@ -671,7 +672,7 @@ local function export_to_anki(gui) end if not gui and is_empty(sub['text']) then - sub['text'] = string.format([[<span id="mpv%s">mpvacious wasn't able to grab subtitles</span>]], os.time()) + sub['text'] = string.format("mpvacious wasn't able to grab subtitles (%s)", os.time()) end local snapshot_timestamp = mp.get_property_number("time-pos", 0) @@ -1118,7 +1119,7 @@ ankiconnect.add_note = function(note_fields, gui) modelName = config.model_name, fields = note_fields, options = { - allowDuplicate = false, + allowDuplicate = config.allow_duplicates, duplicateScope = "deck", }, tags = tags,