tweaking a few fixes

This commit is contained in:
Patrick McGuire
2021-09-30 12:07:47 -04:00
parent ec57bdaf83
commit c2bb057999
3 changed files with 21 additions and 15 deletions
+2 -4
View File
@@ -4,8 +4,6 @@
source /etc/birdnet/birdnet.conf
CUSTOM_LIST="/home/pi/BirdNET-Lite/custom_species_list.txt"
DAYS=(
"2 days ago"
"yesterday"
"today"
)
@@ -33,8 +31,8 @@ move_analyzed() {
mkdir -vvvvvvvp "${1}-Analyzed" && echo "'Analyzed' directory created"
fi
echo "Moving analyzed files to new directory"
mv -vv "${1}/${i}" "${1}-Analyzed/"
mv -vv "${1}/${j}" "${1}-Analyzed/"
mv "${1}/${i}" "${1}-Analyzed/"
mv "${1}/${j}" "${1}-Analyzed/"
fi
done
}
+7 -1
View File
@@ -23,14 +23,20 @@ else
a=0
fi
echo
SOFAR=$(($(wc -l ${IDFILE}| cut -d' ' -f1)/2))
if [ "${a}" -ge "1" ];then
SOFAR=$(($(wc -l ${IDFILE}| cut -d' ' -f1)/2))
else
SOFAR=0
fi
echo " -$a detections so far"
echo
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})
fi
echo
echo -n "Listening since "${INSTALL_DATE}""
sleep 180
+12 -10
View File
@@ -34,7 +34,6 @@ fi
echo "Starting numbering at ${a}"
for h in "${SCAN_DIRS[@]}";do
echo "Creating the TMPFILE"
# The TMPFILE is created from each .csv file BirdNET creates
# within each "Analyzed" directory
# Field 1: Start (s)
@@ -42,6 +41,14 @@ for h in "${SCAN_DIRS[@]}";do
# Field 3: Scientific name
# Field 4: Common name
# Field 5: Confidence
# Removes old directories
if echo "${h}" | grep $(date --date="yesterday" "+%A") &> /dev/null;then
echo "Removing old directories"
rm -df "${h}"
rm -df "$(echo ${h} | cut -d'-' -f1-3)"
continue
fi
# Iterates over each "Analyzed" directory
for i in $(find ${h} -name '*csv' | sort );do
# Iterates over each '.csv' file found in each "Analyzed" directory
@@ -87,24 +94,20 @@ for h in "${SCAN_DIRS[@]}";do
fi
echo "Checking for ${h}/${OLDFILE}"
# Before extracting the "Selection," the script checks to be sure the
# original WAVE file still exists.
[[ -f "${h}/${OLDFILE}" ]] || continue
echo "Checking for ${NEWSPECIES_BYDATE}"
# If a directory does not already exist for the species (by date),
# it is created
[[ -d "${NEWSPECIES_BYDATE}" ]] || mkdir -p "${NEWSPECIES_BYDATE}"
echo "Checking for ${NEWSPECIES_BY_COMMON}"
# If a directory does not already exist for the species (by-species),
# it is created.
[[ -d "${NEWSPECIES_BY_COMMON}" ]] || mkdir -p "${NEWSPECIES_BY_COMMON}"
echo "Checking for ${NEWSPECIES_BY_SCIENCE}"
# If a directory does not already exist for the species (by-species),
# it is created.
[[ -d "${NEWSPECIES_BY_SCIENCE}" ]] || mkdir -p "${NEWSPECIES_BY_SCIENCE}"
@@ -124,7 +127,7 @@ for h in "${SCAN_DIRS[@]}";do
# structured by-species, symbolic links are made to populate the new
# directory.
ffmpeg -hide_banner -loglevel 52 -nostdin -i "${h}/${OLDFILE}" \
ffmpeg -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
@@ -158,7 +161,7 @@ for h in "${SCAN_DIRS[@]}";do
done < "${TMPFILE}"
echo -e "\n\n\nFINISHED!!! Processed extractions for ${h}"
echo -e "\n\n\nFINISHED!!! Processed extractions for ${h:19}"
# Once each line of the TMPFILE has been processed, the TMPFILE is emptied
# for the next iteration of the for loop.
>"${TMPFILE}"
@@ -167,7 +170,7 @@ for h in "${SCAN_DIRS[@]}";do
# next extraction.
[[ -d "${PROCESSED}" ]] || mkdir "${PROCESSED}"
echo "Moving processed files to ${PROCESSED}"
mv -v ${h}/* ${PROCESSED} || continue
mv ${h}/* ${PROCESSED} &> /dev/null || continue
done
echo "Linking Processed files to "${EXTRACTED}/Processed" web directory"
@@ -180,5 +183,4 @@ fi
# That's all!
echo "Finished -- the extracted sections are in:
$(find -L ${EXTRACTED} -maxdepth 1)"
echo "Finished -- the extracted sections are in ${EXTRACTED}"