Compare commits

...

2 Commits

Author SHA1 Message Date
bel
9655e792a3 WIP 2024-09-03 14:43:08 -06:00
bel
5ebf4f6e83 to try 2024-09-03 14:43:07 -06:00

View File

@@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
main() { main() {
local nonrecent_unix="$(($(_date +%s) - 24 * 60 * 60))" # 1d ago local nonrecent_unix="$(($(_date +%s) - 0 * 24 * 60 * 60))" # 1d ago # TODO now
local nonrecent_ts="$(_date -d @$nonrecent_unix -u +%Y-%m-%dT%H:%M:%SZ)" local nonrecent_ts="$(_date -d @$nonrecent_unix -u +%Y-%m-%dT%H:%M:%SZ)"
for uuid in $( for uuid in $(
@@ -74,17 +74,20 @@ main() {
echo "$uuid.$recording" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt echo "$uuid.$recording" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt
echo "$cksum" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt echo "$cksum" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt
else else
local next_recording=$(( ${recordings[recording_idx]} - 1 )) local next_recording=${recordings[recording_idx]}
local span="$recording" if [ -z "$next_recording" ] || [ "$recording" == "$next_recording" ]; then
if [ "$recording" != "$next_recording" ]; then next_recording="$recording"
span="$recording-$next_recording" else
next_recording=$((next_recording-1))
fi fi
echo no movement in "$span" echo no movement in "$recording..$next_recording"
for stream in ${streams[@]}; do for j in $(seq $recording $next_recording); do
api "/api/cameras/$uuid/$stream/view.mp4" \ for stream in ${streams[@]}; do
-X DELETE \ echo api "/api/cameras/$uuid/$stream/view.mp4" \
-H 'Content-Type: application/json' \ -X DELETE \
-d "$(printf '{"s": "%s"}' "$span")" -H 'Content-Type: application/json' \
-d "$(printf '{"s": "%s"}' "$j")"
done
done done
fi fi
done done