From a458d5c991616e156788007261183fc431f0ae91 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Wed, 18 Feb 2015 21:19:51 +0100 Subject: [PATCH] cr2hdr: Show progress bar (job). Also add script description. --- contrib/cr2hdr.lua | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/contrib/cr2hdr.lua b/contrib/cr2hdr.lua index 9a5d1ba..8f133dc 100644 --- a/contrib/cr2hdr.lua +++ b/contrib/cr2hdr.lua @@ -15,9 +15,16 @@ along with this program. If not, see . ]] --[[ -cr2hdr … +cr2hdr Magic Lantern Dual ISO processing. -This script … +This script automates the steps involved to process an image created +with the Magic Lantern Dual ISO module. Upon invoking the script with a +shortcut "cr2hdr" provided by Magic Lantern is run on the selected +images. The processed files are imported. They are also made group +leaders to hide the original files. + +ADDITIANAL SOFTWARE NEEDED FOR THIS SCRIPT +* cr2hdr (sources can be obtained through the Magic Lantern repository) USAGE * require this script from your main lua file @@ -30,6 +37,7 @@ local darktable = require "darktable" darktable.configuration.check_version(...,{2,0,2}) local processed_files = {} +local job function file_imported(event, image) local filename = image.path .. "/" .. image.filename @@ -39,6 +47,10 @@ function file_imported(event, image) end end +function stop_conversion(job) + job.valid = false +end + -- Source: http://lua-users.org/wiki/SplitJoin function lines(str) local t = {} @@ -69,10 +81,17 @@ function convert_image(image) end function convert_action_images(shortcut) + job = darktable.gui.create_job("Dual ISO conversion", true, stop_conversion) local images = darktable.gui.action_images - for _,image in pairs(images) do - convert_image(image) + for key,image in pairs(images) do + if job.valid then + job.percent = (key-1)/#images + convert_image(image) + else + return + end end + job.valid = false end darktable.register_event("shortcut", convert_action_images, "Run cr2hdr (Magic Lantern DualISO converter) on ... images")