Skip to content

A live bird collage card for your Home Assistant dashboard.

fixed issue with 60-second RECORDING_LENGTH integer check

Patrick McGuire70fd020eb475
diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh
index 72a8a378..048f77f0 100755
--- a/scripts/birdnet_analysis.sh
+++ b/scripts/birdnet_analysis.sh
@@ -82,10 +82,10 @@ run_analysis() {
[ -z $FILE_LENGTH ] && sleep 3 && continue
echo "RECORDING_LENGTH set to ${RECORDING_LENGTH}"
a=1
- if [ ${RECORDING_LENGTH} == "01:00" ];then
+ if [ "${RECORDING_LENGTH}" == "01:00" ];then
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "${RECORDING_LENGTH}" ];do
sleep 1
- [ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break
+ [ $a -ge 60 ] && sudo rm -f ${1}/${i} && break
a=$((a+1))
done
else
diff --git a/scripts/birdnet_stats.sh b/scripts/birdnet_stats.sh
index 28737dc1..c6665973 100755
--- a/scripts/birdnet_stats.sh
+++ b/scripts/birdnet_stats.sh
@@ -34,11 +34,16 @@ echo " -$SOFAR species identified so far"
echo
if [ ${a} -ge 1 ];then
while read -r line;do
- echo " | $line"
-done < <(awk -v n=2 '1; NR % n == 0 {print ""}' ${IDFILE})
+ SPECIES="$(echo "${line}" | awk -F: '/Common Name/ {print $2}')"
+ SPECIES=${SPECIES// /_}
+ SPECIES=${SPECIES/_}
+ [ -z ${SPECIES} ] && continue
+ DETECTIONS="$(ls -1 ${EXTRACTED}/By_Date/*/${SPECIES}| wc -l)"
+ echo -e " | $line # of detections so far: ${DETECTIONS}\n"
+done < ${IDFILE}
fi
echo
echo -n "Listening since "${INSTALL_DATE}""
-sleep 180
+sleep 20
clear
done