starting this to get some help

This commit is contained in:
mcguirepr89
2022-05-23 18:41:16 -04:00
parent 87f34b494b
commit cdbadbb45c
8 changed files with 37 additions and 36 deletions
+26
View File
@@ -243,6 +243,32 @@ def sendAppriseNotifications(species,confidence):
title=title,
)
if str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFY_NEW_SPECIES')]).split('=')[1]).split('\\')[0]) == "1":
try:
con = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db')
cur = con.cursor()
cur.execute("SELECT DISTINCT(Com_Name) FROM detections")
known_species = cur.fetchall()
sciName,comName = species.split("_")
print("\ncomName: ",comName)
print("\nknown_species: ",known_species)
if comName not in known_species:
apobj = apprise.Apprise()
config = apprise.AppriseConfig()
config.add(userDir + '/BirdNET-Pi/apprise.txt')
apobj.add(config)
apobj.notify(
body=body.replace("$sciname",species.split("_")[0]).replace("$comname",species.split("_")[1]).replace("$confidence",confidence),
title=title,
)
con.close()
except:
print("Database busy")
time.sleep(2)
def writeResultsToFile(detections, min_conf, path):
print('WRITING RESULTS TO', path, '...', end=' ')