Skip to content

Commit 71207e8

Browse files
committed
1 - face_recognition.lua fails to run in a fresh installation of darktable. It is due to pull request darktable-org#221 where reset_preferences() and save_preferences() are called before being defined. This is actually a expected behavior because compiles script is one pass instead of two pass (like some other languages, like C). Moving a small piece of preferences setting code to the end of file solves the issue, because all required objects and functions are defined at that point.
2 - Add some more logs
1 parent 749f5b8 commit 71207e8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

contrib/face_recognition.lua

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ local function _(msgid)
6666
return gettext.dgettext("face_recognition", msgid)
6767
end
6868

69-
-- preferences
70-
71-
if not dt.preferences.read(MODULE, "initialized", "bool") then
72-
reset_preferences()
73-
save_preferences()
74-
dt.preferences.write(MODULE, "initialized", "bool", true)
75-
end
76-
7769
local function build_image_table(images)
7870
local image_table = {}
7971
local file_extension = ""
@@ -242,7 +234,10 @@ local function face_recognition ()
242234

243235
-- Get path of exported images
244236
local path = df.get_path (img_list[1])
237+
dt.print_log ("Face recognition: Path to known faces: " .. knownPath)
245238
dt.print_log ("Face recognition: Path to unknown images: " .. path)
239+
dt.print_log ("Face recognition: Tag used for unknown faces: " .. unknownTag)
240+
dt.print_log ("Face recognition: Tag used if non person is found: " .. nonpersonsfoundTag)
246241
os.setlocale("C")
247242
local tolerance = dt.preferences.read(MODULE, "tolerance", "float")
248243

@@ -470,5 +465,13 @@ dt.register_lib(
470465

471466
fc.tolerance.value = dt.preferences.read(MODULE, "tolerance", "float")
472467

468+
-- preferences
469+
470+
if not dt.preferences.read(MODULE, "initialized", "bool") then
471+
reset_preferences()
472+
save_preferences()
473+
dt.preferences.write(MODULE, "initialized", "bool", true)
474+
end
475+
473476
--
474477
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua

0 commit comments

Comments
 (0)