mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-12 09:41:18 +02:00
fix: convert to string when necessary
This commit is contained in:
parent
61222197c3
commit
8bc95efda6
9 changed files with 6 additions and 16 deletions
|
@ -31,7 +31,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 " + paths.dlib_data_dir)
|
||||
print("\n\tcd " + str(paths.dlib_data_dir))
|
||||
print("\tsudo ./install.sh\n")
|
||||
sys.exit(1)
|
||||
|
||||
|
@ -50,7 +50,7 @@ face_encoder = dlib.face_recognition_model_v1(str(paths_factory.dlib_face_recogn
|
|||
|
||||
user = builtins.howdy_user
|
||||
# The permanent file to store the encoded model in
|
||||
enc_file = paths_factory.user_model_path(user)
|
||||
enc_file = str(paths_factory.user_model_path(user))
|
||||
# Known encodings
|
||||
encodings = []
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
# Import required modules
|
||||
import os
|
||||
import subprocess
|
||||
import paths
|
||||
import paths_factory
|
||||
|
||||
from i18n import _
|
||||
|
|
|
@ -6,7 +6,6 @@ import os
|
|||
import builtins
|
||||
import fileinput
|
||||
import configparser
|
||||
import paths
|
||||
import paths_factory
|
||||
|
||||
from i18n import _
|
||||
|
|
|
@ -72,7 +72,7 @@ if not found:
|
|||
|
||||
# Remove the entire file if this encoding is the only one
|
||||
if len(encodings) == 1:
|
||||
os.remove(paths.user_models_dir / f"{user}.dat")
|
||||
os.remove(paths_factory.user_model_path(user))
|
||||
print(_("Removed last model, howdy disabled for user"))
|
||||
else:
|
||||
# A place holder to contain the encodings that will remain
|
||||
|
|
|
@ -5,7 +5,6 @@ import sys
|
|||
import os
|
||||
import builtins
|
||||
import fileinput
|
||||
import paths
|
||||
import paths_factory
|
||||
|
||||
from i18n import _
|
||||
|
|
|
@ -5,7 +5,6 @@ import os
|
|||
import configparser
|
||||
import datetime
|
||||
import snapshot
|
||||
import paths
|
||||
import paths_factory
|
||||
from recorders.video_capture import VideoCapture
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import time
|
|||
import dlib
|
||||
import cv2
|
||||
import numpy as np
|
||||
import paths
|
||||
import paths_factory
|
||||
|
||||
from i18n import _
|
||||
|
|
|
@ -25,10 +25,6 @@ import numpy as np
|
|||
import _thread as thread
|
||||
import paths
|
||||
import paths_factory
|
||||
|
||||
# Allow imports from the local howdy folder
|
||||
sys.path.append('/lib/security/howdy')
|
||||
|
||||
from recorders.video_capture import VideoCapture
|
||||
from i18n import _
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ def generate(frames, text_lines):
|
|||
if len(frames) == 0:
|
||||
return
|
||||
|
||||
# Get the path to the containing folder
|
||||
core_path = os.path.dirname(os.path.abspath(__file__))
|
||||
# Get frame dimensions
|
||||
frame_height, frame_width, cc = frames[0].shape
|
||||
# Spread the given frames out horizontally
|
||||
|
@ -56,8 +54,9 @@ def generate(frames, text_lines):
|
|||
|
||||
# Generate a filename based on the current time
|
||||
filename = datetime.datetime.utcnow().strftime("%Y%m%dT%H%M%S.jpg")
|
||||
filepath = str(paths_factory.snapshot_path(filename))
|
||||
# Write the image to that file
|
||||
cv2.imwrite(paths_factory.snapshot_path(filename), snap)
|
||||
cv2.imwrite(filepath, snap)
|
||||
|
||||
# Return the saved file location
|
||||
return paths_factory.snapshot_path(filename)
|
||||
return filepath
|
||||
|
|
Loading…
Reference in a new issue