diff --git a/README.md b/README.md index 640a201..3dd001b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ lua-scripts The Lua scripts in this repository are meant to be used together with darktable. Either copy them individually to `~/.config/darktable/lua` (you might have to create that folder) or just copy/symlink the whole repository there. That allows to update all your scripts with a simple call to `git pull`. -To enable one of the scripts you have to add a line like `require "official/hello_world"` which would enable the example script in `official/hello_world.lua`. +To enable one of the scripts you have to add a line like `require "official/hello_world"` to your `~/.config/darktable/luarc` file which will enable the example script in `official/hello_world.lua` (note the lack of the `.lua` suffix). Each script includes its own documentation and usage in its header, please refer to them. diff --git a/contrib/copy_attach_detach_tags.lua b/contrib/copy_attach_detach_tags.lua index d5a7ec8..5081732 100644 --- a/contrib/copy_attach_detach_tags.lua +++ b/contrib/copy_attach_detach_tags.lua @@ -34,7 +34,7 @@ USAGE ]] local dt = require "darktable" -dt.configuration.check_version(...,{2,0,0}) +dt.configuration.check_version(...,{2,0,0},{3,0,0}) local image_tags = {} diff --git a/contrib/hugin.lua b/contrib/hugin.lua index a87437f..819e5b2 100644 --- a/contrib/hugin.lua +++ b/contrib/hugin.lua @@ -1,119 +1,119 @@ ---[[ - 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 . -]] - ---[[ -HUGIN -Add a new storage option to send images to hugin. -Images are exported to darktable tmp dir first. - -ADDITIANAL SOFTWARE NEEDED FOR THIS SCRIPT -* hugin - -USAGE -* require this file from your main luarc config file. - -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}) - -local function checkIfBinExists(bin) - local handle = io.popen("which "..bin) - local result = handle:read() - local ret - handle:close() - if (result) then - dt.print_error("true checkIfBinExists: "..bin) - ret = true - else - dt.print_error(bin.." not found") - ret = false - end - - - return ret -end - -local function show_status(storage, image, format, filename, - number, total, high_quality, extra_data) - dt.print("Export to Hugin "..tostring(number).."/"..tostring(total)) -end - -local function create_panorama(storage, image_table, extra_data) --finalize - if not checkIfBinExists("hugin") then - darktable.print_error("hugin not found") - return - end - --- Since Hugin 2015.0.0 hugin provides a command line tool to start the assistant --- http://wiki.panotools.org/Hugin_executor --- We need pto_gen to create pto file for hugin_executor --- http://hugin.sourceforge.net/docs/manual/Pto_gen.html - - local hugin_executor = false - if (checkIfBinExists("hugin_executor") and checkIfBinExists("pto_gen")) then - hugin_executor = true - end - - -- list of exported images - local img_list - - -- reset and create image list - img_list = "" - - for _,v in pairs(image_table) do - img_list = img_list ..v.. " " - end - - dt.print("Will try to stitch now") - - local huginStartCommand - if (hugin_executor) then - huginStartCommand = "pto_gen "..img_list.." -o "..dt.configuration.tmp_dir.."/project.pto" - dt.print("Creating pto file") - coroutine.yield("RUN_COMMAND", huginStartCommand) - - dt.print("Running Assistent") - huginStartCommand = "hugin_executor --assistant "..dt.configuration.tmp_dir.."/project.pto" - coroutine.yield("RUN_COMMAND", huginStartCommand) - - huginStartCommand = "hugin "..dt.configuration.tmp_dir.."/project.pto" - else - huginStartCommand = "hugin "..img_list - end - - dt.print_error(huginStartCommand) - - if coroutine.yield("RUN_COMMAND", huginStartCommand) - then - dt.print("Command hugin failed ...") - end - -end - --- Register -dt.register_storage("module_hugin", "Hugin Panorama", show_status, create_panorama) - --- --- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua +--[[ + 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 . +]] + +--[[ +HUGIN +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 + +USAGE +* require this file from your main luarc config file. + +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}) + +local function checkIfBinExists(bin) + local handle = io.popen("which "..bin) + local result = handle:read() + local ret + handle:close() + if (result) then + dt.print_error("true checkIfBinExists: "..bin) + ret = true + else + dt.print_error(bin.." not found") + ret = false + end + + + return ret +end + +local function show_status(storage, image, format, filename, + number, total, high_quality, extra_data) + dt.print("Export to Hugin "..tostring(number).."/"..tostring(total)) +end + +local function create_panorama(storage, image_table, extra_data) --finalize + if not checkIfBinExists("hugin") then + darktable.print_error("hugin not found") + return + end + +-- Since Hugin 2015.0.0 hugin provides a command line tool to start the assistant +-- http://wiki.panotools.org/Hugin_executor +-- We need pto_gen to create pto file for hugin_executor +-- http://hugin.sourceforge.net/docs/manual/Pto_gen.html + + local hugin_executor = false + if (checkIfBinExists("hugin_executor") and checkIfBinExists("pto_gen")) then + hugin_executor = true + end + + -- list of exported images + local img_list + + -- reset and create image list + img_list = "" + + for _,v in pairs(image_table) do + img_list = img_list ..v.. " " + end + + dt.print("Will try to stitch now") + + local huginStartCommand + if (hugin_executor) then + huginStartCommand = "pto_gen "..img_list.." -o "..dt.configuration.tmp_dir.."/project.pto" + dt.print("Creating pto file") + coroutine.yield("RUN_COMMAND", huginStartCommand) + + dt.print("Running Assistent") + huginStartCommand = "hugin_executor --assistant "..dt.configuration.tmp_dir.."/project.pto" + coroutine.yield("RUN_COMMAND", huginStartCommand) + + huginStartCommand = "hugin "..dt.configuration.tmp_dir.."/project.pto" + else + huginStartCommand = "hugin "..img_list + end + + dt.print_error(huginStartCommand) + + if coroutine.yield("RUN_COMMAND", huginStartCommand) + then + dt.print("Command hugin failed ...") + end + +end + +-- Register +dt.register_storage("module_hugin", "Hugin Panorama", show_status, create_panorama) + +-- +-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua diff --git a/contrib/kml_export.lua b/contrib/kml_export.lua index fc6a804..da3c2d4 100644 --- a/contrib/kml_export.lua +++ b/contrib/kml_export.lua @@ -18,7 +18,7 @@ --[[ darktable KML export script -ADDITIANAL SOFTWARE NEEDED FOR THIS SCRIPT +ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT * mkdir * zip (only if you create KMZ files) * convert (ImageMagick) @@ -26,7 +26,7 @@ ADDITIANAL SOFTWARE NEEDED FOR THIS SCRIPT * xdg-user-dir WARNING -This script is only testet with Linux +This script is only tested with Linux USAGE * require this script from your main lua file diff --git a/contrib/preferenceExamples.lua b/contrib/preferenceExamples.lua index 18a6553..34117e6 100644 --- a/contrib/preferenceExamples.lua +++ b/contrib/preferenceExamples.lua @@ -16,7 +16,7 @@ along with this program. If not, see . ]] --[[ -darktable script to show the different prefference types that are possible with the Lua +darktable script to show the different preference types that are possible with Lua USAGE * require this script from your main lua file diff --git a/contrib/rate_group.lua b/contrib/rate_group.lua new file mode 100644 index 0000000..b6b7a75 --- /dev/null +++ b/contrib/rate_group.lua @@ -0,0 +1,84 @@ +--[[ + + Rate Group: + + Script to provide shortcuts for rating or rejecting all images within a group; + particularly useful for RAW+JPEG shooters employing a star rating workflow + like the below: + + http://blog.chasejarvis.com/blog/2011/03/photo-editing-101/ + + + Installation and usage: + + 1. Copy this file into ~/.config/darktable/lua/ + + 2. Add `require "rate_group"` to new line in ~/.config/darktable/luarc + + 3. Restart darktable + + 4. Assign a keyboard shortcut to each action via settings > shortcuts > lua + + I use the following shortcuts: + + * Reject group: Ctrl+R + * Rate group 1: Ctrl+1 + * Rate group 2: Ctrl+2 + * Rate group 3: Ctrl+3 + * Rate group 4: Ctrl+4 + * Rate group 5: Ctrl+5 + * Rate group 0: Ctrl+0 + + + Author: Dom H (dom@hxy.io) + License: GPLv2 + + This script is based on Thibault Jouannic's `reject_group` script: + http://redmine.darktable.org/issues/8968#note-20 + +]] + +local dt = require "darktable" + +local function apply_rating(rating) + local images = dt.gui.action_images + for _, i in ipairs(images) do + local members = i:get_group_members() + for _, m in ipairs(members) do + m.rating = rating + end + end + if rating < 0 then + dt.print("rejecting group(s)") + else + dt.print("applying rating " ..rating.. " to group(s)") + end +end + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(-1) +end, "Reject group") + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(0) +end, "Rate group 0") + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(1) +end, "Rate group 1") + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(2) +end, "Rate group 2") + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(3) +end, "Rate group 3") + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(4) +end, "Rate group 4") + +dt.register_event("shortcut",function(event, shortcut) + apply_rating(5) +end, "Rate group 5") \ No newline at end of file diff --git a/contrib/video_mencoder.lua b/contrib/video_mencoder.lua index e0ba2b6..8198780 100644 --- a/contrib/video_mencoder.lua +++ b/contrib/video_mencoder.lua @@ -1,120 +1,120 @@ ---[[ - This file is part of darktable, - Copyright 2014 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 - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program 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 this program. If not, see . -]] ---[[ -darktable video export script - -ADDITIANAL SOFTWARE NEEDED FOR THIS SCRIPT -* mencoder (MEncoder is from the MPlayer Team) -* xdg-open -* xdg-user-dir - -WARNING -This script is only testet with Linux - -USAGE -* require this script from your main lua file -]] - -local dt = require "darktable" -dt.configuration.check_version(...,{2,0,1}) - -local function show_status(storage, image, format, filename, number, total, high_quality, extra_data) - dt.print("Export Image "..tostring(number).."/"..tostring(total)) -end - -local function checkIfBinExists(bin) - local handle = io.popen("which "..bin) - local result = handle:read() - local ret - handle:close() - if (result) then - --dt.print_error("true checkIfBinExists: "..bin) - ret = true - else - dt.print_error(bin.." not found") - ret = false - end - - return ret -end - -local function create_video_mencoder(storage, image_table, extra_data) - if not checkIfBinExists("mencoder") then - return - end - if not checkIfBinExists("xdg-open") then - return - end - if not checkIfBinExists("xdg-user-dir") then - return - end - - exportDirectory = dt.preferences.read("video_mencoder","ExportDirectory","string") - exportFilename = "output.avi" - framsePerSecond = dt.preferences.read("video_mencoder","FramesPerSecond","integer") - - dt.print_error("Will try to create video now") - -- Set the codec - local codec = "" - local codecPreferences = "" - - codecPreferences = dt.preferences.read("video_mencoder","Codec","string") - if (codecPreferences == "H.264 encoding") then - codec = 'x264' - end - if (codecPreferences == "XviD encoding") then - codec = 'xvid' - end - if not codecPreferences then - codec = 'x264' - end - - -- Create the command - local command = "mencoder -idx -nosound -noskip -ovc "..codec.." -lavcopts vcodec=mjpeg -o "..exportDirectory.."/"..exportFilename.." -mf fps="..framsePerSecond .." mf://" - - for _,v in pairs(image_table) do - command = command..v.."," - end - - dt.print_error("this is the command: "..command) - -- USE coroutine.yield. It does not block the UI - coroutine.yield("RUN_COMMAND", command) - - dt.print("Video created in "..exportDirectory) - - if ( dt.preferences.read("video_mencoder","OpenVideo","bool") == true ) then - -- USE coroutine.yield. It does not block the UI - local playVideoCommand = "xdg-open "..exportDirectory.."/"..exportFilename - coroutine.yield("RUN_COMMAND", playVideoCommand) - end -end - --- Preferences -dt.preferences.register("video_mencoder", "FramesPerSecond", "float", "Video exort (MEncoder): Frames per second", "Frames per Second in the Video export", 15, 1, 99, 0.1 ) -dt.preferences.register("video_mencoder", "OpenVideo", "bool", "Video exort (MEncoder): Open video after export", "Opens the Video after the export with the standard video player", false ) - -local handle = io.popen("xdg-user-dir VIDEOS") -local result = handle:read() -handle:close() -dt.preferences.register("video_mencoder", "ExportDirectory", "directory", "Video exort (MEncoder): Video export directory","A directory that will be used to export a Video",result) - --- Get the MEncoder codec list with: mencoder -ovc help -dt.preferences.register("video_mencoder", "Codec", "enum", "Video exort (MEncoder): Codec","Video codec","H.264 encoding","H.264 encoding","XviD encoding") - --- Register -dt.register_storage("video_mencoder", "Video Export (MEncoder)", show_status, create_video) +--[[ + This file is part of darktable, + Copyright 2014 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 + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 this program. If not, see . +]] +--[[ +darktable video export script + +ADDITIONAL SOFTWARE NEEDED FOR THIS SCRIPT +* mencoder (MEncoder is from the MPlayer Team) +* xdg-open +* xdg-user-dir + +WARNING +This script is only tested with Linux + +USAGE +* require this script from your main lua file +]] + +local dt = require "darktable" +dt.configuration.check_version(...,{2,0,1}) + +local function show_status(storage, image, format, filename, number, total, high_quality, extra_data) + dt.print("Export Image "..tostring(number).."/"..tostring(total)) +end + +local function checkIfBinExists(bin) + local handle = io.popen("which "..bin) + local result = handle:read() + local ret + handle:close() + if (result) then + --dt.print_error("true checkIfBinExists: "..bin) + ret = true + else + dt.print_error(bin.." not found") + ret = false + end + + return ret +end + +local function create_video_mencoder(storage, image_table, extra_data) + if not checkIfBinExists("mencoder") then + return + end + if not checkIfBinExists("xdg-open") then + return + end + if not checkIfBinExists("xdg-user-dir") then + return + end + + exportDirectory = dt.preferences.read("video_mencoder","ExportDirectory","string") + exportFilename = "output.avi" + framsePerSecond = dt.preferences.read("video_mencoder","FramesPerSecond","integer") + + dt.print_error("Will try to create video now") + -- Set the codec + local codec = "" + local codecPreferences = "" + + codecPreferences = dt.preferences.read("video_mencoder","Codec","string") + if (codecPreferences == "H.264 encoding") then + codec = 'x264' + end + if (codecPreferences == "XviD encoding") then + codec = 'xvid' + end + if not codecPreferences then + codec = 'x264' + end + + -- Create the command + local command = "mencoder -idx -nosound -noskip -ovc "..codec.." -lavcopts vcodec=mjpeg -o "..exportDirectory.."/"..exportFilename.." -mf fps="..framsePerSecond .." mf://" + + for _,v in pairs(image_table) do + command = command..v.."," + end + + dt.print_error("this is the command: "..command) + -- USE coroutine.yield. It does not block the UI + coroutine.yield("RUN_COMMAND", command) + + dt.print("Video created in "..exportDirectory) + + if ( dt.preferences.read("video_mencoder","OpenVideo","bool") == true ) then + -- USE coroutine.yield. It does not block the UI + local playVideoCommand = "xdg-open "..exportDirectory.."/"..exportFilename + coroutine.yield("RUN_COMMAND", playVideoCommand) + end +end + +-- Preferences +dt.preferences.register("video_mencoder", "FramesPerSecond", "float", "Video exort (MEncoder): Frames per second", "Frames per Second in the Video export", 15, 1, 99, 0.1 ) +dt.preferences.register("video_mencoder", "OpenVideo", "bool", "Video exort (MEncoder): Open video after export", "Opens the Video after the export with the standard video player", false ) + +local handle = io.popen("xdg-user-dir VIDEOS") +local result = handle:read() +handle:close() +dt.preferences.register("video_mencoder", "ExportDirectory", "directory", "Video exort (MEncoder): Video export directory","A directory that will be used to export a Video",result) + +-- Get the MEncoder codec list with: mencoder -ovc help +dt.preferences.register("video_mencoder", "Codec", "enum", "Video exort (MEncoder): Codec","Video codec","H.264 encoding","H.264 encoding","XviD encoding") + +-- Register +dt.register_storage("video_mencoder", "Video Export (MEncoder)", show_status, create_video) diff --git a/official/check_for_updates.lua b/official/check_for_updates.lua new file mode 100644 index 0000000..659bc28 --- /dev/null +++ b/official/check_for_updates.lua @@ -0,0 +1,135 @@ +--[[ + This file is part of darktable, + copyright (c) 2015 Tobias Ellinghaus + + 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 . +]] +--[[ +CHECK FOR UPDATES +a simple script that will automatically look for newer releases on github and inform +when there is something. it will only check on startup and only once a week. + +USAGE +* install luasec and cjson for Lua 5.2 on your system +* require this script from your main lua file +* restart darktable + +]] + +local dt = require "darktable" +local https = require "ssl.https" +local cjson = require "cjson" + +dt.configuration.check_version(...,{2,0,0}) + +-- compare two version strings of the form "major.minor.patch" +-- returns -1, 0, 1 if the first version is smaller, equal, greater than the second version, +-- or nil if one or both are of the wrong format +-- strings like "release-1.2.3" and "1.2.3+456~gb00b5" are fine, too +local function parse_version(s) + local rc = 0 + local major, minor, patch = s:match("(%d+)%.(%d+)%.(%d+)") + if not major then + patch = 0 + major, minor, rc = s:match("(%d+)%.(%d+)rc(%d+)") + end + if not major then + patch = 0 + rc = 0 + major, minor = s:match("(%d+)%.(%d+)") + end + return tonumber(major), tonumber(minor), tonumber(patch), tonumber(rc) +end + +local function compare_versions(a, b) + local a_major, a_minor, a_patch, a_rc = parse_version(a) + local b_major, b_minor, b_patch, b_rc = parse_version(b) + + if a_major and a_minor and a_patch and b_major and b_minor and b_patch then + if a_major < b_major then return -1 end + if a_major > b_major then return 1 end + + if a_minor < b_minor then return -1 end + if a_minor > b_minor then return 1 end + + if a_patch < b_patch then return -1 end + if a_patch > b_patch then return 1 end + + -- when rc == 0 then it's a proper release and newer than the rcs + local m = math.max(a_rc, b_rc) + 1 + if a_rc == 0 then a_rc = m end + if b_rc == 0 then b_rc = m end + if a_rc < b_rc then return -1 end + if a_rc > b_rc then return 1 end + + return 0 + else + return + end +end + + +-- local function test(a, b, r) +-- local cmp = compare_versions(a, b) +-- if(not cmp) then +-- print(a .. " ./. " .. b .. " => MALFORMED INPUT") +-- elseif(cmp == r) then +-- print(a .. " ./. " .. b .. " => PASSED") +-- else +-- print(a .. " ./. " .. b .. " => FAILED") +-- end +-- end +-- +-- test("malformed", "1.0.0", 0) +-- test("2.0rc1+135~ge456b2b-dirty", "release-1.6.9", 1) +-- test("release-1.6.9", "2.0rc1+135~ge456b2b-dirty", -1) +-- test("2.0rc1+135~ge456b2b-dirty", "2.0rc2+135~ge456b2b-dirty", -1) +-- test("2.0rc2+135~ge456b2b-dirty", "2.0rc1+135~ge456b2b-dirty", 1) +-- test("2.0rc3+135~ge456b2b-dirty", "release-2.0", -1) +-- test("2.0rc3+135~ge456b2b-dirty", "release-2.0.0", -1) +-- test("1.0.0", "2.0.0", -1) +-- test("2.0.0", "1.0.0", 1) +-- test("3.0.0", "3.0.0", 0) + + +-- check stored timestamp and skip the check if the last time was not too long ago +-- for now we are assuming that os.time() returns seconds. that's not guaranteed but the case on many systems. +-- the reference date doesn't matter, as long as it's currently positive (we start with 0 the first time) +-- see http://lua-users.org/wiki/DateAndTime +local now = os.time() +local back_then = dt.preferences.read("check_for_updates", "timestamp", "integer") + +-- check once a week +if now > (back_then + 60 * 60 * 24 * 7) then + + -- try to get the latest release's version from github and compare to what we are running + -- see https://developer.github.com/v3/repos/releases/ for the api docs + -- just ignore when anything fails and retry at some other time + local result, error_code = https.request("https://api.github.com/repos/darktable-org/darktable/releases/latest") + + if error_code == 200 then + local name = cjson.decode(result)["name"] -- http://www.kyne.com.au/~mark/software/lua-cjson-manual.html + if name then + local cmp = compare_versions(name, dt.configuration.version) + if cmp then + if cmp > 0 then + dt.print("there seems to be a newer release than what you are running. better update") + end + -- update timestamp to not check again for a while + dt.preferences.write("check_for_updates", "timestamp", "integer", now) + end + end + end + +end diff --git a/official/image_path_in_ui.lua b/official/image_path_in_ui.lua index 7026bfb..ba93d2d 100644 --- a/official/image_path_in_ui.lua +++ b/official/image_path_in_ui.lua @@ -1,17 +1,17 @@ --[[ This file is part of darktable, copyright (c) 2014 Jérémy Rosen - + 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 . ]] @@ -31,9 +31,9 @@ This plugin will add a widget at the bottom of the left column in lighttable mod local dt = require "darktable" dt.configuration.check_version(...,{2,0,0}) -local main_label = dt.new_widget("label"){selectable = true} +local main_label = dt.new_widget("label"){selectable = true, ellipsize = "middle", halign = "start"} -local function reset_widget() +local function reset_widget() local selection = dt.gui.selection() local result = "" local array = {} diff --git a/official/import_filters.lua b/official/import_filters.lua index 5980a72..e3d595c 100644 --- a/official/import_filters.lua +++ b/official/import_filters.lua @@ -50,6 +50,7 @@ dt.register_import_filter("prefer raw over jpeg", function(event, images) local current_base = "" local jpg_indices = {} local other_format_found = false + table.insert(images, "") for i, img in ipairs(images) do local extension = img:match("[^.]*$"):upper() local base = img:match("^.*[.]") @@ -74,6 +75,7 @@ dt.register_import_filter("prefer raw over jpeg", function(event, images) end end + table.remove(images) end) -- vim: shiftwidth=2 expandtab tabstop=2 cindent