plug-ins: update darktable lua script to API change in darktable master

The Lua API is undergoing changes in darktable master. I've fixed the lua-scripts repository as I've made
changes, but I forgot about the collateral damage.

Attached is a fixed version of file-darktable-export-on-exit.lua which should be good for darktable 3.6 and
beyond.

Fixes #6421
This commit is contained in:
William Ferguson 2021-02-10 21:44:54 +01:00 committed by Jehan
parent 09bce474b1
commit 636eb02edc
1 changed files with 21 additions and 1 deletions

View File

@ -31,6 +31,24 @@ USAGE
local dt = require "darktable"
local orig_register_event = dt.register_event
function dt.register_event(name, event, func, label)
if dt.configuration.api_version_string >= "6.2.1" then
if label then
orig_register_event(name, event, func, label)
else
orig_register_event(name, event, func)
end
else
if label then
orig_register_event(event, func, label)
else
orig_register_event(event, func)
end
end
end
local min_api_version = "2.1.0"
if dt.configuration.api_version_string < min_api_version then
dt.print("the exit export script requires at least darktable version 1.7.0")
@ -40,9 +58,11 @@ else
dt.print("closing darktable will export the image and make GIMP load it")
end
local CURR_API_STRING = dt.configuration.api_version_string
local export_filename = dt.preferences.read("export_on_exit", "export_filename", "string")
dt.register_event("exit", function()
dt.register_event("fileraw", "exit", function()
-- safegurad against someone using this with their library containing 50k images
if #dt.database > 1 then
dt.print_error("too many images, only exporting the first")