A live bird collage card for your Home Assistant dashboard.
adding RECORDING_LENGTH and EXTRACTION_LENGTH
Patrick McGuirecb102044e64a
diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.shindex dd91ad2a..ef1fc487 100755--- a/scripts/birdnet_analysis.sh+++ b/scripts/birdnet_analysis.sh@@ -42,13 +42,16 @@ run_analysis() {WEEK=$(date +"%U")cd ${HOME}/BirdNET-Lite || exit 1for i in "${files[@]}";do++ set -x+ FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 \+ | awk -F. '/Duration/ {print $1}' \+ | cut -d':' -f3-4)"+ [ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=9+ [ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00+ [ "${FILE_LENGTH}" == "00:${RECORDING_LENGTH}" ] || continue+if [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ];then- FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 \- | awk -F. '/Duration/ {print $1}' \- | cut -d':' -f3-4)"- set -x- [ ${RECORDING_LENGTH} == 60 ] && RECORDING_LENGTH=01:00- [ "${FILE_LENGTH}" == "${RECORDING_LENGTH}" ] || continuepython3 analyze.py \--i "${1}/${i}" \--o "${1}/${i}.csv" \diff --git a/scripts/birdnet_recording.sh b/scripts/birdnet_recording.shindex 33ccd70d..8a2c3a3c 100755--- a/scripts/birdnet_recording.sh+++ b/scripts/birdnet_recording.sh@@ -8,6 +8,8 @@ elseSTAMP="%H:%M:%S"fi+[ -z RECORDING_LENGTH ] || RECORDING_LENGTH=9+if pgrep arecord &> /dev/null ;thenecho "Recording"elsediff --git a/scripts/extract_new_birdsounds.sh b/scripts/extract_new_birdsounds.shindex f3561d8a..e1a155b0 100755--- a/scripts/extract_new_birdsounds.sh+++ b/scripts/extract_new_birdsounds.sh@@ -130,6 +130,7 @@ for h in "${SCAN_DIRS[@]}";do### TESTING longer extraction contextset -x+ [ -z ${EXTRACTION_LENGTH} ] || EXTRACTION_LENGTH=6SPACER=$(echo "(${EXTRACTION_LENGTH} - 3 )/2" |bc -l)START=$(echo "${START} - ${SPACER}"|bc -l)END=$(echo "${END} + ${SPACER}"|bc -l)diff --git a/scripts/install_config.sh b/scripts/install_config.shindex 839a9371..fc49a77c 100755--- a/scripts/install_config.sh+++ b/scripts/install_config.sh@@ -169,8 +169,8 @@ get_CHANNELS() {| uniq)"script -c "arecord -D ${SOUND_CARD} --dump-hw-params" -a "${SOUND_PARAMS}" &> /dev/nullCHANNELS=$(awk '/CHANN/ { print $2 }' "${SOUND_PARAMS}" | sed 's/\r$//')- [ -z REC_CARD ] || REC_CARD=default- [ -z CHANNELS ] || CHANNELS=2+ [ -z REC_CARD ] && REC_CARD=default+ [ -z CHANNELS ] && CHANNELS=2echo "REC_CARD variable set to ${REC_CARD}"echo "Number of channels available: ${CHANNELS}"}