diff --git a/howdy/src/cli/add.py b/howdy/src/cli/add.py index ab58cc7..fbfe97d 100644 --- a/howdy/src/cli/add.py +++ b/howdy/src/cli/add.py @@ -8,7 +8,6 @@ import json import configparser import builtins import numpy as np -import paths import paths_factory from recorders.video_capture import VideoCapture @@ -31,7 +30,7 @@ import cv2 # Test if at lest 1 of the data files is there and abort if it's not if not os.path.isfile(paths_factory.shape_predictor_5_face_landmarks_path()): print(_("Data files have not been downloaded, please run the following commands:")) - print("\n\tcd " + str(paths.dlib_data_dir)) + print("\n\tcd " + paths_factory.dlib_data_dir_path()) print("\tsudo ./install.sh\n") sys.exit(1) @@ -55,9 +54,9 @@ enc_file = str(paths_factory.user_model_path(user)) encodings = [] # Make the ./models folder if it doesn't already exist -if not os.path.exists(paths.user_models_dir): +if not os.path.exists(paths_factory.user_models_dir_path()): print(_("No face model folder found, creating one")) - os.makedirs(paths.user_models_dir) + os.makedirs(paths_factory.user_models_dir_path()) # To try read a premade encodings file if it exists try: diff --git a/howdy/src/cli/clear.py b/howdy/src/cli/clear.py index 2949eef..64941ba 100644 --- a/howdy/src/cli/clear.py +++ b/howdy/src/cli/clear.py @@ -4,7 +4,6 @@ import os import sys import builtins -import paths import paths_factory from i18n import _ @@ -13,7 +12,7 @@ from i18n import _ user = builtins.howdy_user # Check if the models folder is there -if not os.path.exists(paths.user_models_dir): +if not os.path.exists(paths_factory.user_models_dir_path()): print(_("No models created yet, can't clear them if they don't exist")) sys.exit(1) diff --git a/howdy/src/cli/list.py b/howdy/src/cli/list.py index 6ed00f3..01628de 100644 --- a/howdy/src/cli/list.py +++ b/howdy/src/cli/list.py @@ -6,7 +6,6 @@ import os import json import time import builtins -import paths import paths_factory from i18n import _ @@ -14,7 +13,7 @@ from i18n import _ user = builtins.howdy_user # Check if the models file has been created yet -if not os.path.exists(paths.user_models_dir): +if not os.path.exists(paths_factory.user_models_dir_path()): print(_("Face models have not been initialized yet, please run:")) print("\n\tsudo howdy -U " + user + " add\n") sys.exit(1) diff --git a/howdy/src/cli/remove.py b/howdy/src/cli/remove.py index 595dfc6..cec96c7 100644 --- a/howdy/src/cli/remove.py +++ b/howdy/src/cli/remove.py @@ -5,7 +5,6 @@ import sys import os import json import builtins -import paths import paths_factory from i18n import _ @@ -22,7 +21,7 @@ if not builtins.howdy_args.arguments: sys.exit(1) # Check if the models file has been created yet -if not os.path.exists(paths.user_models_dir): +if not os.path.exists(paths_factory.user_models_dir_path()): print(_("Face models have not been initialized yet, please run:")) print("\n\thowdy add\n") sys.exit(1) diff --git a/howdy/src/compare.py b/howdy/src/compare.py index 747414a..ccc4a40 100644 --- a/howdy/src/compare.py +++ b/howdy/src/compare.py @@ -23,7 +23,6 @@ import subprocess import snapshot import numpy as np import _thread as thread -import paths import paths_factory from recorders.video_capture import VideoCapture from i18n import _ @@ -48,7 +47,7 @@ def init_detector(lock): # Test if at lest 1 of the data files is there and abort if it's not if not os.path.isfile(str(paths_factory.shape_predictor_5_face_landmarks_path())): print(_("Data files have not been downloaded, please run the following commands:")) - print("\n\tcd " + str(paths.dlib_data_dir)) + print("\n\tcd " + paths_factory.dlib_data_dir_path()) print("\tsudo ./install.sh\n") lock.release() exit(1) diff --git a/howdy/src/paths_factory.py b/howdy/src/paths_factory.py index 63a9b4b..0995243 100644 --- a/howdy/src/paths_factory.py +++ b/howdy/src/paths_factory.py @@ -8,32 +8,41 @@ models = [ ] -def shape_predictor_5_face_landmarks_path() -> PurePath: - return paths.dlib_data_dir / models[0] +def dlib_data_dir_path() -> str: + return str(paths.dlib_data_dir) -def mmod_human_face_detector_path() -> PurePath: - return paths.dlib_data_dir / models[1] +def shape_predictor_5_face_landmarks_path() -> str: + return str(paths.dlib_data_dir / models[0]) -def dlib_face_recognition_resnet_model_v1_path() -> PurePath: - return paths.dlib_data_dir / models[2] +def mmod_human_face_detector_path() -> str: + return str(paths.dlib_data_dir / models[1]) -def user_model_path(user: str) -> PurePath: - return paths.user_models_dir / f"{user}.dat" +def dlib_face_recognition_resnet_model_v1_path() -> str: + return str(paths.dlib_data_dir / models[2]) -def config_file_path() -> PurePath: - return paths.config_dir / "config.ini" +def user_model_path(user: str) -> str: + return str(paths.user_models_dir / f"{user}.dat") + + +def config_file_path() -> str: + return str(paths.config_dir / "config.ini") def snapshots_dir_path() -> PurePath: return paths.log_path / "snapshots" -def snapshot_path(snapshot: str) -> PurePath: - return snapshots_dir_path() / snapshot +def snapshot_path(snapshot: str) -> str: + return str(snapshots_dir_path() / snapshot) -def logo_path() -> PurePath: - return paths.data_dir / "logo.png" + +def user_models_dir_path() -> str: + return str(paths.user_models_dir) + + +def logo_path() -> str: + return str(paths.data_dir / "logo.png")