From 77c405882d9cca8f68163c67eca6b8ebad067922 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotowicz Date: Tue, 3 Dec 2024 19:49:54 +0100 Subject: [PATCH] Added logging code and a workaround for https://github.com/darktable-org/darktable/issues/17528 in 9.4.0. --- .DS_Store | Bin 0 -> 6148 bytes contrib/ultrahdr.lua | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c6f7696114afdb45c3563536fccffc402bfedec9 GIT binary patch literal 6148 zcmeHKJ8DBQ5S&d6F}QJ=Qdh_ggmF&b3k2H)48{-g>0gy|< z4@cjUNdYM!1*Cu!kOCK0pbG4Kap7}yoD`4(*ROzo9~#}U7mkVX>EIA80CC1}80XPT z5Ss^xy>Luqgl0)4Ce^CNu%t8IDz6ugiAjf5^I>(fRfl46JI`;C4(o{;rGOMTSKv06 zORxWr^k4e_bCOn4KnnaT1#Gt7tXF(e)z-=5yw*1Q6Wwz@>290{g+r8MVw7Vpyd2+0 cQsy 0 then return nil, errors end @@ -288,6 +309,7 @@ local function get_dimensions(image) end local function get_stacks(images, encoding_variant, selection_type) + local old_log_level = set_log_level(LOG_LEVEL) local stacks = {} local primary = "sdr" local extra @@ -356,6 +378,7 @@ local function get_stacks(images, encoding_variant, selection_type) count = count + 1 end end + restore_log_level(old_log_level) return stacks, count end @@ -374,6 +397,7 @@ local function file_size(path) end local function generate_ultrahdr(encoding_variant, images, settings, step, total_steps) + local old_log_level = set_log_level(LOG_LEVEL) local total_substeps local substep = 0 local best_source_image @@ -402,6 +426,8 @@ local function generate_ultrahdr(encoding_variant, images, settings, step, total end function copy_or_export(src_image, dest, format, colorspace, props) + -- Workaround for https://github.com/darktable-org/darktable/issues/17528 + local needs_workaround = dt.configuration.api_version_string == "9.3.0" or dt.configuration.api_version_string == "9.4.0" if not settings.force_export and df.get_filetype(src_image.filename) == df.get_filetype(dest) and not src_image.is_altered then return df.file_copy(src_image.path .. PS .. src_image.filename, dest) @@ -415,11 +441,10 @@ local function generate_ultrahdr(encoding_variant, images, settings, step, total exporter[k] = v end local ok = exporter:write_image(src_image, dest) - if dt.configuration.api_version_string == "9.3.0" then - -- Workaround for https://github.com/darktable-org/darktable/issues/17528 + if needs_workaround then ok = not ok end - + log.msg(log.info, string.format("Exporting %s to %s (format: %s): %s", src_image.filename, dest, format, ok)) if prev then set_profile(prev) end @@ -695,10 +720,12 @@ local function generate_ultrahdr(encoding_variant, images, settings, step, total local msg = string.format(_("Generated %s."), df.get_filename(output_file)) log.msg(log.info, msg) dt.print(msg) + restore_log_level(old_log_level) return true, nil end local function main() + local old_log_level = set_log_level(LOG_LEVEL) save_preferences() local selection_type = GUI.optionwidgets.selection_type_combo.selected @@ -741,6 +768,7 @@ local function main() msg = string.format(_("Generated %d UltraHDR image(s)."), count) log.msg(log.info, msg) dt.print(msg) + restore_log_level(old_log_level) end GUI.optionwidgets.settings_label = dt.new_widget("section_label") {