Remove trailing whitespaces.

This commit is contained in:
Pascal Obry
2017-04-10 16:59:35 +02:00
parent 76daa583b3
commit efcd48f1d9
7 changed files with 130 additions and 132 deletions

View File

@@ -74,7 +74,7 @@ local function mcopy_tags()
--remove duplicate and 'darktable|' tags create final image_tags
for _,k in ipairs(tag_list_tmp) do
if not string.match(tostring(k), 'darktable|') then
if not hash[k] then
image_tags[#image_tags+1] = k
@@ -85,36 +85,36 @@ local function mcopy_tags()
dt.print(_('Image tags copied ...'))
--create UI tag list
--create UI tag list
local taglist = ""
for _,tag in ipairs(image_tags) do
if taglist == "" then
taglist = tostring(tag)
else
taglist = taglist.."\n"..tostring(tag)
end
end
end
end
taglist_label.label = taglist
taglist_label.label = taglist
return(image_tags)
end
-- attach copied tags to all selected images
local function attach_tags()
if next(image_tags) == nil then
dt.print(_('No tags to attached, please copy tags first.'))
return true
end
local sel_images = dt.gui.action_images
for _,image in ipairs(sel_images) do
local present_image_tags = {}
present_image_tags = dt.tags.get_tags(image)
for _,ct in ipairs(image_tags) do
-- check if image has tags and attach
if next(present_image_tags) == nil then
@@ -138,7 +138,7 @@ local function detach_tags()
for _,image in ipairs(sel_images) do
local present_image_tags = {}
present_image_tags = dt.tags.get_tags(image)
for _,present_tag in ipairs(present_image_tags) do
if not string.match(tostring(present_tag), 'darktable|') then
dt.tags.detach(present_tag,image)

View File

@@ -31,13 +31,13 @@ USAGE
* require this script from your main Lua file
]]
local dt = require "darktable"
require "official/yield"
local gettext = dt.gettext
dt.configuration.check_version(...,{3,0,0},{4,0,0})
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoJSON_export",dt.configuration.config_dir.."/lua/locale/")
@@ -52,7 +52,7 @@ local function spairs(_table, order) -- Code copied from http://stackoverflow.co
for _key in pairs(_table) do keys[#keys + 1] = _key end
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
-- otherwise just sort the keys
if order then
table.sort(keys, function(a,b) return order(_table, a, b) end)
else
@@ -108,20 +108,20 @@ local function create_geoJSON_file(storage, image_table, extra_data)
-- Creates dir if not exsists
local imageFoldername = "files/"
local mkdirCommand = "mkdir -p "..exportDirectory.."/"..imageFoldername
dt.control.execute( mkdirCommand)
dt.control.execute( mkdirCommand)
-- Create the thumbnails
for image,exported_image in pairs(image_table) do
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
local path, filename, filetype = string.match(image, "(.-)([^\\/]-%.?([^%.\\/]*))$")
filename = string.upper(string.gsub(filename,"%.", "_"))
-- convert -size 92x92 filename.jpg -resize 92x92 +profile "*" thumbnail.jpg
-- In this example, '-size 120x120' gives a hint to the JPEG decoder that the image is going to be downscaled to
-- 120x120, allowing it to run faster by avoiding returning full-resolution images to GraphicsMagick for the
-- subsequent resizing operation. The '-resize 120x120' specifies the desired dimensions of the output image. It
-- In this example, '-size 120x120' gives a hint to the JPEG decoder that the image is going to be downscaled to
-- 120x120, allowing it to run faster by avoiding returning full-resolution images to GraphicsMagick for the
-- subsequent resizing operation. The '-resize 120x120' specifies the desired dimensions of the output image. It
-- will be scaled so its largest dimension is 120 pixels. The '+profile "*"' removes any ICM, EXIF, IPTC, or other
-- profiles that might be present in the input and aren't needed in the thumbnail.
@@ -143,15 +143,15 @@ local function create_geoJSON_file(storage, image_table, extra_data)
-- Create the geoJSON file
local geoJSON_file = [[
{
{
"type": "FeatureCollection",
"features": [
]]
for image,exported_image in pairs(image_table) do
filename = string.upper(string.gsub(image.filename,"%.", "_"))
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
geoJSON_file = geoJSON_file..
@@ -179,7 +179,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
,]]
end
end
geoJSON_file = geoJSON_file:sub(0,geoJSON_file:len()-1)
geoJSON_file = geoJSON_file..
[[
@@ -213,7 +213,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
.setView([0,0], 5);
var myLayer = L.mapbox.featureLayer()
.loadURL(']]..exportgeoJSONFilename..[[')
.loadURL(']]..exportgeoJSONFilename..[[')
.addTo(mapTooltipsJS);
// Set a custom icon on each marker based on feature properties.
@@ -260,7 +260,7 @@ local function create_geoJSON_file(storage, image_table, extra_data)
var polyline = L.polyline(line, polyline_options).addTo(mapTooltipsJS);
});
</script>
</body>
</html>
@@ -277,11 +277,11 @@ local function create_geoJSON_file(storage, image_table, extra_data)
dt.print("geoJSON file created in "..exportDirectory)
-- Open the file with the standard programm
-- Open the file with the standard programm
if ( dt.preferences.read("geoJSON_export","OpengeoJSONFile","bool") == true ) then
local geoJSONFileOpenCommand
geoJSONFileOpenCommand = "xdg-open "..exportDirectory.."/\""..exportgeoJSONFilename.."\""
dt.control.execute( geoJSONFileOpenCommand)
dt.control.execute( geoJSONFileOpenCommand)
end

View File

@@ -19,7 +19,7 @@
USAGE
* require this script from your main lua file
To do this add this line to the file .config/darktable/luarc:
To do this add this line to the file .config/darktable/luarc:
require "geoToolbox"
* it creates a new geoToolbox lighttable module
@@ -44,20 +44,20 @@ labelDistance.label = _("Distance:")
local label_copy_gps_lat = dt.new_widget("check_button")
{
label = _("latitude:"),
label = _("latitude:"),
value = true
}
local label_copy_gps_lon = dt.new_widget("check_button")
{
label = _("longitude:"),
label = _("longitude:"),
value = true
}
local label_copy_gps_ele = dt.new_widget("check_button")
{
label = _("elevation:"),
label = _("elevation:"),
value = true
}
-- </GUI>
-- </GUI>
local function select_with_gps()
local selection = {}
@@ -107,9 +107,9 @@ function isnan(x) return x ~= x end
-- Function from:
-- https://forums.coronalabs.com/topic/29019-convert-string-to-date/
-- This looks much scarier than it really is. The goal is to turn that string
-- into a Unix timestamp (number of seconds since Jan 1, 1970, the standard
-- used by most systems). So we use the string.match() method to fetch the
-- This looks much scarier than it really is. The goal is to turn that string
-- into a Unix timestamp (number of seconds since Jan 1, 1970, the standard
-- used by most systems). So we use the string.match() method to fetch the
-- various date and time parts into their own variables: xyear, xmonth,etc.
function make_time_stamp(dateString)
local convertedTimestamp
@@ -119,11 +119,11 @@ function make_time_stamp(dateString)
local xyear, xmonth, xday, xhour, xminute, xseconds = dateString:match(pattern)
--dt.print_error(xyear)
convertedTimestamp = os.time({
year = xyear,
month = xmonth,
day = xday,
hour = xhour,
min = xminute,
year = xyear,
month = xmonth,
day = xday,
hour = xhour,
min = xminute,
sec = xseconds})
else
convertedTimestamp = 0
@@ -141,7 +141,7 @@ local first_image_date = 0
local function get_first_coordinate()
local sel_images = dt.gui.action_images
first_latitude = ''
first_latitude = ''
first_longitude = ''
first_elevation = ''
first_image_date = 0
@@ -153,7 +153,7 @@ local function get_first_coordinate()
image_date = image.exif_datetime_taken
first_have_data = true
if (image.latitude) then
first_latitude = image.latitude
first_latitude = image.latitude
end
if (image.longitude) then
first_longitude = image.longitude
@@ -164,7 +164,7 @@ local function get_first_coordinate()
if (image.exif_datetime_taken) then
first_image_date = make_time_stamp(image.exif_datetime_taken)
--dt.print_error(image.exif_datetime_taken)
--dt.print_error(first_image_date)
--dt.print_error(first_image_date)
end
end
return
@@ -180,7 +180,7 @@ local second_image_date = 0
local function get_second_coordinate()
local sel_images = dt.gui.action_images
second_latitude = ''
second_latitude = ''
second_longitude = ''
second_elevation = ''
second_image_date = 0
@@ -192,7 +192,7 @@ local function get_second_coordinate()
image_date = image.exif_datetime_taken
second_have_data = true
if (image.latitude) then
second_latitude = image.latitude
second_latitude = image.latitude
end
if (image.longitude) then
second_longitude = image.longitude
@@ -210,7 +210,7 @@ end
local calc_in_between_slider = dt.new_widget("slider")
{
label = "Position between",
label = "Position between",
soft_min = 0, -- The soft minimum value for the slider, the slider can't go beyond this point
soft_max = 100, -- The soft maximum value for the slider, the slider can't go beyond this point
hard_min = -100, -- The hard minimum value for the slider, the user can't manually enter a value beyond this point
@@ -234,7 +234,7 @@ local function calc_in_between()
percent_in_between = 1
else
percent_in_between = image_date_new/end_new
end
end
calc_in_between_slider.value = percent_in_between * 100
dt.print_error(percent_in_between)
local in_between_latitude = first_latitude + (second_latitude - first_latitude) * percent_in_between
@@ -264,7 +264,7 @@ local copy_gps_elevation = ''
local function copy_gps()
local sel_images = dt.gui.action_images
copy_gps_latitude = ''
copy_gps_latitude = ''
copy_gps_longitude = ''
copy_gps_elevation = ''
@@ -274,7 +274,7 @@ local function copy_gps()
else
copy_gps_have_data = true
if (image.latitude and label_copy_gps_lat.value) then
copy_gps_latitude = image.latitude
copy_gps_latitude = image.latitude
end
if (image.longitude and label_copy_gps_lon.value) then
copy_gps_longitude = image.longitude
@@ -299,7 +299,7 @@ local function paste_gps(image)
if (label_copy_gps_lat.value) then
image.latitude = copy_gps_latitude
end
if (label_copy_gps_lon.value) then
if (label_copy_gps_lon.value) then
image.longitude = copy_gps_longitude
end
if (label_copy_gps_ele.value) then
@@ -313,17 +313,17 @@ local function open_location_in_gnome_maps()
if not df.check_if_bin_exists("gnome-maps") then
dt.print_error(_("gnome-maps not found"))
return
end
end
local sel_images = dt.gui.action_images
local lat1 = 0;
local lon1 = 0;
local i = 0;
-- Use the first image with geo information
for _,image in ipairs(sel_images) do
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
lat1 = image.latitude;
@@ -334,7 +334,7 @@ local function open_location_in_gnome_maps()
local startCommand
startCommand = "gnome-maps \"geo:" .. lat1 .. "," .. lon1 .."\""
dt.print_error(startCommand)
if coroutine.yield("RUN_COMMAND", startCommand) then
dt.print(_("Command failed ..."))
end
@@ -350,14 +350,14 @@ local function get_distance(lat1, lon1, ele1, lat2, lon2, ele2)
local earthRadius = 6371; -- Radius of the earth in km
local dLat = math.rad(lat2-lat1); -- deg2rad below
local dLon = math.rad(lon2-lon1);
local a =
local dLon = math.rad(lon2-lon1);
local a =
math.sin(dLat/2) * math.sin(dLat/2) +
math.cos(math.rad(lat1)) * math.cos(math.rad(lat2)) *
math.cos(math.rad(lat1)) * math.cos(math.rad(lat2)) *
math.sin(dLon/2) * math.sin(dLon/2)
;
local angle = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a));
local distance = earthRadius * angle; -- Distance in km
local angle = 2 * math.atan2(math.sqrt(a), math.sqrt(1-a));
local distance = earthRadius * angle; -- Distance in km
-- Add the elevation to the calculation
local elevation = 0
@@ -385,9 +385,9 @@ local function calc_distance()
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
i = i + 1;
if (i == 1) then
lat1 = image.latitude
lon1 = image.longitude
@@ -397,7 +397,7 @@ local function calc_distance()
ele1 = 0
end
end
lat2 = image.latitude
lon2 = image.longitude
if (image.elevation) then
@@ -417,7 +417,7 @@ local function calc_distance()
else
distanceUnit = _("km")
end
return string.format(_("Distance: %.2f %s"), distance, distanceUnit)
end
@@ -437,7 +437,7 @@ local altitude_file_chooser_button = dt.new_widget("file_chooser_button")
}
local altitude_filename = dt.new_widget("entry")
{
text = "altitude.csv",
text = "altitude.csv",
placeholder = "altitude.csv",
editable = true,
tooltip = _("Name of the exported file"),
@@ -465,12 +465,12 @@ local function altitude_profile()
local sel_images = dt.gui.action_images
for _,image in ipairs(sel_images) do
if ((not isnan(image.longitude) and not isnan(image.latitude) and not isnan(image.elevation) and image.elevation) and
if ((not isnan(image.longitude) and not isnan(image.latitude) and not isnan(image.elevation) and image.elevation) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
i = i + 1;
if (i == 1) then
lat1 = image.latitude
lon1 = image.longitude
@@ -480,7 +480,7 @@ local function altitude_profile()
lon1 = lon2
ele1 = ele2
end
lat2 = image.latitude
lon2 = image.longitude
ele2 = image.elevation
@@ -576,7 +576,7 @@ dt.register_lib(
},
calc_in_between_slider,
separator3,--------------------------------------------------------
]]
]]
dt.new_widget("button")
{
label = _("open in Gnome Maps"),

View File

@@ -4,7 +4,7 @@
Copyright (C) 2016 Bill Ferguson <wpferguson@gmail.com>.
Portions are lifted from hugin.lua and thus are
Portions are lifted from hugin.lua and thus are
Copyright (c) 2014 Wolfgang Goetz
Copyright (c) 2015 Christian Kanzian
@@ -29,9 +29,9 @@
This script provides another storage (export target) for darktable. Selected
images are exported in the specified format to temporary storage. GIMP is launched
and opens the files. After editing, the exported images are overwritten to save the
and opens the files. After editing, the exported images are overwritten to save the
changes. When GIMP exits, the exported files are moved into the current collection
and imported into the database. The imported files then show up grouped with the
and imported into the database. The imported files then show up grouped with the
originally selected images.
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
@@ -50,8 +50,8 @@
CAVEATS
* Developed and tested on Ubuntu 14.04 LTS with darktable 2.0.3 and GIMP 2.9.3 (development version with
> 8 bit color)
* There is no provision for dealing with the xcf files generated by GIMP, since darktable doesn't deal with
them. You may want to save the xcf file if you intend on doing further edits to the image or need to save
* There is no provision for dealing with the xcf files generated by GIMP, since darktable doesn't deal with
them. You may want to save the xcf file if you intend on doing further edits to the image or need to save
the layers used. Where you save them is up to you.
BUGS, COMMENTS, SUGGESTIONS
@@ -123,11 +123,11 @@ end
function checkIfFileExists(filepath)
local file = io.open(filepath,"r")
local ret
if file ~= nil then
io.close(file)
if file ~= nil then
io.close(file)
dt.print_error("true checkIfFileExists: "..filepath)
ret = true
else
else
dt.print_error(filepath.." not found")
ret = false
end
@@ -254,7 +254,7 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
return
end
-- list of exported images
-- list of exported images
local img_list
-- reset and create image list
@@ -269,13 +269,13 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
local gimpStartCommand
gimpStartCommand = "gimp "..img_list
dt.print_error(gimpStartCommand)
dt.control.execute( gimpStartCommand)
-- for each of the image, exported image pairs
-- move the exported image into the directory with the original
-- move the exported image into the directory with the original
-- then import the image into the database which will group it with the original
-- and then copy over any tags other than darktable tags
@@ -286,8 +286,8 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
while checkIfFileExists(myimage_name) do
myimage_name = filename_increment(myimage_name)
-- limit to 99 more exports of the original export
if string.match(get_basename(myimage_name), "_(d-)$") == "99" then
break
if string.match(get_basename(myimage_name), "_(d-)$") == "99" then
break
end
end
@@ -300,7 +300,7 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
groupIfNotMember(image, myimage)
for _,tag in pairs(dt.tags.get_tags(image)) do
for _,tag in pairs(dt.tags.get_tags(image)) do
if not (string.sub(tag.name,1,9) == "darktable") then
dt.print_error("attaching tag")
dt.tags.attach(tag,myimage)
@@ -315,5 +315,3 @@ end
dt.register_storage("module_gimp", _("Edit with GIMP"), show_status, gimp_edit)
--

View File

@@ -1,28 +1,28 @@
--[[
Hugin storage for darktable
Hugin storage for darktable
copyright (c) 2014 Wolfgang Goetz
copyright (c) 2015 Christian Kanzian
copyright (c) 2015 Tobias Jakobs
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
darktable is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with darktable. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
HUGIN
Add a new storage option to send images to hugin.
Images are exported to darktable tmp dir first.
Add a new storage option to send images to hugin.
Images are exported to darktable tmp dir first.
ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT
* hugin
@@ -86,7 +86,7 @@ local function create_panorama(storage, image_table, extra_data) --finalize
hugin_executor = true
end
-- list of exported images
-- list of exported images
local img_list
-- reset and create image list
@@ -112,7 +112,7 @@ local function create_panorama(storage, image_table, extra_data) --finalize
else
huginStartCommand = "hugin "..img_list
end
dt.print_error(huginStartCommand)
if not dt.control.execute(huginStartCommand)

View File

@@ -35,13 +35,13 @@ USAGE
* when choosing file format, pick JPEG or PNG as Google Earth doesn't support other formats
]]
local dt = require "darktable"
require "official/yield"
local gettext = dt.gettext
dt.configuration.check_version(...,{3,0,0},{4,0,0})
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("kml_export",dt.configuration.config_dir.."/lua/locale/")
@@ -56,7 +56,7 @@ local function spairs(_table, order) -- Code copied from http://stackoverflow.co
for _key in pairs(_table) do keys[#keys + 1] = _key end
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
-- otherwise just sort the keys
if order then
table.sort(keys, function(a,b) return order(_table, a, b) end)
else
@@ -89,7 +89,7 @@ local function checkIfBinExists(bin)
ret = true
return ret
end
-- Strip accents from a string
-- Copied from https://forums.coronalabs.com/topic/43048-remove-special-characters-from-string/
function string.stripAccents( str )
@@ -145,7 +145,7 @@ function string.stripAccents( str )
tableAccents["Û"] = "U"
tableAccents["Ü"] = "U"
tableAccents["Ý"] = "Y"
local normalizedString = ""
for strChar in string.gmatch(str, "([%z\1-\127\194-\244][\128-\191]*)") do
@@ -155,9 +155,9 @@ function string.stripAccents( str )
normalizedString = normalizedString..strChar
end
end
return normalizedString
end
-- Escape XML characters
@@ -205,22 +205,22 @@ local function create_kml_file(storage, image_table, extra_data)
-- Creates dir if not exsists
imageFoldername = "files/"
local mkdirCommand = "mkdir -p "..exportDirectory.."/"..imageFoldername
dt.control.execute(mkdirCommand)
dt.control.execute(mkdirCommand)
end
-- Create the thumbnails
for image,exported_image in pairs(image_table) do
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
local path, filename, filetype = string.match(exported_image, "(.-)([^\\/]-%.?([^%.\\/]*))$")
filename = string.upper(string.gsub(filename,"%.%w*", ""))
-- convert -size 92x92 filename.jpg -resize 92x92 +profile "*" thumbnail.jpg
-- In this example, '-size 120x120' gives a hint to the JPEG decoder that the image is going to be downscaled to
-- 120x120, allowing it to run faster by avoiding returning full-resolution images to GraphicsMagick for the
-- subsequent resizing operation. The '-resize 120x120' specifies the desired dimensions of the output image. It
-- In this example, '-size 120x120' gives a hint to the JPEG decoder that the image is going to be downscaled to
-- 120x120, allowing it to run faster by avoiding returning full-resolution images to GraphicsMagick for the
-- subsequent resizing operation. The '-resize 120x120' specifies the desired dimensions of the output image. It
-- will be scaled so its largest dimension is 120 pixels. The '+profile "*"' removes any ICM, EXIF, IPTC, or other
-- profiles that might be present in the input and aren't needed in the thumbnail.
@@ -233,7 +233,7 @@ local function create_kml_file(storage, image_table, extra_data)
local pattern = "[/]?([^/]+)$"
filmName = string.match(image.film.path, pattern)
-- Strip accents from the filename, because GoogleEarth can't open them
-- https://github.com/darktable-org/lua-scripts/issues/54
filmName = string.stripAccents(filmName)
@@ -248,20 +248,20 @@ local function create_kml_file(storage, image_table, extra_data)
kml_file = kml_file.."<Document>\n"
--image_table = dt.gui.selection();
kml_file = kml_file.."<name>"..filmName.."</name>\n"
kml_file = kml_file.."<name>"..filmName.."</name>\n"
kml_file = kml_file.." <description>Exported from darktable</description>\n"
for image,exported_image in pairs(image_table) do
-- Extract filename, e.g DSC9784.ARW -> DSC9784
filename = string.upper(string.gsub(image.filename,"%.%w*", ""))
-- Extract extension from exported image (user can choose JPG or PNG), e.g DSC9784.JPG -> .JPG
extension = string.match(exported_image,"%.%w*$")
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
kml_file = kml_file.." <Placemark>\n"
local image_title, image_description
if (image.title and image.title ~= "") then
image_title = string.escapeXmlCharacters(image.title)
@@ -271,12 +271,12 @@ local function create_kml_file(storage, image_table, extra_data)
-- Characters should not be escaped in CDATA, but we are using HTML fragment, so we must escape them
image_description = string.escapeXmlCharacters(image.description)
kml_file = kml_file.." <name>"..image_title.."</name>\n"
kml_file = kml_file.." <name>"..image_title.."</name>\n"
kml_file = kml_file.." <description>"..image_description.."</description>\n"
kml_file = kml_file.." <Style>\n"
kml_file = kml_file.." <IconStyle>\n"
kml_file = kml_file.." <Icon>\n"
kml_file = kml_file.." <href>"..imageFoldername.."thumb_"..filename..".jpg</href>\n"
kml_file = kml_file.." <href>"..imageFoldername.."thumb_"..filename..".jpg</href>\n"
kml_file = kml_file.." </Icon>\n"
kml_file = kml_file.." </IconStyle>\n"
kml_file = kml_file.." <BalloonStyle>\n"
@@ -293,29 +293,29 @@ local function create_kml_file(storage, image_table, extra_data)
kml_file = kml_file.." <when>"..string.gsub(image.exif_datetime_taken," ", "T").."Z".."</when>\n"
kml_file = kml_file.." </TimeStamp>\n"
kml_file = kml_file.." </Point>\n"
kml_file = kml_file.." </Placemark>\n"
end
end
-- Connects all images with an path
if ( dt.preferences.read("kml_export","CreatePath","bool") == true ) then
kml_file = kml_file.." <Placemark>\n"
kml_file = kml_file.." <Placemark>\n"
kml_file = kml_file.." <name>Path</name>\n" -- ToDo: I think a better name would be nice
--kml_file = kml_file.." <description></description>\n"
kml_file = kml_file.." <Style>\n"
kml_file = kml_file.." <LineStyle>\n"
kml_file = kml_file.." <Style>\n"
kml_file = kml_file.." <LineStyle>\n"
kml_file = kml_file.." <color>ff0000ff</color>\n"
kml_file = kml_file.." <width>5</width>\n"
kml_file = kml_file.." </LineStyle>\n"
kml_file = kml_file.." </LineStyle>\n"
kml_file = kml_file.." </Style>\n"
kml_file = kml_file.." <LineString>\n"
kml_file = kml_file.." <coordinates>\n"
for image,exported_image in spairs(image_table, function(t,a,b) return t[b] < t[a] end) do
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
local altitude = 0;
@@ -349,7 +349,7 @@ local function create_kml_file(storage, image_table, extra_data)
createKMZCommand = createKMZCommand .."\""..dt.configuration.tmp_dir.."/"..exportKMLFilename.."\" " -- KML file
for image,exported_image in pairs(image_table) do
if ((image.longitude and image.latitude) and
if ((image.longitude and image.latitude) and
(image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data
) then
local filename = string.upper(string.gsub(image.filename,"%.%w*", ""))
@@ -362,7 +362,7 @@ local function create_kml_file(storage, image_table, extra_data)
dt.control.execute(createKMZCommand)
end
-- Open the file with the standard programm
-- Open the file with the standard programm
if ( dt.preferences.read("kml_export","OpenKmlFile","bool") == true ) then
local kmlFileOpenCommand
@@ -371,7 +371,7 @@ local function create_kml_file(storage, image_table, extra_data)
else
kmlFileOpenCommand = "xdg-open "..exportDirectory.."/\""..exportKMLFilename.."\""
end
dt.control.execute(kmlFileOpenCommand)
dt.control.execute(kmlFileOpenCommand)
end
@@ -406,7 +406,7 @@ dt.preferences.register("kml_export",
"bool",
_("KML export: Create KMZ file"),
_("Compress all imeges to one KMZ file"),
true )
true )
-- Register
dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file)

View File

@@ -23,7 +23,7 @@ You need rhythmbox-client installed to use this script
USAGE
* require this script from your main lua file
]]
local dt = require "darktable"
require "official/yield"
@@ -65,14 +65,14 @@ local function playSlideshowMusic(_, old_view, new_view)
if (new_view.id == "slideshow") then
playCommand = 'rhythmbox-client --play-uri="'..filename..'"'
--dt.print_error(playCommand)
dt.control.execute( playCommand)
dt.control.execute( playCommand)
else
if (old_view and old_view.id == "slideshow") then
stopCommand = "rhythmbox-client --pause"
--dt.print_error(stopCommand)
dt.control.execute( stopCommand)
dt.control.execute( stopCommand)
end
end
end
@@ -80,7 +80,7 @@ end
-- Preferences
dt.preferences.register("slideshowMusic", "SlideshowMusic", "file", _("Slideshow background music file"), "", "")
dt.preferences.register("slideshowMusic",
dt.preferences.register("slideshowMusic",
"PlaySlideshowMusic",
"bool",
_("Play slideshow background music"),