A live bird collage card for your Home Assistant dashboard.
adding small version file for now
Patrick McGuire355188a16647
diff --git a/scripts/birdnet_stats.sh b/scripts/birdnet_stats.shindex be267eae..ec7c034d 100755--- a/scripts/birdnet_stats.sh+++ b/scripts/birdnet_stats.sh@@ -1,8 +1,10 @@#!/usr/bin/env bash# BirdNET Stats Page-trap 'setterm --cursor on' EXIT+trap 'setterm --cursor on && exit' EXIT+trap 'rm -f "${TMP_FILE}" && exit' EXITsource /etc/birdnet/birdnet.confsetterm --cursor off+TMP_FILE="$(mktemp)"while true;docat << "EOF"@@ -55,8 +57,9 @@ while read -r line;doelseverbage=detectionsfi- echo -e "${DETECTIONS} $verbage for ${SPECIES//_/ } | max conf ${MAX_SCORE}%" | sort-done < ${IDFILE}+ echo "${DETECTIONS} $verbage for ${SPECIES//_/ } | max conf ${MAX_SCORE}%"+done < "${IDFILE}" > ${TMP_FILE}+sort -rk1 -h "${TMP_FILE}"fiechoecho -n "Listening since "${INSTALL_DATE}""diff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.shindex 3131d373..baf2b12b 100755--- a/scripts/extract_new_birdsounds.sh+++ b/scripts/extract_new_birdsounds.sh@@ -1,6 +1,6 @@#!/usr/bin/env bash# Exit when any command fails-set -x+#set -xset -e# Keep track of the last executed command#trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG@@ -116,10 +116,10 @@ for h in "${SCAN_DIRS[@]}";do# If there are already 20 extracted entries for a given species# for today, remove the oldest file and create the new one.- # if [[ "$(find ${NEWSPECIES_BYDATE} | wc -l)" -ge 21 ]];then+ # if [[ "$(find ${NEWSPECIES_BYDATE} | wc -l)" -ge 20 ]];then# echo "20 ${SPECIES}s, already! Removing the oldest by-date and making a new one"# cd ${NEWSPECIES_BYDATE} || exit 1- # ls -1t . | tail -n +21 | xargs -r rm -vv+ # ls -1t . | tail -n +20 | xargs -r rm -vv# fiecho "Extracting audio . . . "@@ -128,34 +128,48 @@ for h in "${SCAN_DIRS[@]}";do# structured by-species, symbolic links are made to populate the new# directory.- ### TESTING longer extraction context+ # This section sets the SPACER that will be used to pad the audio clip with+ # context. If EXTRACTION_LENGTH is 10, for instance, 3 seconds are removed+ # from that value and divided by 2, so that the 3 seconds of the call are+ # within 3.5 seconds of audio context before and after.[ -z ${EXTRACTION_LENGTH} ] && EXTRACTION_LENGTH=6SPACER=$(echo "scale=1;(${EXTRACTION_LENGTH} - 3 )/2" |bc -l)START=$(echo "scale=1;${START} - ${SPACER}"|bc -l)END=$(echo "scale=1;${END} + ${SPACER}"|bc -l)+ # If the SPACER would have the START value less that 0, start at the+ # beginning of the audio file. If the SPACER would make the END value+ # exceed the end of the audio file, end the extraction at the end of the+ # audio file.if (( $(echo "${START} < 1" | bc -l) ));then START=0;fiif (( $(echo "${END} > ${RECORDING_LENGTH}" | bc -l) ));then END=${RECORDING_LENGTH};fiffmpeg -hide_banner -loglevel error -nostdin -i "${h}/${OLDFILE}" \-acodec copy -ss "${START}" -to "${END}"\"${NEWSPECIES_BYDATE}/${a}-${NEWFILE}"- if [[ "$(find ${NEWSPECIES_BY_COMMON} | wc -l)" -ge 21 ]];then+++ # Remove the oldest symbolic links that would made the directory have more+ # than 20 entries.+ if [[ "$(find ${NEWSPECIES_BY_COMMON} | wc -l)" -ge 20 ]];thenecho "20 ${SPECIES}s, already! Removing the oldest by-species and making a new one"cd ${NEWSPECIES_BY_COMMON} || exit 1- ls -1t . | tail -n +21 | xargs -r rm -vv+ ls -1t . | tail -n +20 | xargs -r rm -vvln -fs "${NEWSPECIES_BYDATE}/${a}-${NEWFILE}"\"${NEWSPECIES_BY_COMMON}/${a}-${NEWFILE}"echo "Success! New extraction for ${COMMON_NAME}"else+ # Make symbolic link of the extraction to add to By_Common_Nameln -fs "${NEWSPECIES_BYDATE}/${a}-${NEWFILE}"\"${NEWSPECIES_BY_COMMON}/${a}-${NEWFILE}"fi- if [[ "$(find ${NEWSPECIES_BY_SCIENCE} | wc -l)" -ge 21 ]];then+ # Remove the oldest symbolic links that would made the directory have more+ # than 20 entries.+ if [[ "$(find ${NEWSPECIES_BY_SCIENCE} | wc -l)" -ge 20 ]];thenecho "20 ${SPECIES}s, already! Removing the oldest by-species and making a new one"cd ${NEWSPECIES_BY_SCIENCE} || exit 1- ls -1t . | tail -n +21 | xargs -r rm -vv+ ls -1t . | tail -n +20 | xargs -r rm -vvln -fs "${NEWSPECIES_BYDATE}/${a}-${NEWFILE}"\"${NEWSPECIES_BY_SCIENCE}/${a}-${NEWFILE}"echo "Success! New extraction for ${COMMON_NAME}"diff --git a/version b/versionnew file mode 100644index 00000000..17b4d0b8--- /dev/null+++ b/version@@ -0,0 +1,2 @@+rpialpha+Tue 05 Oct 2021 06:25:48 PM EDT