|
|
@@ -134,6 +134,11 @@ local function save_preferences()
|
|
|
dt.preferences.write("lightgallery_export", "gallery_tag", "string", gallery_tag_widget.text)
|
|
|
end
|
|
|
|
|
|
+-- Function to check if a string is not empty
|
|
|
+local function is_not_empty(s)
|
|
|
+ return s ~= "" and s ~= nil
|
|
|
+end
|
|
|
+
|
|
|
local function run_post_export_script(exp_path)
|
|
|
title = dt.preferences.read("lightgallery_export", "gallery_title", "string")
|
|
|
if title == "" then
|
|
|
@@ -184,12 +189,12 @@ local function export_to_lightgallery()
|
|
|
targetfile = df.sanitize_filename(string.gsub(exp_path, "'", "")..PS..mws_basename(i.filename)..'.jpg')
|
|
|
dt.print('mv ' .. tmp_exported .. ' ' .. targetfile)
|
|
|
os.execute('mv ' .. tmp_exported .. ' ' .. targetfile)
|
|
|
- tag = dt.preferences.read("lightgallery_export", "gallery_tags", "string")
|
|
|
- if not tag == "" then
|
|
|
+ tag = dt.preferences.read("lightgallery_export", "gallery_tag", "string")
|
|
|
+ if is_not_empty(tag) then
|
|
|
tag = 'photography|published|gallery|'..tag
|
|
|
tnr = dt.tags.find(tag)
|
|
|
if not tnr then
|
|
|
- tnr = dt.create(tag)
|
|
|
+ tnr = dt.tags.create(tag)
|
|
|
end
|
|
|
dt.tags.attach(tnr,i)
|
|
|
end
|