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: 46e4b410dbf1cfdfb6f1e4fe8608dfbaed713a3f
Parent: a9911bb823ebea40d7e50a8694d72b3c7f173388
Author: Ren Tatsumoto
Date:   Tue,  3 Nov 2020 17:12:30 +0300

add notes asynchronously

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

diff --git a/subs2srs.lua b/subs2srs.lua @@ -670,15 +670,15 @@ ankiconnect.add_note = function(note_fields, gui) } } } - - local ret = ankiconnect.execute(args) - local result, error = ankiconnect.parse_result(ret) - - if error == nil then - notify(string.format("Note added. ID = %s.", result)) - else - notify(string.format("Error: %s.", error), "error", 2) + local result_notify = function(_, result, _) + local note_id, error = ankiconnect.parse_result(result) + if not error then + notify(string.format("Note added. ID = %s.", note_id)) + else + notify(string.format("Error: %s.", error), "error", 2) + end end + ankiconnect.execute(args, result_notify) end ankiconnect.get_last_note_id = function()