From 2e10298b7b8d29719fbcec316914fee995f63595 Mon Sep 17 00:00:00 2001
From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com>
Date: Mon, 20 Mar 2023 16:12:15 -0400
Subject: [PATCH] Apprise ONLY notify for certain species
---
birdnet.conf-defaults | 1 +
scripts/config.php | 7 ++++++-
scripts/install_config.sh | 1 +
scripts/update_birdnet_snippets.sh | 4 ++++
scripts/utils/notifications.py | 5 +++++
5 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index d2cacea..03ca9f5 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -77,6 +77,7 @@ APPRISE_NOTIFY_NEW_SPECIES=0
APPRISE_WEEKLY_REPORT=1
APPRISE_NOTIFY_NEW_SPECIES_EACH_DAY=0
APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=0
+APPRISE_ONLY_NOTIFY_SPECIES_NAMES=""
#---------------------- Flickr Images API Configuration -----------------------#
## If FLICKR_API_KEY is set, the web interface will try and display bird images
diff --git a/scripts/config.php b/scripts/config.php
index 7ecefe8..6912af4 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -53,6 +53,7 @@ if(isset($_GET["latitude"])){
$timezone = $_GET["timezone"];
$model = $_GET["model"];
$sf_thresh = $_GET["sf_thresh"];
+ $only_notify_species_names = $_GET['only_notify_species_names'];
if(isset($_GET['apprise_notify_each_detection'])) {
$apprise_notify_each_detection = 1;
@@ -154,6 +155,7 @@ if(isset($_GET["latitude"])){
$contents = preg_replace("/APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=.*/", "APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=$minimum_time_limit", $contents);
$contents = preg_replace("/MODEL=.*/", "MODEL=$model", $contents);
$contents = preg_replace("/SF_THRESH=.*/", "SF_THRESH=$sf_thresh", $contents);
+ $contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents);
$contents2 = file_get_contents("./scripts/thisrun.txt");
$contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2);
@@ -172,6 +174,7 @@ if(isset($_GET["latitude"])){
$contents2 = preg_replace("/APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=.*/", "APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=$minimum_time_limit", $contents2);
$contents2 = preg_replace("/MODEL=.*/", "MODEL=$model", $contents2);
$contents2 = preg_replace("/SF_THRESH=.*/", "SF_THRESH=$sf_thresh", $contents2);
+ $contents2 = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents2);
@@ -549,8 +552,10 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}