mirror of
https://github.com/boltgolt/howdy.git
synced 2024-09-19 09:51:19 +02:00
Changed device_id to device_path
This commit is contained in:
parent
b1f238d2fb
commit
1c544f0233
7 changed files with 15 additions and 18 deletions
|
@ -8,18 +8,16 @@ script:
|
||||||
# Install the binary, running the debian scripts in the process
|
# Install the binary, running the debian scripts in the process
|
||||||
- sudo apt install ../*.deb -y
|
- 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
|
# Check if the username passthough works correctly with sudo
|
||||||
- 'howdy | ack-grep --passthru --color "current active user: travis"'
|
- 'howdy | ack-grep --passthru --color "current active user: travis"'
|
||||||
- '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
|
# Remove howdy from the installation
|
||||||
- sudo apt purge howdy -y
|
- sudo apt purge howdy -y
|
||||||
|
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
email:
|
email:
|
||||||
on_success: never
|
on_success: never
|
||||||
|
|
3
debian/postinst
vendored
3
debian/postinst
vendored
|
@ -98,6 +98,7 @@ print("Temporary dlib files removed")
|
||||||
|
|
||||||
log("Installing python dependencies")
|
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"]))
|
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")
|
log("Installing face_recognition")
|
||||||
|
@ -115,7 +116,7 @@ log("Configuring howdy")
|
||||||
|
|
||||||
# Manually change the camera id to the one picked
|
# Manually change the camera id to the one picked
|
||||||
for line in fileinput.input(["/lib/security/howdy/config.ini"], inplace = 1):
|
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")
|
print("Camera ID saved")
|
||||||
|
|
||||||
# Secure the howdy folder
|
# Secure the howdy folder
|
||||||
|
|
10
debian/preinst
vendored
10
debian/preinst
vendored
|
@ -35,7 +35,7 @@ if "install" not in sys.argv:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# The default picked video device id
|
# The default picked video device id
|
||||||
picked = ""
|
picked = "none"
|
||||||
|
|
||||||
print(col(1) + "Starting IR camera check...\n" + col(0))
|
print(col(1) + "Starting IR camera check...\n" + col(0))
|
||||||
|
|
||||||
|
@ -52,8 +52,6 @@ if "HOWDY_NO_PROMPT" in os.environ:
|
||||||
# Get all devices
|
# Get all devices
|
||||||
devices = os.listdir("/dev/v4l/by-path")
|
devices = os.listdir("/dev/v4l/by-path")
|
||||||
|
|
||||||
print(devices)
|
|
||||||
|
|
||||||
# Loop though all devices
|
# Loop though all devices
|
||||||
for dev in devices:
|
for dev in devices:
|
||||||
time.sleep(.5)
|
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
|
# 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":
|
if ans.lower().strip() == "y" or ans.lower().strip() == "yes":
|
||||||
picked = dev[5:]
|
picked = dev
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("Interpreting as a " + col(3) + "\"NO\"\n" + col(0))
|
print("Interpreting as a " + col(3) + "\"NO\"\n" + col(0))
|
||||||
|
|
||||||
# Abort if no camera was picked
|
# Abort if no camera was picked
|
||||||
if picked == -1:
|
if picked == "none":
|
||||||
print(col(3) + "No suitable IR camera found, aborting install." + col(0))
|
print(col(3) + "No suitable IR camera found, aborting install." + col(0))
|
||||||
sys.exit(23)
|
sys.exit(23)
|
||||||
|
|
||||||
# Write the result to disk so postinst can have a look at it
|
# Write the result to disk so postinst can have a look at it
|
||||||
with open("/tmp/howdy_picked_device", "w") as out_file:
|
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
|
# Add a line break
|
||||||
print("")
|
print("")
|
||||||
|
|
|
@ -79,7 +79,7 @@ insert_model = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Open the camera
|
# 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
|
# Force MJPEG decoding if true
|
||||||
if config.get("video", "force_mjpeg") == "true":
|
if config.get("video", "force_mjpeg") == "true":
|
||||||
|
|
|
@ -18,7 +18,7 @@ config = configparser.ConfigParser()
|
||||||
config.read(path + "/../config.ini")
|
config.read(path + "/../config.ini")
|
||||||
|
|
||||||
# Start capturing from the configured webcam
|
# 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
|
# Force MJPEG decoding if true
|
||||||
if config.get("video", "force_mjpeg") == "true":
|
if config.get("video", "force_mjpeg") == "true":
|
||||||
|
|
|
@ -58,7 +58,7 @@ for model in models:
|
||||||
timings.append(time.time())
|
timings.append(time.time())
|
||||||
|
|
||||||
# Start video capture on the IR camera
|
# 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
|
# Force MJPEG decoding if true
|
||||||
if config.get("video", "force_mjpeg") == "true":
|
if config.get("video", "force_mjpeg") == "true":
|
||||||
|
|
|
@ -29,9 +29,9 @@ certainty = 3.5
|
||||||
# The number of seconds to search before timing out
|
# The number of seconds to search before timing out
|
||||||
timout = 4
|
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
|
# Should be set automatically by the installer
|
||||||
device_id = 1
|
device_path = none
|
||||||
|
|
||||||
# Scale down the video feed to this maximum height
|
# Scale down the video feed to this maximum height
|
||||||
# Speeds up face recognition but can make it less precise
|
# Speeds up face recognition but can make it less precise
|
||||||
|
|
Loading…
Reference in a new issue