Skip to content

Commit 1d1eb6a

Browse files
committed
fujifilm-dynamic-range: remove translations, use full exiftool path
Suggestions as per @wpferguson: "We came to a decision a while ago to not translate debug messages(i.e. print_log() and print_error()) because the author might not be able to read the output if it was a language they weren't familiar with. So the only thing we translate are labels, tooltips, and dt.print() messages." "df.check_if_bin_exists() returns the full path to the executable. Using the returned value would let the script run on windows and macos too."
1 parent a9fd071 commit 1d1eb6a

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

contrib/fujifilm_dynamic_range.lua

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,38 @@ cameras may behave in other ways.
6060
local dt = require "darktable"
6161
local du = require "lib/dtutils"
6262
local df = require "lib/dtutils.file"
63-
local gettext = dt.gettext
6463

6564
du.check_min_api_version("4.0.0", "fujifilm_dynamic_range")
6665

67-
gettext.bindtextdomain("fujifilm_dynamic_range", dt.configuration.config_dir.."/lua/locale/")
68-
69-
local function _(msgid)
70-
return gettext.dgettext("fujifilm_dynamic_range", msgid)
71-
end
72-
7366
local function detect_dynamic_range(event, image)
7467
if image.exif_maker ~= "FUJIFILM" then
75-
dt.print_log(_("[fujifilm_dynamic_range] ignoring non-Fujifilm image"))
68+
dt.print_log("[fujifilm_dynamic_range] ignoring non-Fujifilm image")
7669
return
7770
end
7871
-- it would be nice to check image.is_raw but this appears to not yet be set
7972
if not string.match(image.filename, "%.RAF$") then
80-
dt.print_log(_("[fujifilm_dynamic_range] ignoring non-raw image"))
73+
dt.print_log("[fujifilm_dynamic_range] ignoring non-raw image")
8174
return
8275
end
83-
if not df.check_if_bin_exists("exiftool") then
84-
dt.print_error(_("[fujifilm_dynamic_range] exiftool not found"))
76+
local command = df.check_if_bin_exists("exiftool")
77+
if not command then
78+
dt.print_error("[fujifilm_dynamic_range] exiftool not found")
8579
return
8680
end
8781
local RAF_filename = df.sanitize_filename(tostring(image))
8882
-- without -n flag, exiftool will round to the nearest tenth
89-
local command = "exiftool -RawExposureBias -n -t " .. RAF_filename
83+
command = command .. " -RawExposureBias -n -t " .. RAF_filename
9084
dt.print_log(command)
9185
output = io.popen(command)
9286
local raf_result = output:read("*all")
9387
output:close()
9488
if #raf_result == 0 then
95-
dt.print_error(_("[fujifilm_dynamic_range] no output returned by exiftool"))
89+
dt.print_error("[fujifilm_dynamic_range] no output returned by exiftool")
9690
return
9791
end
9892
raf_result = string.match(raf_result, "\t(.*)")
9993
if not raf_result then
100-
dt.print_error(_("[fujifilm_dynamic_range] could not parse exiftool output"))
94+
dt.print_error("[fujifilm_dynamic_range] could not parse exiftool output")
10195
return
10296
end
10397
if image.exif_exposure_bias ~= image.exif_exposure_bias then
@@ -107,9 +101,9 @@ local function detect_dynamic_range(event, image)
107101
-- this should be auto-applied if plugins/darkroom/workflow is scene-referred
108102
-- note that scene-referred workflow exposure preset also pushes exposure up by 0.5 EV
109103
image.exif_exposure_bias = image.exif_exposure_bias + tonumber(raf_result)
110-
dt.print_log(_("[fujifilm_dynamic_range] raw exposure bias ") .. tostring(raf_result))
104+
dt.print_log("[fujifilm_dynamic_range] raw exposure bias " .. tostring(raf_result))
111105
end
112106

113107
dt.register_event("post-import-image", detect_dynamic_range)
114108

115-
dt.print_log(_("[fujifilm_dynamic_range] loaded"))
109+
dt.print_log("[fujifilm_dynamic_range] loaded")

0 commit comments

Comments
 (0)