A live bird collage card for your Home Assistant dashboard.
Update server.py
ehpersonal38799e8ce7f9ac
diff --git a/scripts/server.py b/scripts/server.pyindex 4bb6e40a..34bf9385 100755--- a/scripts/server.py+++ b/scripts/server.py@@ -211,15 +211,17 @@ def sendAppriseNotifications(species,confidence):title = str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFICATION_TITLE')]).split('=')[1]).split('\\')[0]).replace('"', '')body = str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFICATION_BODY')]).split('=')[1]).split('\\')[0]).replace('"', '')- apobj = apprise.Apprise()- config = apprise.AppriseConfig()- config.add(userDir + '/BirdNET-Pi/apprise.txt')- apobj.add(config)+ if str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFY_EACH_DETECTION')]).split('=')[1]).split('\\')[0]) == "1":++ 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,- )+ apobj.notify(+ body=body.replace("$sciname",species.split("_")[0]).replace("$comname",species.split("_")[1]).replace("$confidence",confidence),+ title=title,+ )def writeResultsToFile(detections, min_conf, path):@@ -230,8 +232,7 @@ def writeResultsToFile(detections, min_conf, path):for d in detections:for entry in detections[d]:if entry[1] >= min_conf and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0) and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0) ):- if str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFY_EACH_DETECTION')]).split('=')[1]).split('\\')[0]) == "1":- sendAppriseNotifications(str(entry[0]),str(entry[1]));+ sendAppriseNotifications(str(entry[0]),str(entry[1]));rfile.write(d + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + '\n')rcnt += 1print('DONE! WROTE', rcnt, 'RESULTS.')