added 12/24h timestamp formatting as birdnet.conf variable

defaults to 24h timestamps

working on species_notifier.sh
This commit is contained in:
Patrick McGuire
2021-09-30 14:19:35 -04:00
parent c2bb057999
commit 50d6a56ae5
6 changed files with 94 additions and 22 deletions
+9 -6
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Sends a notification if a new species is detected
# set -x
#set -x
trap 'rm -f $TMPFILE' SIGINT SIGHUP EXIT
source /etc/birdnet/birdnet.conf
@@ -12,11 +12,14 @@ cat "${IDFILE}" > "${TMPFILE}"
/usr/local/bin/update_species.sh &> /dev/null
if ! diff "${IDFILE}" "${TMPFILE}"; then
SPECIES=("$(diff "${IDFILE}" "${TMPFILE}" \
| awk '/</ {print $2" "$3}')")
NOTIFICATION="New Species Detected: ${SPECIES[@]}"
if ! diff "${IDFILE}" "${TMPFILE}" &> /dev/null; then
SPECIES=("$(diff "${IDFILE}" "${TMPFILE}" \
| grep "Common Name" \
| sort \
| awk '{for(i=4;i<=NF;++i)printf $i""FS ; print ""}')")
NOTIFICATION="New Species Detection: "${SPECIES[@]}""
echo "${NOTIFICATION}" && exit
sudo systemctl restart birdnet_analysis && sleep 30
sudo systemctl start extraction