72
72
73
73
local function create_kml_file (storage , image_table , extra_data )
74
74
75
- local magickPath = dt .preferences .read (" kml_export" ," magickPath" ," string" )
75
+ local magickPath
76
+ if dt .configuration .running_os == " linux" then
77
+ magickPath = ' convert'
78
+ else
79
+ magickPath = dt .preferences .read (" kml_export" ," magickPath" ," string" )
80
+ end
76
81
if not df .check_if_bin_exists (magickPath ) then
77
82
dt .print_error (_ (" magick not found" ))
78
83
return
@@ -116,10 +121,12 @@ local function create_kml_file(storage, image_table, extra_data)
116
121
-- will be scaled so its largest dimension is 120 pixels. The '+profile "*"' removes any ICM, EXIF, IPTC, or other
117
122
-- profiles that might be present in the input and aren't needed in the thumbnail.
118
123
119
- local convertToThumbCommand = ds .sanitize (magickPath ) .. " -size 96x96 " .. exported_image .. " -resize 92x92 -mattecolor \" #FFFFFF\" -frame 2x2 +profile \" *\" " .. exportDirectory .. PS .. imageFoldername .. " thumb_" .. filename .. " .jpg"
124
+ local convertToThumbCommand = ds .sanitize (magickPath ) .. " -size 96x96 " .. exported_image .. " -resize 92x92 -mattecolor \" #FFFFFF\" -frame 2x2 +profile \" *\" " .. exportDirectory .. PS .. imageFoldername .. " thumb_" .. filename .. " .jpg"
120
125
121
- df .file_copy (exported_image , exportDirectory .. PS .. imageFoldername .. filename .. " ." .. filetype )
122
- dsys .external_command (convertToThumbCommand )
126
+ if (exported_image ~= exportDirectory .. PS .. imageFoldername .. filename .. " ." .. filetype ) then
127
+ df .file_copy (exported_image , exportDirectory .. PS .. imageFoldername .. filename .. " ." .. filetype )
128
+ end
129
+ dsys .external_command (convertToThumbCommand )
123
130
else
124
131
-- Remove exported image if it has no GPS data
125
132
os.remove (exported_image )
@@ -132,17 +139,17 @@ local function create_kml_file(storage, image_table, extra_data)
132
139
-- https://github.com/darktable-org/lua-scripts/issues/54
133
140
filmName = ds .strip_accents (filmName )
134
141
135
- -- Remove chars we don't like to have in filenames
136
- filmName = string.gsub (filmName , [[ \]] , " " )
137
- filmName = string.gsub (filmName , [[ /]] , " " )
138
- filmName = string.gsub (filmName , [[ :]] , " " )
139
- filmName = string.gsub (filmName , [[ "]] , " " )
140
- filmName = string.gsub (filmName , " <" , " " )
141
- filmName = string.gsub (filmName , " >" , " " )
142
- filmName = string.gsub (filmName , " |" , " " )
143
- filmName = string.gsub (filmName , " *" , " " )
144
- filmName = string.gsub (filmName , " ?" , " " )
145
- filmName = string.gsub (filmName ,' [.]' , " " ) -- At least Windwows has problems with the "." and the start command
142
+ -- Remove chars we don't like to have in filenames
143
+ filmName = string.gsub (filmName , [[ \]] , " " )
144
+ filmName = string.gsub (filmName , [[ /]] , " " )
145
+ filmName = string.gsub (filmName , [[ :]] , " " )
146
+ filmName = string.gsub (filmName , [[ "]] , " " )
147
+ filmName = string.gsub (filmName , " <" , " " )
148
+ filmName = string.gsub (filmName , " >" , " " )
149
+ filmName = string.gsub (filmName , " |" , " " )
150
+ filmName = string.gsub (filmName , " *" , " " )
151
+ filmName = string.gsub (filmName , " ?" , " " )
152
+ filmName = string.gsub (filmName ,' [.]' , " " ) -- At least Windwows has problems with the "." and the start command
146
153
end
147
154
148
155
exportKMLFilename = filmName .. " .kml"
0 commit comments