|
@@ -243,13 +243,10 @@ local function process_image(image_path)
|
|
|
return nil -- Not found
|
|
return nil -- Not found
|
|
|
end
|
|
end
|
|
|
where = find_where_value(h_subject)
|
|
where = find_where_value(h_subject)
|
|
|
- -- print(where)
|
|
|
|
|
- -- extract platz, ort
|
|
|
|
|
local platz = ""
|
|
local platz = ""
|
|
|
local ort = ""
|
|
local ort = ""
|
|
|
local platz_ort_table = {where:match(".*|(.-)|([^|]+)$")}
|
|
local platz_ort_table = {where:match(".*|(.-)|([^|]+)$")}
|
|
|
for i, v in ipairs(platz_ort_table) do
|
|
for i, v in ipairs(platz_ort_table) do
|
|
|
- -- print(i .. ' ' .. v)
|
|
|
|
|
if i == 1 then
|
|
if i == 1 then
|
|
|
platz = v
|
|
platz = v
|
|
|
elseif i == 2 then
|
|
elseif i == 2 then
|
|
@@ -257,9 +254,6 @@ local function process_image(image_path)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- -- print(platz)
|
|
|
|
|
- -- print(ort)
|
|
|
|
|
-
|
|
|
|
|
-- Process HierarchicalSubject
|
|
-- Process HierarchicalSubject
|
|
|
local h_subject_list = {}
|
|
local h_subject_list = {}
|
|
|
for _, v in pairs(h_subject) do
|
|
for _, v in pairs(h_subject) do
|
|
@@ -271,15 +265,12 @@ local function process_image(image_path)
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
- -- Extract GPS coordinates
|
|
|
|
|
- local lat, lon = gps_position:match("([%d%.]+) ([%d%.]+)")
|
|
|
|
|
|
|
+ local lat, lon = gps_position:match("(-?[%d%.]+) (-?[%d%.]+)")
|
|
|
|
|
|
|
|
- -- Generate caption
|
|
|
|
|
local caption = string.format(
|
|
local caption = string.format(
|
|
|
"#img1 %s, %s (<a target='_blank' href='https://www.openstreetmap.org/?mlat=%s&mlon=%s#map=18/%s/%s'>OSM</a>)#",
|
|
"#img1 %s, %s (<a target='_blank' href='https://www.openstreetmap.org/?mlat=%s&mlon=%s#map=18/%s/%s'>OSM</a>)#",
|
|
|
platz or "", ort or "", lat or "", lon or "", lat or "", lon or ""
|
|
platz or "", ort or "", lat or "", lon or "", lat or "", lon or ""
|
|
|
)
|
|
)
|
|
|
- -- print(caption)
|
|
|
|
|
|
|
|
|
|
-- Generate tags, extract the last part of each string and format it
|
|
-- Generate tags, extract the last part of each string and format it
|
|
|
local function subject_tags(t)
|
|
local function subject_tags(t)
|
|
@@ -294,7 +285,6 @@ local function process_image(image_path)
|
|
|
return table.concat(result, " ")
|
|
return table.concat(result, " ")
|
|
|
end
|
|
end
|
|
|
tags = subject_tags(h_subject_list)
|
|
tags = subject_tags(h_subject_list)
|
|
|
- -- Generate title
|
|
|
|
|
title = tags .. " " .. title
|
|
title = tags .. " " .. title
|
|
|
|
|
|
|
|
return filtered_subject, title, caption
|
|
return filtered_subject, title, caption
|
|
@@ -328,16 +318,9 @@ local publication_button = dt.new_widget("button")
|
|
|
-- copy exif data from xmp file
|
|
-- copy exif data from xmp file
|
|
|
run_exiftool( df.sanitize_filename(i.sidecar) , tmp_exported, '-xmp:all -exif:all --subifd:all -overwrite_original' )
|
|
run_exiftool( df.sanitize_filename(i.sidecar) , tmp_exported, '-xmp:all -exif:all --subifd:all -overwrite_original' )
|
|
|
local h_subject, title, caption = process_image(tmp_exported)
|
|
local h_subject, title, caption = process_image(tmp_exported)
|
|
|
- print("Title:", title)
|
|
|
|
|
- print("Caption:", caption)
|
|
|
|
|
remove_unneeded_exif_values(tmp_exported)
|
|
remove_unneeded_exif_values(tmp_exported)
|
|
|
|
|
|
|
|
- -- local spring2lifescript = get_executable("spring2lifescript", "spring2life script")
|
|
|
|
|
- -- run_cmd = spring2lifescript .. " " .. tmp_exported
|
|
|
|
|
- -- .. ' ' .. select_publication_target.value
|
|
|
|
|
- -- .. ' ' .. df.sanitize_filename(i.filename) .. ' &'
|
|
|
|
|
run_cmd = "thunderbird -compose \"to=".. select_publication_target.value ..",subject='" .. title .."',body='" .. caption .. "',attachment='file://" .. tmp_exported .."'\""
|
|
run_cmd = "thunderbird -compose \"to=".. select_publication_target.value ..",subject='" .. title .."',body='" .. caption .. "',attachment='file://" .. tmp_exported .."'\""
|
|
|
- print(run_cmd)
|
|
|
|
|
job = false
|
|
job = false
|
|
|
local job = dt.gui.create_job("Running " .. run_cmd, true, stop_job)
|
|
local job = dt.gui.create_job("Running " .. run_cmd, true, stop_job)
|
|
|
os.execute(run_cmd)
|
|
os.execute(run_cmd)
|