diff --git a/contrib/calcDistance.lua b/contrib/calcDistance.lua index c21dd69..1c76c72 100644 --- a/contrib/calcDistance.lua +++ b/contrib/calcDistance.lua @@ -1,6 +1,6 @@ --[[ This file is part of darktable, - Copyright 2014 by Tobias Jakobs. + Copyright 2014-2016 by Tobias Jakobs. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ USAGE ]] local dt = require "darktable" -dt.configuration.check_version(...,{2,0,1}) +dt.configuration.check_version(...,{3,0,0}) local function calcDistance() local sel_images = dt.gui.selection() @@ -71,6 +71,11 @@ local function calcDistance() 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; + elevation = math.abs(ele1 - ele2) / 1000; --in km + distance = math.sqrt(math.pow(elevation,2) + math.pow(distance,2) ); + dt.print(distance.." km") diff --git a/contrib/gps_select.lua b/contrib/gps_select.lua index 14fbf75..6955971 100644 --- a/contrib/gps_select.lua +++ b/contrib/gps_select.lua @@ -24,7 +24,7 @@ USAGE ]] local dt = require "darktable" -dt.configuration.check_version(...,{2,0,1}) +dt.configuration.check_version(...,{2,0,1},{3,0,0}) table = require "table" local function selectWithGPS() diff --git a/contrib/hugin.lua b/contrib/hugin.lua index 819e5b2..40c2371 100644 --- a/contrib/hugin.lua +++ b/contrib/hugin.lua @@ -35,8 +35,8 @@ This plugin will add a new storage option and calls hugin after export. local dt = require "darktable" --- should work with darktable API version 2.0.0 -dt.configuration.check_version(...,{2,0,0}) +-- works with darktable API version 2.0.0 and 3.0.0 +dt.configuration.check_version(...,{2,0,0},{3,0,0}) local function checkIfBinExists(bin) local handle = io.popen("which "..bin) diff --git a/contrib/kml_export.lua b/contrib/kml_export.lua index da3c2d4..ff5ab53 100644 --- a/contrib/kml_export.lua +++ b/contrib/kml_export.lua @@ -33,7 +33,7 @@ USAGE ]] local dt = require "darktable" -dt.configuration.check_version(...,{2,0,1}) +dt.configuration.check_version(...,{3,0,0}) local function spairs(_table, order) -- Code copied from http://stackoverflow.com/questions/15706270/sort-a-table-in-lua -- collect the keys @@ -110,21 +110,29 @@ local function create_kml_file(storage, image_table, extra_data) -- Create the thumbnails for _,image in pairs(image_table) do - local path, filename, filetype = string.match(image, "(.-)([^\\/]-%.?([^%.\\/]*))$") - filename = string.upper(string.gsub(filename,"%.", "_")) + if ((_.longitude and _.latitude) and + (_.longitude ~= 0 and _.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 - -- 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. + -- 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 + -- 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. - local concertToThumbCommand = "convert -size 96x96 "..image.." -resize 92x92 -mattecolor \"#FFFFFF\" -frame 2x2 +profile \"*\" "..exportDirectory.."/"..imageFoldername.."thumb_"..filename..".jpg" - -- USE coroutine.yield. It does not block the UI - coroutine.yield("RUN_COMMAND", concertToThumbCommand) - local concertCommand = "convert -size 438x438 "..image.." -resize 438x438 +profile \"*\" "..exportDirectory.."/"..imageFoldername..filename..".jpg" - coroutine.yield("RUN_COMMAND", concertCommand) + local concertToThumbCommand = "convert -size 96x96 "..image.." -resize 92x92 -mattecolor \"#FFFFFF\" -frame 2x2 +profile \"*\" "..exportDirectory.."/"..imageFoldername.."thumb_"..filename..".jpg" + -- USE coroutine.yield. It does not block the UI + coroutine.yield("RUN_COMMAND", concertToThumbCommand) + local concertCommand = "convert -size 438x438 "..image.." -resize 438x438 +profile \"*\" "..exportDirectory.."/"..imageFoldername..filename..".jpg" + coroutine.yield("RUN_COMMAND", concertCommand) + end + + -- delete the original image to not get into the kmz file + local rmCommand = "rm "..image + coroutine.yield("RUN_COMMAND", rmCommand) local pattern = "[/]?([^/]+)$" filmName = string.match(_.film.path, pattern) @@ -134,7 +142,7 @@ local function create_kml_file(storage, image_table, extra_data) exportKMZFilename = filmName..".kmz" -- Create the KML file - kml_file = "\n" + local kml_file = "\n" kml_file = kml_file.."\n" kml_file = kml_file.."\n" @@ -149,8 +157,13 @@ local function create_kml_file(storage, image_table, extra_data) (image.longitude ~= 0 and image.latitude ~= 90) -- Sometimes the north-pole but most likely just wrong data ) then kml_file = kml_file.." \n" - kml_file = kml_file.." "..image.filename.."\n" - --kml_file = kml_file.." \n" + if (image.title and image.title ~= "") then + kml_file = kml_file.." "..image.title.."\n" + else + kml_file = kml_file.." "..image.filename.."\n" + end + + kml_file = kml_file.." "..image.description.."\n" kml_file = kml_file.."