commit 9e27e6081f3f85aa3f68725e948dbd9d2a939287 parent f0774310fe9a6d1915a922c54eedb585caf39298 Author: dwrz <dwrz@dwrz.net> Date: Fri, 28 Oct 2022 17:16:51 +0000 Add cameras.sh example script Diffstat:
A | scripts/cameras.sh | | | 30 | ++++++++++++++++++++++++++++++ |
1 file changed, 30 insertions(+), 0 deletions(-)
diff --git a/scripts/cameras.sh b/scripts/cameras.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +readonly WEBCONTROL_PORT="8080" +readonly CAMERA_1="10.0.1.1" +readonly CAMERA_2="10.0.1.2" +readonly CAMERA_3="10.0.1.3" + +err() { + echo "[$(date -u +'%Y-%m-%dT%H:%M:%S%:z')]: $*" >&2 +} + +main() { + 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 + + curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \ + "https://${CAMERA_1}:${WEBCONTROL_PORT}/0/${url}" + curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \ + "https://${CAMERA_2}:${WEBCONTROL_PORT}/0/${url}" + curl --digest --user "${MOTION_USER}:${MOTION_PASSWORD}" \ + "https://${CAMERA_3}:${WEBCONTROL_PORT}/0/${url}" +} + +main "$@"