A live bird collage card for your Home Assistant dashboard.
added birdnet.conf changes check -- needs more testing, but seems to work well
Patrick McGuire88e4553b9459
diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.shindex 4406ee26..44065a08 100755--- a/Birders_Guide_Installer.sh+++ b/Birders_Guide_Installer.sh@@ -415,6 +415,8 @@ RECORDING_LENGTH=EXTRACTION_LENGTH=+LAST_RUN=+THIS_RUN=EOF[ -d /etc/birdnet ] || sudo mkdir /etc/birdnetsudo ln -sf ${my_dir}/birdnet.conf /etc/birdnet/birdnet.confdiff --git a/birdnet.conf-defaults b/birdnet.conf-defaultsindex ea0e8eee..569b5574 100644--- a/birdnet.conf-defaults+++ b/birdnet.conf-defaults@@ -251,3 +251,5 @@ VENV=$(dirname ${my_dir})/miniforge/envs/birdnetRECORDING_LENGTH=EXTRACTION_LENGTH=++LAST_RUN=diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.shindex f3e9dd5e..a4c7ccb0 100755--- a/scripts/birdnet_analysis.sh+++ b/scripts/birdnet_analysis.sh@@ -2,6 +2,25 @@# Runs BirdNET-Lite#set -xsource /etc/birdnet/birdnet.conf+# Document this run's birdnet.conf settings+# Make a temporary file to compare the current birdnet.conf with+# the birdnet.conf as it was the last time this script was called+make_thisrun() {+ sleep .4+ awk '!/#/ && !/^$/ {print}' /etc/birdnet/birdnet.conf \+ > >(tee "${THIS_RUN}")+ sleep .5+}+make_thisrun &> /dev/null+if ! diff ${LAST_RUN} ${THIS_RUN};then+ echo "The birdnet.conf file has changed"+ echo "Reloading services"+ cat ${THIS_RUN} > ${LAST_RUN}+ until restart_birdnet.sh;do+ sleep 1+ done+fi+CUSTOM_LIST="/home/pi/BirdNET-Lite/custom_species_list.txt"# Create an array of the audio files@@ -38,6 +57,7 @@ move_analyzed() {# Uses one argument:# - {DIRECTORY}run_analysis() {+ sleep .5echo "Starting run_analysis() for ${1:19}"@@ -58,7 +78,6 @@ run_analysis() {cd ${HOME}/BirdNET-Lite || exit 1for i in "${files[@]}";do- set -xFILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 \| awk -F. '/Duration/ {print $1}' \| cut -d':' -f3-4)"@@ -71,6 +90,7 @@ run_analysis() {fiif [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ];then+ set -xpython3 analyze.py \--i "${1}/${i}" \--o "${1}/${i}.csv" \diff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.shindex f0b133b2..798f07d6 100755--- a/scripts/extract_new_birdsounds.sh+++ b/scripts/extract_new_birdsounds.sh@@ -8,7 +8,6 @@ trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUGtrap 'echo "\"${last_command}\" command exited with code $?."' EXIT# Remove temporary filetrap 'rm -f $TMPFILE' EXIT-source /etc/birdnet/birdnet.conf# Set Variablesdiff --git a/scripts/install_config.sh b/scripts/install_config.shindex eb24fe74..c1402b7a 100755--- a/scripts/install_config.sh+++ b/scripts/install_config.sh@@ -368,7 +368,7 @@ INSTALL_NOMACHINE=${INSTALL_NOMACHINE}## devices from the output of running 'aplay -L'REC_CARD=${REC_CARD}-+## PROCESSED is the directory where the formerly 'Analyzed' files are moved## after extractions have been made from them. This includes both WAVE and## BirdNET.selection.txt files.@@ -437,6 +437,8 @@ RECORDING_LENGTH=EXTRACTION_LENGTH=+LAST_RUN=$(dirname ${my_dir})/lastrun.txt+THIS_RUN=$(dirname ${my_dir})/thisrun.txtEOF[ -d /etc/birdnet ] || sudo mkdir /etc/birdnetsudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf