use inotifywait
This commit is contained in:
+5
-10
@@ -12,18 +12,13 @@ if [ "$LOGGING_LEVEL" == "info" ] || [ "$LOGGING_LEVEL" == "debug" ];then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Time to sleep between generating spectrogram's, default set the recording length
|
# Continuously loop generating a spectrogram
|
||||||
# To try catch the spectrogram as soon as possible run at a smaller intervals
|
inotifywait -m -e close_write "$HOME/BirdNET-Pi/analyzing_now.txt" |
|
||||||
SLEEP_DELAY=$((RECORDING_LENGTH / 4))
|
while read; do
|
||||||
|
analyzing_now="$(<$HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||||
|
|
||||||
# Continuously loop generating a spectrogram every 10 seconds
|
if [ -n "${analyzing_now}" ] && [ -f "${analyzing_now}" ]; then
|
||||||
while true; do
|
|
||||||
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
|
||||||
|
|
||||||
if [ ! -z "${analyzing_now}" ] && [ -f "${analyzing_now}" ]; then
|
|
||||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||||
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\//}" -o "${spectrogram_png}"
|
sox -V1 "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now//$HOME\//}" -o "${spectrogram_png}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $SLEEP_DELAY
|
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user