adding notifications for each detection
This commit is contained in:
+1
-1
@@ -105,7 +105,7 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
|||||||
<p><a target="_blank" href="https://pushed.co/quick-start-guide">Pushed iOS Notifications</a> can be setup and enabled for New Species notifications. Be sure to "Enable" the "Pushed Notifications" in "Tools" > "Services" if you would like to use this feature. Sorry, Android users, this only works on iOS.</p>
|
<p><a target="_blank" href="https://pushed.co/quick-start-guide">Pushed iOS Notifications</a> can be setup and enabled for New Species notifications. Be sure to "Enable" the "Pushed Notifications" in "Tools" > "Services" if you would like to use this feature. Sorry, Android users, this only works on iOS.</p>
|
||||||
|
|
||||||
<label for="apprise_input">Apprise Notifications Configuration: </label>
|
<label for="apprise_input">Apprise Notifications Configuration: </label>
|
||||||
<textarea name="apprise_input" type="text" ><?php print($apprise_config);?></textarea>
|
<textarea cols="140" name="apprise_input" type="text" ><?php print($apprise_config);?></textarea>
|
||||||
<p><a target="_blank" href="https://github.com/caronc/apprise/wiki">Apprise Notifications</a> can be setup and enabled for New Species notifications.</p>
|
<p><a target="_blank" href="https://github.com/caronc/apprise/wiki">Apprise Notifications</a> can be setup and enabled for New Species notifications.</p>
|
||||||
|
|
||||||
<label for="language">Database Language: </label>
|
<label for="language">Database Language: </label>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ from time import sleep
|
|||||||
import pytz
|
import pytz
|
||||||
from tzlocal import get_localzone
|
from tzlocal import get_localzone
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import apprise
|
||||||
|
|
||||||
|
|
||||||
HEADER = 64
|
HEADER = 64
|
||||||
@@ -203,6 +204,17 @@ def analyzeAudioData(chunks, lat, lon, week, sensitivity, overlap,):
|
|||||||
|
|
||||||
return detections
|
return detections
|
||||||
|
|
||||||
|
def sendAppriseNotifications(species,confidence):
|
||||||
|
apobj = apprise.Apprise()
|
||||||
|
config = apprise.AppriseConfig()
|
||||||
|
config.add(userDir + '/BirdNET-Pi/apprise.txt')
|
||||||
|
apobj.add(config)
|
||||||
|
|
||||||
|
apobj.notify(
|
||||||
|
body='A '+species+' was just detected with a confidence of '+confidence,
|
||||||
|
title='New BirdNET-Pi Detection',
|
||||||
|
)
|
||||||
|
|
||||||
def writeResultsToFile(detections, min_conf, path):
|
def writeResultsToFile(detections, min_conf, path):
|
||||||
|
|
||||||
print('WRITING RESULTS TO', path, '...', end=' ')
|
print('WRITING RESULTS TO', path, '...', end=' ')
|
||||||
@@ -212,6 +224,8 @@ def writeResultsToFile(detections, min_conf, path):
|
|||||||
for d in detections:
|
for d in detections:
|
||||||
for entry in detections[d]:
|
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 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 os.path.getsize(userDir + '/BirdNET-Pi/apprise.txt') > 0:
|
||||||
|
sendAppriseNotifications(str(entry[0]),str(entry[1]));
|
||||||
rfile.write(d + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + '\n')
|
rfile.write(d + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + '\n')
|
||||||
rcnt += 1
|
rcnt += 1
|
||||||
print('DONE! WROTE', rcnt, 'RESULTS.')
|
print('DONE! WROTE', rcnt, 'RESULTS.')
|
||||||
|
|||||||
Reference in New Issue
Block a user