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: 50f98675e75536548fad030a1babe3132e5ef4a3
Parent: 3e5c8ec6a4c8f3a6292d04a908239b5805d272cd
Author: Ren Tatsumoto
Date:   Mon,  2 Nov 2020 13:17:35 +0300

update notes asynchronously

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

diff --git a/subs2srs.lua b/subs2srs.lua @@ -759,15 +759,17 @@ ankiconnect.append_media = function(note_id, note_fields, overwrite) } } - local ret = ankiconnect.execute(args) - local _, error = ankiconnect.parse_result(ret) - - if error == nil then - notify(string.format("Note #%d updated.", note_id)) - ankiconnect.gui_browse(string.format("nid:%d", note_id)) -- select the updated note in the card browser - else - notify(string.format("Error: %s.", error), "error", 2) + local result_notify = function(_, result, _) + local _, error = ankiconnect.parse_result(result) + if not error then + notify(string.format("Note #%s updated.", note_id)) + ankiconnect.gui_browse(string.format("nid:%s", note_id)) -- select the updated note in the card browser + else + notify(string.format("Error: %s.", error), "error", 2) + end end + + ankiconnect.execute(args, result_notify) end ------------------------------------------------------------