diff --git a/.travis.yml b/.travis.yml index 3829556..ef8aeea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,18 +8,16 @@ script: # Install the binary, running the debian scripts in the process - sudo apt install ../*.deb -y - # Confirm the dlib module has been installed correctly - - 'python3 -c "import dlib; print(dlib.__version__);' - # Confirm the face_recognition module has been installed correctly - - 'python3 -c "import face_recognition; print(face_recognition.__version__);"' - # Check if the username passthough works correctly with sudo - 'howdy | ack-grep --passthru --color "current active user: travis"' - 'sudo howdy | ack-grep --passthru --color "current active user: travis"' - + + - sudo howdy test + # Remove howdy from the installation - sudo apt purge howdy -y + notifications: email: on_success: never diff --git a/debian/postinst b/debian/postinst index 5de7019..7130415 100755 --- a/debian/postinst +++ b/debian/postinst @@ -98,6 +98,7 @@ print("Temporary dlib files removed") log("Installing python dependencies") +# Install direct dependencies so pip does not freak out with the manual dlib install handleStatus(subprocess.call(["pip3", "install", "--cache-dir", "/tmp/pip_howdy", "face_recognition_models==0.3.0", "Click>=6.0", "numpy", "Pillow"])) log("Installing face_recognition") @@ -115,7 +116,7 @@ log("Configuring howdy") # Manually change the camera id to the one picked for line in fileinput.input(["/lib/security/howdy/config.ini"], inplace = 1): - print(line.replace("device_id = 1", "device_id = " + picked), end="") + print(line.replace("device_path = none", "device_path = " + picked), end="") print("Camera ID saved") # Secure the howdy folder diff --git a/debian/preinst b/debian/preinst index ef014cd..4acfb39 100755 --- a/debian/preinst +++ b/debian/preinst @@ -35,7 +35,7 @@ if "install" not in sys.argv: sys.exit(0) # The default picked video device id -picked = "" +picked = "none" print(col(1) + "Starting IR camera check...\n" + col(0)) @@ -52,8 +52,6 @@ if "HOWDY_NO_PROMPT" in os.environ: # Get all devices devices = os.listdir("/dev/v4l/by-path") -print(devices) - # Loop though all devices for dev in devices: time.sleep(.5) @@ -90,19 +88,19 @@ for dev in devices: # Set this camera as picked if the answer was yes, go to the next one if no if ans.lower().strip() == "y" or ans.lower().strip() == "yes": - picked = dev[5:] + picked = dev break else: print("Interpreting as a " + col(3) + "\"NO\"\n" + col(0)) # Abort if no camera was picked -if picked == -1: +if picked == "none": print(col(3) + "No suitable IR camera found, aborting install." + col(0)) sys.exit(23) # Write the result to disk so postinst can have a look at it with open("/tmp/howdy_picked_device", "w") as out_file: - out_file.write(str(picked)) + out_file.write("/dev/v4l/by-path/" + picked) # Add a line break print("") diff --git a/src/cli/add.py b/src/cli/add.py index 2d82c06..8df9c65 100644 --- a/src/cli/add.py +++ b/src/cli/add.py @@ -79,7 +79,7 @@ insert_model = { } # Open the camera -video_capture = cv2.VideoCapture(int(config.get("video", "device_id"))) +video_capture = cv2.VideoCapture(config.get("video", "device_path")) # Force MJPEG decoding if true if config.get("video", "force_mjpeg") == "true": diff --git a/src/cli/test.py b/src/cli/test.py index 6321d98..3a55053 100644 --- a/src/cli/test.py +++ b/src/cli/test.py @@ -18,7 +18,7 @@ config = configparser.ConfigParser() config.read(path + "/../config.ini") # Start capturing from the configured webcam -video_capture = cv2.VideoCapture(int(config.get("video", "device_id"))) +video_capture = cv2.VideoCapture(config.get("video", "device_path")) # Force MJPEG decoding if true if config.get("video", "force_mjpeg") == "true": diff --git a/src/compare.py b/src/compare.py index 03d89dc..62824d6 100644 --- a/src/compare.py +++ b/src/compare.py @@ -58,7 +58,7 @@ for model in models: timings.append(time.time()) # Start video capture on the IR camera -video_capture = cv2.VideoCapture(int(config.get("video", "device_id"))) +video_capture = cv2.VideoCapture(config.get("video", "device_path")) # Force MJPEG decoding if true if config.get("video", "force_mjpeg") == "true": diff --git a/src/config.ini b/src/config.ini index 4e4416e..1f577e9 100644 --- a/src/config.ini +++ b/src/config.ini @@ -29,9 +29,9 @@ certainty = 3.5 # The number of seconds to search before timing out timout = 4 -# The /dev/videoX id to capture frames from +# The path of the device to capture frames from # Should be set automatically by the installer -device_id = 1 +device_path = none # Scale down the video feed to this maximum height # Speeds up face recognition but can make it less precise