have birdstats.local (birdnet_stats.sh) working okay, not great

This commit is contained in:
Patrick McGuire
2021-09-29 14:44:33 -04:00
parent 7c1ee9e61a
commit b186e5d6a1
2 changed files with 10 additions and 12 deletions
+4 -3
View File
@@ -23,13 +23,14 @@ else
a=0 a=0
fi fi
echo echo
SOFAR=$(wc -l ${IDFILE}| cut -d' ' -f1) SOFAR=$(($(wc -l ${IDFILE}| cut -d' ' -f1)/2))
echo " -$a detections so far" echo " -$a detections so far"
echo echo
echo " -$SOFAR species identified so far" echo " -$SOFAR species identified so far"
echo
while read -r line;do while read -r line;do
echo " + $line" echo " | $line"
done < ${IDFILE} done < <(awk -v n=2 '1; NR % n == 0 {print ""}' ${IDFILE})
echo echo
echo -n "Listening since "${INSTALL_DATE}"" echo -n "Listening since "${INSTALL_DATE}""
sleep 180 sleep 180
+6 -9
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Update the species list # Update the species list
# set -x #set -x
trap 'rm -f "$TMPFILE"' SIGINT SIGTERM EXIT trap 'rm -f "$TMPFILE"' SIGINT SIGTERM EXIT
source /etc/birdnet/birdnet.conf source /etc/birdnet/birdnet.conf
@@ -11,14 +11,11 @@ TMPFILE=$(mktemp) || exit 1
IDFILEBAKUP="${IDFILE}.bak" IDFILEBAKUP="${IDFILE}.bak"
if [ $(find ${ANALYZED} -name '*txt' | wc -l) -ge 1 ];then if [ $(find ${PROCESSED} -name '*csv' | wc -l) -ge 1 ];then
sort $(find ${ANALYZED} -name '*txt') \ sort $(find ${PROCESSED} ${ANALYZED} ${EXTRACTED} -name '*csv') \
| awk '/Spect/ {for(i=11;i<=NF;++i)printf $i""FS ; print ""}' \ | awk -F\; '!/Scientific/ {print"Common Name: " $4 "\nScientific Name: " $3""}' \
| cut -d'0' -f1 \ | uniq > "$TMPFILE"
| sort -u > "$TMPFILE" cat "$TMPFILE" | awk '!visited[$0]++' > "$IDFILE"
cat "$IDFILE" >> "$TMPFILE"
cp "$IDFILE" "$IDFILEBAKUP"
sort -u "$TMPFILE" > "$IDFILE"
cat "$IDFILE" cat "$IDFILE"
else else
cat "$IDFILE" cat "$IDFILE"