0
0
Fork 0
mirror of https://github.com/boltgolt/howdy.git synced 2024-09-12 09:41:18 +02:00

refactor: add data dir for logo

This commit is contained in:
Sayafdine Said 2023-06-25 16:56:44 +02:00
parent 8bc95efda6
commit d0ca17b1ec
No known key found for this signature in database
GPG key ID: 7567D43648C6E2F4
5 changed files with 10 additions and 1 deletions

View file

@ -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,
})

View file

@ -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')

View file

@ -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@")

View file

@ -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"

View file

@ -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