diff --git a/howdy/src/meson.build b/howdy/src/meson.build index 9d2835a..f068fa9 100644 --- a/howdy/src/meson.build +++ b/howdy/src/meson.build @@ -6,12 +6,14 @@ py.dependency() confdir = get_option('config_dir') != '' ? get_option('config_dir') : join_paths(get_option('sysconfdir'), 'howdy') dlibdatadir = get_option('dlib_data_dir') != '' ? get_option('dlib_data_dir') : join_paths(confdir, 'dlib-data') usermodelsdir = get_option('user_models_dir') != '' ? get_option('user_models_dir') : join_paths(confdir, 'models') +datadir = get_option('data_dir') != '' ? get_option('data_dir') : join_paths(get_option('prefix'), get_option('datadir'), 'howdy') logpath = get_option('log_path') py_conf = configuration_data({ 'config_dir': confdir, 'dlib_data_dir': dlibdatadir, 'user_models_dir': usermodelsdir, + 'data_dir': datadir, 'log_path': logpath, }) diff --git a/howdy/src/meson.options b/howdy/src/meson.options index bd4318a..ef3346f 100644 --- a/howdy/src/meson.options +++ b/howdy/src/meson.options @@ -3,6 +3,7 @@ option('pam_dir', type: 'string', value: '', description: 'Set the pam_howdy des option('config_dir', type: 'string', value: '', description: 'Set the howdy config directory') option('dlib_data_dir', type: 'string', value: '', description: 'Set the dlib data directory') option('user_models_dir', type: 'string', value: '', description: 'Set the user models directory') +option('data_dir', type: 'string', value: '', description: 'Set the howdy data directory') option('log_path', type: 'string', value: '/var/log/howdy', description: 'Set the log file path') option('install_in_site_packages', type: 'boolean', value: false, description: 'Install howdy python files in site packages') option('py_sources_dir', type: 'string', value: '', description: 'Set the python sources directory') \ No newline at end of file diff --git a/howdy/src/paths.py.in b/howdy/src/paths.py.in index e51d738..68aca6c 100644 --- a/howdy/src/paths.py.in +++ b/howdy/src/paths.py.in @@ -11,3 +11,6 @@ user_models_dir = PurePath("@user_models_dir@") # Define path to any howdy logs log_path = PurePath("@log_path@") + +# Define the absolute path to the Howdy data directory +data_dir = PurePath("@data_dir@") \ No newline at end of file diff --git a/howdy/src/paths_factory.py b/howdy/src/paths_factory.py index 7a0d1ba..63a9b4b 100644 --- a/howdy/src/paths_factory.py +++ b/howdy/src/paths_factory.py @@ -34,3 +34,6 @@ def snapshots_dir_path() -> PurePath: def snapshot_path(snapshot: str) -> PurePath: return snapshots_dir_path() / snapshot + +def logo_path() -> PurePath: + return paths.data_dir / "logo.png" diff --git a/howdy/src/snapshot.py b/howdy/src/snapshot.py index c6a7abf..9e55ca0 100644 --- a/howdy/src/snapshot.py +++ b/howdy/src/snapshot.py @@ -30,7 +30,7 @@ def generate(frames, text_lines): # Add the Howdy logo if there's space to do so if len(frames) > 1: # Load the logo from file - logo = cv2.imread(core_path + "/logo.png") + logo = cv2.imread(str(paths_factory.logo_path())) # Calculate the position of the logo logo_y = frame_height + 20 logo_x = frame_width * len(frames) - 210