From 74672a5e90c8c78b2dd2a97e9f65aaa8dc16ba23 Mon Sep 17 00:00:00 2001 From: bel Date: Wed, 4 Sep 2024 09:03:30 -0600 Subject: [PATCH] i think moonfire movement script ok --- .../movement_detection_via_api_ffmpeg.sh | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh b/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh index d0cfd97..872bac0 100644 --- a/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh +++ b/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh @@ -1,7 +1,7 @@ #! /bin/bash main() { - local nonrecent_unix="$(($(_date +%s) - 0 * 24 * 60 * 60))" # 1d ago # TODO now + local nonrecent_unix="$(($(_date +%s) - 24 * 60 * 60))" # 1d ago local nonrecent_ts="$(_date -d @$nonrecent_unix -u +%Y-%m-%dT%H:%M:%SZ)" for uuid in $( @@ -74,20 +74,12 @@ main() { echo "$uuid.$recording" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt echo "$cksum" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt else - local next_recording=${recordings[recording_idx]} - if [ -z "$next_recording" ] || [ "$recording" == "$next_recording" ]; then - next_recording="$recording" - else - next_recording=$((next_recording-1)) - fi - echo no movement in "$recording..$next_recording" - for j in $(seq $recording $next_recording); do - for stream in ${streams[@]}; do - echo api "/api/cameras/$uuid/$stream/view.mp4" \ - -X DELETE \ - -H 'Content-Type: application/json' \ - -d "$(printf '{"s": "%s"}' "$j")" - done + echo no movement in "$recording" + for stream in ${streams[@]}; do + api "/api/cameras/$uuid/$stream/view.mp4" \ + -X DELETE \ + -H 'Content-Type: application/json' \ + -d "$(printf '{"runStartId": %s}' "$recording")" done fi done