small tweaks to birdnet_anaysis.sh
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Runs BirdNET-Lite
|
# Runs BirdNET-Lite
|
||||||
#set -x
|
set -x
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
# Document this run's birdnet.conf settings
|
# Document this run's birdnet.conf settings
|
||||||
# Make a temporary file to compare the current birdnet.conf with
|
# Make a temporary file to compare the current birdnet.conf with
|
||||||
@@ -78,7 +78,7 @@ move_analyzed() {
|
|||||||
# Uses one argument:
|
# Uses one argument:
|
||||||
# - {DIRECTORY}
|
# - {DIRECTORY}
|
||||||
run_analysis() {
|
run_analysis() {
|
||||||
sleep .5
|
sleep .5
|
||||||
echo "Starting run_analysis() for ${1:19}"
|
echo "Starting run_analysis() for ${1:19}"
|
||||||
|
|
||||||
|
|
||||||
@@ -101,25 +101,25 @@ run_analysis() {
|
|||||||
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
||||||
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
||||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
||||||
[ -z $FILE_LENGTH ] && sleep 2 && continue
|
[ -z $FILE_LENGTH ] && sleep 1 && continue
|
||||||
echo "RECORDING_LENGTH set to ${RECORDING_LENGTH}"
|
echo "RECORDING_LENGTH set to ${RECORDING_LENGTH}"
|
||||||
a=1
|
a=0
|
||||||
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
|
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "${RECORDING_LENGTH}" ];do
|
||||||
sleep 1
|
sleep 1
|
||||||
[ $a -ge 60 ] && sudo rm -f ${1}/${i} && break
|
[ $a -ge 60 ] && rm -f ${1}/${i} && break
|
||||||
a=$((a+1))
|
a=$((a+1))
|
||||||
done
|
done
|
||||||
elif [ "${RECORDING_LENGTH}" -lt 10 ];then
|
elif [ "${RECORDING_LENGTH}" -lt 10 ];then
|
||||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:0${RECORDING_LENGTH}" ];do
|
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:0${RECORDING_LENGTH}" ];do
|
||||||
sleep 1
|
sleep 1
|
||||||
[ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break
|
[ $a -ge ${RECORDING_LENGTH} ] && rm -f ${1}/${i} && break
|
||||||
a=$((a+1))
|
a=$((a+1))
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:${RECORDING_LENGTH}" ];do
|
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:${RECORDING_LENGTH}" ];do
|
||||||
sleep 1
|
sleep 1
|
||||||
[ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break
|
[ $a -ge ${RECORDING_LENGTH} ] && rm -f ${1}/${i} && break
|
||||||
a=$((a+1))
|
a=$((a+1))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user