Adding copylink to Apprise notification body
This commit is contained in:
+1
-1
@@ -167,7 +167,7 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
|
||||
..." style="vertical-align: top" name="apprise_input" cols="140" rows="5" type="text" ><?php print($apprise_config);?></textarea><br><br>
|
||||
<label for="apprise_notification_title">Notification Title: </label>
|
||||
<input name="apprise_notification_title" type="text" value="<?php print($config['APPRISE_NOTIFICATION_TITLE']);?>" /><br>
|
||||
<label for="apprise_notification_body">Notification Body (use variables $sciname, $comname, or $confidence): </label>
|
||||
<label for="apprise_notification_body">Notification Body (use variables $sciname, $comname, $confidence, or $listenurl): </label>
|
||||
<input name="apprise_notification_body" type="text" value="<?php print($config['APPRISE_NOTIFICATION_BODY']);?>" /><br>
|
||||
<input type="checkbox" name="apprise_notify_new_species" <?php if($config['APPRISE_NOTIFY_NEW_SPECIES'] == 1 && filesize($home."/BirdNET-Pi/apprise.txt") != 0) { echo "checked"; };?> >
|
||||
<label for="apprise_notify_new_species">Notify each new infrequent species detection (<5 visits per week)</label><br>
|
||||
|
||||
+3
-2
@@ -234,6 +234,7 @@ def sendAppriseNotifications(species, confidence):
|
||||
this_run = f.readlines()
|
||||
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('"', '')
|
||||
listenurl = str(str(str([i for i in this_run if i.startswith('BIRDNETPI_URL')]).split('=')[1]).split('\\')[0]).replace('"', '')+"?filename="+species.split("_")[1].replace(" ","_")+"-"+str(round(float(confidence)*100))+"-"+path.split("/")[len(path.split("/"))-1].split(".")[0]+".mp3"
|
||||
|
||||
if str(str(str([i for i in this_run if i.startswith('APPRISE_NOTIFY_EACH_DETECTION')]).split('=')[1]).split('\\')[0]) == "1":
|
||||
|
||||
@@ -243,7 +244,7 @@ def sendAppriseNotifications(species, confidence):
|
||||
apobj.add(config)
|
||||
|
||||
apobj.notify(
|
||||
body=body.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence),
|
||||
body=body.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence).replace("$listenurl", listenurl),
|
||||
title=title,
|
||||
)
|
||||
|
||||
@@ -262,7 +263,7 @@ def sendAppriseNotifications(species, confidence):
|
||||
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) + " (only seen "+str(int(numberDetections)+1)+" times in last 7d)",
|
||||
body=body.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence).replace("$listenurl", listenurl) + " (only seen "+str(int(numberDetections)+1)+" times in last 7d)",
|
||||
title=title,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user