Commit: 0704fb2c9e1dd0a31291112d86ed2040949159b9
Parent: 3711291404b18afd391af3de7fd5c2f818a564e0
Author: Ren Tatsumoto
Date: Sat, 19 Sep 2020 16:04:44 +0300
move assignments up to allow future string manipulations
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -547,6 +547,9 @@ ankiconnect.append_media = function(note_id, audio_filename, snapshot_filename)
'Escape'
}
+ local audio_field = string.format('[sound:%s]', audio_filename)
+ local image_field = string.format('<img src="%s" alt="snapshot">', snapshot_filename)
+
local args = {
action = "updateNoteFields",
version = 6,
@@ -554,8 +557,8 @@ ankiconnect.append_media = function(note_id, audio_filename, snapshot_filename)
note = {
id = note_id,
fields = {
- [config.audio_field] = string.format('[sound:%s]', audio_filename),
- [config.image_field] = string.format('<img src="%s" alt="snapshot">', snapshot_filename),
+ [config.audio_field] = audio_field,
+ [config.image_field] = image_field,
},
}
}