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: 1bd591aac6671313811bc1e18c2ce74d4780fd5d
Parent: 46e4b410dbf1cfdfb6f1e4fe8608dfbaed713a3f
Author: Ren Tatsumoto
Date:   Tue,  3 Nov 2020 17:13:54 +0300

rewrite checks

Diffstat:
Msubs2srs.lua | 17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/subs2srs.lua b/subs2srs.lua @@ -407,12 +407,17 @@ local function get_forvo_pronunciation(word) end local function append_forvo_pronunciation(note1, note2) - if config.use_forvo ~= 'no' and not is_empty(note2[config.vocab_field]) then - if config.use_forvo == 'always' then - note1[config.vocab_audio_field] = get_forvo_pronunciation(note2[config.vocab_field]) - elseif is_empty(note2[config.vocab_audio_field]) then - note1[config.vocab_audio_field] = get_forvo_pronunciation(note2[config.vocab_field]) - end + if config.use_forvo == 'no' then + return note1 + end + if type(note2[config.vocab_audio_field]) ~= 'string' then + return note1 + end + if is_empty(note2[config.vocab_field]) then + return note1 + end + if config.use_forvo == 'always' or is_empty(note2[config.vocab_audio_field]) then + note1[config.vocab_audio_field] = get_forvo_pronunciation(note2[config.vocab_field]) end return note1 end