From f2d24c6e2a754cdf455e0a27306d33a5d177029a Mon Sep 17 00:00:00 2001 From: bel Date: Sat, 7 Sep 2024 15:35:09 -0600 Subject: [PATCH] 30d pls --- .../movement_detection_via_api_ffmpeg.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/testdata/sentryshot.d/movement_detection_via_api_ffmpeg.sh b/testdata/sentryshot.d/movement_detection_via_api_ffmpeg.sh index 09cdb71..118b31e 100644 --- a/testdata/sentryshot.d/movement_detection_via_api_ffmpeg.sh +++ b/testdata/sentryshot.d/movement_detection_via_api_ffmpeg.sh @@ -31,6 +31,18 @@ main() { -X DELETE fi done + + local too_old_unix="$(($(_date +%s) - 30 * 24 * 60 * 60))" # 30d ago + local too_old_ts="$(_date -d @$too_old_unix -u +%Y-%m-%d_%H-%M-%S)" + for recording in $( + api "/api/recording/query?recording-id=${too_old_ts}_x&limit=10000&reverse=false&include-data=false" \ + | jq -r .[].id \ + | sort + ); do + echo "$recording is too old" + echo api "/api/recording/delete/$recording" \ + -X DELETE + done } video_has_movement() { @@ -52,7 +64,7 @@ video_has_movement() { threshold="$max_of_last_n" fi done - threshold="$(_perl -e "print $threshold + 0.005")" + threshold="$(_perl -e "print $threshold + 0.01")" local has_change=false if [ "${#flattened_scores[@]}" -lt 10 ]; then