Commit: ad0351ed6afd8ecbd92293cade257696b1afcb67
Parent: 1d4a408666dacb82a719284565db720066fcde94
Author: Ren Tatsumoto
Date: Sat, 19 Sep 2020 04:37:36 +0300
add a function that returns contents of fields of a given note
Diffstat:
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -516,6 +516,22 @@ ankiconnect.last_note_id = function()
end
end
+ankiconnect.get_note_fields = function(note_id)
+ local result, error = ankiconnect.parse_result(ankiconnect.execute {
+ action = "notesInfo",
+ version = 6,
+ params = {
+ notes = { note_id }
+ }
+ })
+
+ if error == nil then
+ return result[1].fields
+ else
+ return nil
+ end
+end
+
ankiconnect.append_media = function(note_id, audio_filename, snapshot_filename)
-- AnkiConnect will fail to update the note if the Anki Browser is open.
-- First, try to close the Anki Browser.