From f08421a48ca04c12b1586eb29969e748e0721aab Mon Sep 17 00:00:00 2001 From: supertobi Date: Mon, 15 Apr 2019 15:55:22 +0200 Subject: [PATCH] Update kml_export.lua Fixed Windows problem --- contrib/kml_export.lua | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/contrib/kml_export.lua b/contrib/kml_export.lua index c809c45..4a1d5e2 100644 --- a/contrib/kml_export.lua +++ b/contrib/kml_export.lua @@ -92,12 +92,10 @@ local function create_kml_file(storage, image_table, extra_data) dt.print_error(_("zip not found")) return end - exportDirectory = dt.configuration.tmp_dir imageFoldername = "" else exportDirectory = dt.preferences.read("kml_export","ExportDirectory","string") - -- Creates dir if not exsists imageFoldername = "files"..PS df.mkdir(df.sanitize_filename(exportDirectory..PS..imageFoldername)) @@ -119,6 +117,8 @@ local function create_kml_file(storage, image_table, extra_data) -- profiles that might be present in the input and aren't needed in the thumbnail. local convertToThumbCommand = ds.sanitize(magickPath) .. " -size 96x96 "..exported_image.." -resize 92x92 -mattecolor \"#FFFFFF\" -frame 2x2 +profile \"*\" "..exportDirectory..PS..imageFoldername.."thumb_"..filename..".jpg" + + df.file_copy(exported_image, exportDirectory..PS..imageFoldername..filename.."."..filetype) dsys.external_command(convertToThumbCommand) else -- Remove exported image if it has no GPS data @@ -142,6 +142,7 @@ local function create_kml_file(storage, image_table, extra_data) filmName = string.gsub(filmName, "|", "") filmName = string.gsub(filmName, "*", "") filmName = string.gsub(filmName, "?", "") + filmName = string.gsub(filmName,'[.]', "") -- At least Windwows has problems with the "." and the start command end exportKMLFilename = filmName..".kml" @@ -292,12 +293,21 @@ local function create_kml_file(storage, image_table, extra_data) end -- Preferences -dt.preferences.register("kml_export", - "OpenKmlFile", - "bool", - _("KML export: Open KML/KMZ file after export"), - _("Opens the KML file after the export with the standard program for KML files"), - false ) +if dt.configuration.running_os == "windows" then + dt.preferences.register("kml_export", + "OpenKmlFile", + "bool", + _("KML export: Open KML file after export"), + _("Opens the KML file after the export with the standard program for KML files"), + false ) +else + dt.preferences.register("kml_export", + "OpenKmlFile", + "bool", + _("KML export: Open KML/KMZ file after export"), + _("Opens the KML file after the export with the standard program for KML files"), + false ) +end local defaultDir = '' if dt.configuration.running_os == "windows" then @@ -344,7 +354,11 @@ if dt.configuration.running_os == "linux" then end -- Register -dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file) +if dt.configuration.running_os == "windows" then + dt.register_storage("kml_export", _("KML Export"), nil, create_kml_file) +else + dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file) +end -- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua -- kate: hl Lua;