diff --git a/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh b/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh index c754949..fc555cf 100644 --- a/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh +++ b/testdata/moonfire-nvr/movement_detection_via_api_ffmpeg.sh @@ -5,6 +5,9 @@ set -eo pipefail if test -f /volume1/homes/squeaky2x3/services/moonfire-nvr.d/moonfire-nvr.sh; then bash /volume1/homes/squeaky2x3/services/moonfire-nvr.d/moonfire-nvr.sh fi +if test -d /var/lib/moonfire-nvr; then + export MOONFIRE_DIR=/var/lib/moonfire-nvr +fi main() { local nonrecent_unix="$(($(_date +%s) - 4 * 60 * 60))" # 4h ago @@ -22,7 +25,7 @@ main() { | sort -n #-r )) for recording in "${recordings[@]}"; do - if grep "^$uuid.$recording$" /tmp/movement_detection_via_api_ffmpeg.sh.txt; then + if grep "^$uuid.$recording$" ${MOONFIRE_DIR:-/tmp}/movement_detection_via_api_ffmpeg.sh.txt; then continue fi @@ -60,7 +63,7 @@ main() { 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 @@ -73,7 +76,7 @@ main() { fi if $has_change; then - echo "$uuid.$recording" >> /tmp/movement_detection_via_api_ffmpeg.sh.txt + echo "$uuid.$recording" >> ${MOONFIRE_DIR:-/tmp}/movement_detection_via_api_ffmpeg.sh.txt else echo no movement in "$recording" api "/api/cameras/$uuid/$stream/view.mp4" \