Files
vigil/scripts/cameras
T

39 lines
857 B
Bash
Raw Normal View History

2022-10-27 20:04:53 +00:00
#!/usr/bin/env bash
2023-02-01 19:51:11 +00:00
readonly WEBCONTROL_PORT="${PORT_CONTROL}"
2022-10-28 17:16:41 +00:00
2022-10-27 20:04:53 +00:00
readonly cameras=(
2022-10-28 17:16:41 +00:00
"https://${HOST0}:${WEBCONTROL_PORT}/0"
# "https://${HOST0}:${WEBCONTROL_PORT}/1"
# "https://${HOST1}:${WEBCONTROL_PORT}/${CAMERA0}"
# "https://${HOST2}:${WEBCONTROL_PORT}/${CAMERA0}"
2022-10-27 20:04:53 +00:00
)
readonly auth=(
2022-10-28 17:16:41 +00:00
"${MOTION_USER}:${MOTION_PASSWORD}"
# "${USER0}:${PW0}"
# "${USER1}:${PW1}"
# "${USER2}:${PW2}"
2022-10-27 20:04:53 +00:00
)
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 "$@"