fixed a weirdness in the birdnet_stats.sh script
This commit is contained in:
@@ -116,8 +116,13 @@ stage_2() {
|
||||
echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables
|
||||
and set the passwords for the live audio stream. Save the file after editing
|
||||
and then close the Mouse Pad editing window to continue."
|
||||
mousepad ${my_dir}/Birders_Guide_Installer_Configuration.txt &> /dev/null
|
||||
while pgrep mouse &> /dev/null;do
|
||||
if ( env | grep SSH_CONNECTION &> /dev/null );then
|
||||
editor=nano
|
||||
else
|
||||
editor=mousepad
|
||||
fi
|
||||
$editor ${my_dir}/Birders_Guide_Installer_Configuration.txt &> /dev/null
|
||||
while pgrep $editor &> /dev/null;do
|
||||
sleep 1
|
||||
done
|
||||
source ${my_dir}/Birders_Guide_Installer_Configuration.txt || exit 1
|
||||
|
||||
@@ -150,6 +150,8 @@ run_birdnet() {
|
||||
run_analysis "${1}"
|
||||
}
|
||||
|
||||
date
|
||||
|
||||
if [ $(find ${RECS_DIR} -maxdepth 1 -name '*wav' | wc -l) -gt 0 ];then
|
||||
run_birdnet "${RECS_DIR}"
|
||||
fi
|
||||
|
||||
@@ -41,24 +41,34 @@ echo " -$SOFAR species identified so far"
|
||||
echo
|
||||
if [ ${a} -ge 1 ];then
|
||||
while read -r line;do
|
||||
|
||||
# Get species name
|
||||
SPECIES="$(echo "${line}" | awk -F: '/Common Name/ {print $2}')"
|
||||
SPECIES="${SPECIES// /_}"
|
||||
SPECIES="$(echo ${SPECIES/_} | tr -d "'")"
|
||||
[ -z ${SPECIES} ] && continue
|
||||
|
||||
ALL_DETECTION_FILES="$(ls -1 ${EXTRACTED}/By_Date/*/${SPECIES})"
|
||||
# Get all detection files
|
||||
ALL_DETECTION_FILES="$(find ${EXTRACTED}/By_Date/*/${SPECIES} -name '*.wav')"
|
||||
ALL_DETECTION_FILES="$(echo ${ALL_DETECTION_FILES[@]} | tr ' ' '\n')"
|
||||
|
||||
# Parse highest confidence score
|
||||
MAX_SCORE="$(echo "${ALL_DETECTION_FILES}"| awk -F% '{print $1}')"
|
||||
MAX_SCORE="$(echo "${MAX_SCORE[@]}" | rev |cut -d"-" -f1|rev | sort -r | head -n1)"
|
||||
|
||||
# Set noun-plurality agreement for grammar
|
||||
DETECTIONS="$(ls -1 ${EXTRACTED}/By_Date/*/${SPECIES} | wc -l)"
|
||||
if [ ${DETECTIONS} = 1 ];then
|
||||
verbage=detection
|
||||
else
|
||||
verbage=detections
|
||||
fi
|
||||
|
||||
# Write results to temporary file
|
||||
echo "${DETECTIONS} $verbage for ${SPECIES//_/ } | max conf ${MAX_SCORE}%"
|
||||
done < "${IDFILE}" > ${TMP_FILE}
|
||||
|
||||
# Print temporary file sorted by # of detections
|
||||
sort -rk1 -h "${TMP_FILE}"
|
||||
fi
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user