new species notifier worth trying

This commit is contained in:
Patrick McGuire
2021-10-15 21:04:06 -04:00
parent ae3e29ef1d
commit 99f7902213
12 changed files with 85 additions and 337 deletions
+5 -6
View File
@@ -1,19 +1,18 @@
#!/usr/bin/env bash
# Sends a notification if a new species is detected
#set -x
set -x
trap 'rm -f $tmpids' EXIT
source /etc/birdnet/birdnet.conf
tmpids=$(mktemp)
lastcheck="${IDFILE}.lastime"
[ -f ${IDFILE} ] || touch ${IDFILE}
cat "${IDFILE}" > "${tmpids}"
cat "${IDFILE}" > "${lastcheck}"
/usr/local/bin/update_species.sh > /dev/null
if ! diff "${IDFILE}" "${tmpids}" &> /dev/null; then
SPECIES=("$(diff "${IDFILE}" "${tmpids}" \
if ! diff "${IDFILE}" "${lastcheck}" &> /dev/null; then
SPECIES=("$(diff "${IDFILE}" "${lastcheck}" \
| grep "Common Name" \
| sort \
| awk '{for(i=4;i<=NF;++i)printf $i""FS ; print ""}')")