From 71207e8f57cb59e1e75b52d363b559cb72986938 Mon Sep 17 00:00:00 2001 From: Piter Dias Date: Sat, 25 Apr 2020 19:57:14 -0300 Subject: [PATCH] 1 - face_recognition.lua fails to run in a fresh installation of darktable. It is due to pull request #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 --- contrib/face_recognition.lua | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/contrib/face_recognition.lua b/contrib/face_recognition.lua index de98f0b..449b399 100644 --- a/contrib/face_recognition.lua +++ b/contrib/face_recognition.lua @@ -66,14 +66,6 @@ local function _(msgid) return gettext.dgettext("face_recognition", msgid) end --- preferences - -if not dt.preferences.read(MODULE, "initialized", "bool") then - reset_preferences() - save_preferences() - dt.preferences.write(MODULE, "initialized", "bool", true) -end - local function build_image_table(images) local image_table = {} local file_extension = "" @@ -242,7 +234,10 @@ local function face_recognition () -- Get path of exported images local path = df.get_path (img_list[1]) + dt.print_log ("Face recognition: Path to known faces: " .. knownPath) dt.print_log ("Face recognition: Path to unknown images: " .. path) + dt.print_log ("Face recognition: Tag used for unknown faces: " .. unknownTag) + dt.print_log ("Face recognition: Tag used if non person is found: " .. nonpersonsfoundTag) os.setlocale("C") local tolerance = dt.preferences.read(MODULE, "tolerance", "float") @@ -470,5 +465,13 @@ dt.register_lib( fc.tolerance.value = dt.preferences.read(MODULE, "tolerance", "float") +-- preferences + +if not dt.preferences.read(MODULE, "initialized", "bool") then + reset_preferences() + save_preferences() + dt.preferences.write(MODULE, "initialized", "bool", true) +end + -- -- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua