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: 63671cbd72cb136b62f6cabdc71acc761637f8d0
Parent: 5f4095684af5fd0623682354e8187897f3c035c7
Author: Ren Tatsumoto
Date:   Mon,  7 Sep 2020 01:50:16 +0300

a function to find id of the last added note

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

diff --git a/subs2srs.lua b/subs2srs.lua @@ -454,6 +454,26 @@ ankiconnect.add_note = function(subtitle_string, audio_filename, snapshot_filena end end +ankiconnect.last_note_id = function() + local args = { + action = "findNotes", + version = 6, + params = { + query = "added:1" -- find all notes added today + } + } + + local ret = ankiconnect.execute(args) + local note_ids, _ = ankiconnect.parse_result(ret) + + if note_ids ~= nil then + local last_note_id = math.max(table.unpack(note_ids)) + return last_note_id + else + return -1 + end +end + ------------------------------------------------------------ -- subtitles and timings