Skip to content

Commit d4a0341

Browse files
committed
Refactoring without new funktion
Created two new local functions (show_status, create_panorama) to make the code more readable.
1 parent 3033c52 commit d4a0341

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

contrib/hugin.lua

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,32 @@ dt = require "darktable"
3737
-- should work with darktable API version 2.0.0
3838
dt.configuration.check_version(...,{2,0,0})
3939

40-
dt.register_storage("module_hugin","Hugin panorama",
41-
function(storage, image, format, filename,
42-
number,total,high_quality,extra_data)
43-
dt.print("Export to hugin " .. tostring(number).."/"..tostring(total))
44-
end,
45-
function(storage,image_table,extra_data) --finalize
46-
-- list of exported images
47-
local img_list
40+
-- Register
41+
dt.register_storage("module_hugin", "Hugin panorama", show_status, create_panorama, nil, nil)
42+
43+
local function show_status(storage, image, format, filename,
44+
number, total, high_quality, extra_data)
45+
dt.print("Export to hugin "..tostring(number).."/"..tostring(total))
46+
end
47+
48+
local function create_panorama(storage, image_table, extra_data) --finalize
49+
-- list of exported images
50+
local img_list
51+
52+
-- reset and create image list
53+
img_list = ""
4854

49-
-- reset and create image list
50-
img_list = ""
51-
52-
for _,v in pairs(image_table) do
53-
img_list = img_list ..v.. " "
54-
end
55-
56-
dt.print("Will try to stitch now")
57-
58-
if coroutine.yield("RUN_COMMAND","hugin "..img_list)
59-
then
60-
dt.print("Command hugin failed ...")
61-
end
62-
63-
end,
64-
nil,
65-
nil
66-
)
55+
for _,v in pairs(image_table) do
56+
img_list = img_list ..v.. " "
57+
end
58+
59+
dt.print("Will try to stitch now")
60+
61+
if coroutine.yield("RUN_COMMAND","hugin "..img_list)
62+
then
63+
dt.print("Command hugin failed ...")
64+
end
65+
end
6766

6867
--
6968
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua

0 commit comments

Comments
 (0)