Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions contrib/autostyle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ script_data.show = nil -- only required for libs since the destroy_method only h
local function get_stdout(cmd)
-- Open the command, for reading
local fd = assert(io.popen(cmd, 'r'))
darktable.control.read(fd)
-- darktable.control.read(fd)
-- slurp the whole file
local data = assert(fd:read('*a'))

-- darktable.print(string.format(_("data is %s"), data))
fd:close()
-- Replace carriage returns and linefeeds with spaces
data = string.gsub(data, '[\n\r]+', ' ')
Expand All @@ -87,7 +87,7 @@ end

-- Retrieve the attribute through exiftool
local function exiftool_attribute(path, attr)
local cmd = "exiftool -" .. attr .. " '" .. path .. "'";
local cmd = "exiftool -" .. attr .. ' "' .. path .. '"';
local exifresult = get_stdout(cmd)
local attribute = string.match(exifresult, ": (.*)")
if (attribute == nil) then
Expand Down Expand Up @@ -165,7 +165,10 @@ end

-- Receive the event triggered
local function autostyle_apply_one_image_event(event,image)
autostyle_apply_one_image(image)
darktable.control.dispatch(function()
darktable.control.sleep(500)
autostyle_apply_one_image(image)
end)
end

local function autostyle_apply(shortcut)
Expand Down