From d5255e1edbce8c9a893902511103979b08e1dab7 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Mon, 30 May 2022 09:49:52 -0400 Subject: [PATCH] Adding copylink to Apprise notification body --- scripts/config.php | 2 +- scripts/server.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/config.php b/scripts/config.php index d3a8b6a..2fe8e92 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -167,7 +167,7 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken} ..." style="vertical-align: top" name="apprise_input" cols="140" rows="5" type="text" >


- +
>
diff --git a/scripts/server.py b/scripts/server.py index dd386b8..2547688 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -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, )