Files
AvianVisitors/scripts/testy.sh
T
ehpersonal38 21beea2f2d perms
2023-04-07 15:01:34 -04:00

17 lines
616 B
Bash
Executable File

#!/bin/bash
# Loop through each entry in birds.db
sqlite3 ~/BirdNET-Pi/scripts/birds.db "SELECT DISTINCT Sci_Name FROM detections" | while read -r row; do
# Get Sci_Name from current row
sci_name=$(echo "$row" | cut -d '|' -f 3)
# Look up ComName for Sci_Name
com_name=$(grep -iE "$sci_name.*" ~/BirdNET-Pi/model/labels.txt | cut -d '_' -f 2-)
if [[ -n "$com_name" ]]; then
# Update Com_Name in birds.db
sqlite3 ~/BirdNET-Pi/scripts/birds.db "UPDATE detections SET Com_Name='$com_name' WHERE Sci_Name='$sci_name'"
echo "SETTING "$com_name" WHERE sciname="$sci_name"\n"
fi
done