From 0de100663c6787277f7ecc0c402d9c325fa344aa Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sun, 8 May 2022 09:20:32 -0400 Subject: [PATCH] fixed --- scripts/config.php | 13 +++++++++++-- scripts/update_birdnet_snippets.sh | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/config.php b/scripts/config.php index fa8c204..589d3f8 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -12,7 +12,13 @@ $pushed_app_secret = $_GET["pushed_app_secret"]; $apprise_input = $_GET['apprise_input']; $apprise_notification_title = $_GET['apprise_notification_title']; $apprise_notification_body = $_GET['apprise_notification_body']; -$apprise_notify_each_detection = $_GET['apprise_notify_each_detection']; +if(isset($_GET['apprise_notify_each_detection'])) { + $apprise_notify_each_detection = 1; +} else { + $apprise_notify_each_detection = 0; +} + + $contents = file_get_contents("/etc/birdnet/birdnet.conf"); $contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents); @@ -31,6 +37,9 @@ $contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2); $contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2); $contents2 = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents2); $contents2 = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents2); +$contents2 = preg_replace("/APPRISE_NOTIFICATION_TITLE=.*/", "APPRISE_NOTIFICATION_TITLE=$apprise_notification_title", $contents2); +$contents2 = preg_replace("/APPRISE_NOTIFICATION_BODY=.*/", "APPRISE_NOTIFICATION_BODY=$apprise_notification_body", $contents2); +$contents2 = preg_replace("/APPRISE_NOTIFY_EACH_DETECTION=.*/", "APPRISE_NOTIFY_EACH_DETECTION=$apprise_notify_each_detection", $contents2); $fh = fopen("/etc/birdnet/birdnet.conf", "w"); $fh2 = fopen("./scripts/thisrun.txt", "w"); @@ -119,7 +128,7 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {

- + >

Apprise Notifications can be setup and enabled for New Species notifications.

diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 43a71cd..e6ff1eb 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -13,7 +13,7 @@ if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf &>/dev/null;then sudo -u$USER echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf fi if ! grep APPRISE_NOTIFICATION_TITLE /etc/birdnet/birdnet.conf &>/dev/null;then - sudo -u$USER echo "\"APPRISE_NOTIFICATION_TITLE=New BirdNET-Pi Detection\"" >> /etc/birdnet/birdnet.conf + sudo -u$USER echo "APPRISE_NOTIFICATION_TITLE=\"New BirdNET-Pi Detection\"" >> /etc/birdnet/birdnet.conf fi if ! grep APPRISE_NOTIFICATION_BODY /etc/birdnet/birdnet.conf &>/dev/null;then sudo -u$USER echo "APPRISE_NOTIFICATION_BODY=\"A \$sciname \$comname was just detected with a confidence of \$confidence\"" >> /etc/birdnet/birdnet.conf