A live bird collage card for your Home Assistant dashboard.
Adding copylink to Apprise notification body
ehpersonal38d5255e1edbce
diff --git a/scripts/config.php b/scripts/config.phpindex d3a8b6a6..2fe8e922 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" ><?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>diff --git a/scripts/server.py b/scripts/server.pyindex dd386b81..2547688c 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,)