Просмотр исходного кода

coordinates now include - sign

Markus Spring 8 месяцев назад
Родитель
Сommit
8c2a7a4bb2
1 измененных файлов с 1 добавлено и 18 удалено
  1. 1 18
      mail2blog.lua

+ 1 - 18
mail2blog.lua

@@ -243,13 +243,10 @@ local function process_image(image_path)
       return nil  -- Not found
     end
     where = find_where_value(h_subject)  
-    -- print(where)
-    -- extract platz, ort
     local platz = ""
     local ort = ""
     local platz_ort_table = {where:match(".*|(.-)|([^|]+)$")}
     for i, v in ipairs(platz_ort_table) do
-      -- print(i .. ' ' .. v)
       if i == 1 then
         platz = v
       elseif i == 2 then
@@ -257,9 +254,6 @@ local function process_image(image_path)
       end
     end
 
-    -- print(platz)
-    -- print(ort)
-    
     -- Process HierarchicalSubject
     local h_subject_list = {}
     for _, v in pairs(h_subject) do
@@ -271,15 +265,12 @@ local function process_image(image_path)
       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(
         "#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 ""
     )
-    -- print(caption)
 
     -- Generate tags, extract the last part of each string and format it
     local function subject_tags(t)
@@ -294,7 +285,6 @@ local function process_image(image_path)
       return table.concat(result, " ")
     end
     tags = subject_tags(h_subject_list)
-    -- Generate title
     title = tags .. " " .. title
 
     return filtered_subject, title, caption
@@ -328,16 +318,9 @@ local publication_button = dt.new_widget("button")
             -- copy exif data from xmp file
             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)
-            print("Title:", title)
-            print("Caption:", caption)
             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 .."'\""
-            print(run_cmd)
             job = false
             local job = dt.gui.create_job("Running " .. run_cmd, true, stop_job)
             os.execute(run_cmd)