vigil

Security camera system built on motion and yolov7.
Log | Files | Refs

commit e5aff051f6a2bbff3930bebe6a83bb83aefd1234
parent 9cf548b35628b09ca992ab7c0d7c673950f3b7e0
Author: dwrz <dwrz@dwrz.net>
Date:   Thu, 27 Oct 2022 20:04:53 +0000

Add cameras script

Diffstat:
Ascripts/cameras | 36++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+), 0 deletions(-)

diff --git a/scripts/cameras b/scripts/cameras @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +readonly cameras=( + "https://${HOST0}:${PORT}/${CAMERA0}" + "https://${HOST0}:${PORT}/${CAMERA1}" + "https://${HOST1}:${PORT}/${CAMERA0}" + "https://${HOST2}:${PORT}/${CAMERA0}" +) +readonly auth=( + "${USER0}:${PW0}" + "${USER0}:${PW0}" + "${USER1}:${PW1}" + "${USER2}:${PW2}" +) + +err() { + echo "[$(date -u +'%Y-%m-%dT%H:%M:%S%:z')]: $*" >&2 +} + +main() { + local url="detection/status" + + case "$1" in + "capture"|"c") url="detection/snapshot" ;; + "pause"|"p") url="detection/pause" ;; + "start"|"s") url="detection/start" ;; + "status"|"") url="detection/status" ;; + *) err "unrecognized command: $1"; exit 1 + esac + + for i in "${!cameras[@]}"; do + curl --digest --user "${auth[i]}" "${cameras[i]}/${url}" + done +} + +main "$@"