From a9893c519ba6aa362699443f028a0004b4ac99d9 Mon Sep 17 00:00:00 2001
From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com>
Date: Thu, 28 Apr 2022 08:44:51 -0400
Subject: [PATCH 01/62] Adding notify.run browser notifications
---
birdnet.conf-defaults | 11 +++++++++++
scripts/config.php | 8 ++++++++
scripts/install_config.sh | 11 +++++++++++
scripts/species_notifier.sh | 4 ++++
scripts/update_birdnet.sh | 4 ++++
5 files changed, 38 insertions(+)
diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index 5863aab..6a7aa7f 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -61,6 +61,17 @@ BIRDNETPI_URL=
PUSHED_APP_KEY=
PUSHED_APP_SECRET=
+#------------------- Browser Notifications via Notify.run -------------------#
+#________________The variable below enables browser notifications______________#
+#________________________See https://notify.run/ to get________________________#
+#_________________ __these subscription URL for your device.___________________#
+
+# Keep these EMPTY if haven't setup a Notify.run Channel yet. #
+
+## Notify.run Channel ID
+
+NOTIFY_RUN_CHANNEL_ID=
+
################################################################################
#-------------------------------- Defaults ----------------------------------#
################################################################################
diff --git a/scripts/config.php b/scripts/config.php
index fa6388a..cebf813 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -9,6 +9,7 @@ $longitude = $_GET["longitude"];
$birdweather_id = $_GET["birdweather_id"];
$pushed_app_key = $_GET["pushed_app_key"];
$pushed_app_secret = $_GET["pushed_app_secret"];
+$notify_run_channel = $_GET["notify_run_channel"];
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
@@ -16,6 +17,7 @@ $contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents);
$contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents);
$contents = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents);
$contents = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents);
+$contents = preg_replace("/NOTIFY_RUN_CHANNEL_ID=.*/", "NOTIFY_RUN_CHANNEL_ID=$notify_run_channel", $contents);
$contents2 = file_get_contents("./scripts/thisrun.txt");
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
@@ -23,6 +25,7 @@ $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("/NOTIFY_RUN_CHANNEL_ID=.*/", "NOTIFY_RUN_CHANNEL_ID=$notify_run_channel", $contents2);
$fh = fopen("/etc/birdnet/birdnet.conf", "w");
$fh2 = fopen("./scripts/thisrun.txt", "w");
@@ -84,6 +87,11 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
Pushed App Secret:
Pushed iOS Notifications can be setup and enabled for New Species notifications. Be sure to "Enable" the "Pushed Notifications" in "Tools" > "Services" if you would like to use this feature. Sorry, Android users, this only works on iOS.
+
+ Notify.run Channel ID:
+
+ Notify.run browser notifications can be setup and enabled for New Species notifications.
+
Database Language:
Select your language
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index cbd29f1..094a3b4 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -74,6 +74,17 @@ BIRDNETPI_URL=
PUSHED_APP_KEY=
PUSHED_APP_SECRET=
+#------------------- Browser Notifications via Notify.run -------------------#
+#________________The variable below enables browser notifications______________#
+#________________________See https://notify.run/ to get________________________#
+#_________________ __these subscription URL for your device.___________________#
+
+# Keep these EMPTY if haven't setup a Notify.run Channel yet. #
+
+## Notify.run Channel ID
+
+NOTIFY_RUN_CHANNEL_ID=
+
################################################################################
#-------------------------------- Defaults ----------------------------------#
################################################################################
diff --git a/scripts/species_notifier.sh b/scripts/species_notifier.sh
index 9596754..a441612 100755
--- a/scripts/species_notifier.sh
+++ b/scripts/species_notifier.sh
@@ -21,6 +21,10 @@ if ! diff ${IDFILE} ${lastcheck} &> /dev/null;then
echo "Sending the following notification:
${NOTIFICATION}"
+ if [ ! -z ${NOTIFY_RUN_CHANNEL_ID} ];then
+ curl https://notify.run/${NOTIFY_RUN_CHANNEL_ID} -d ${NOTIFICATION}
+ fi
+
if [ ! -z ${PUSHED_APP_KEY} ];then
curl -X POST \
--form-string "app_key=${PUSHED_APP_KEY}" \
diff --git a/scripts/update_birdnet.sh b/scripts/update_birdnet.sh
index a48e7d6..f003123 100755
--- a/scripts/update_birdnet.sh
+++ b/scripts/update_birdnet.sh
@@ -18,3 +18,7 @@ fi
if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf;then
sudo -u${USER} echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf
fi
+if ! grep NOTIFY_RUN_CHANNEL_ID /etc/birdnet/birdnet.conf;then
+ sudo -u${USER} echo "NOTIFY_RUN_CHANNEL_ID=" >> /etc/birdnet/birdnet.conf
+fi
+
From 0470cda32ddc32656f7ef6fdaf451521f43ffea0 Mon Sep 17 00:00:00 2001
From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com>
Date: Fri, 6 May 2022 08:31:31 -0400
Subject: [PATCH 02/62] Update overview.php
---
scripts/overview.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/overview.php b/scripts/overview.php
index d45d588..cba8a9f 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -192,7 +192,7 @@ function loadDetectionIfNewExists(previous_detection_identifier=undefined) {
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
// if there's a new detection that needs to be updated to the page
- if(this.responseText.length > 0) {
+ if(this.responseText.length > 0 && !this.responseText.includes("Database is busy.")) {
document.getElementById("most_recent_detection").innerHTML = this.responseText;
// only going to load left chart if there's a new detection
From af19c611cfe697ac8abe98e2acbf6b62925a9f46 Mon Sep 17 00:00:00 2001
From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com>
Date: Fri, 6 May 2022 09:59:39 -0400
Subject: [PATCH 03/62] Update README.md
---
README.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/README.md b/README.md
index 239359a..540c69b 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,7 @@ Currently listening in these countries . . . that I know of . . .
- Finland
- Australia
- Canada
+- Switzerland
## Features
* 24/7 recording and BirdNET-Lite analysis
From d092d4fa7981fd13f65a679d1b143d0c80ee1134 Mon Sep 17 00:00:00 2001
From: mcguirepr89
Date: Fri, 6 May 2022 10:23:34 -0400
Subject: [PATCH 04/62] replaced radio buttons with slider
---
scripts/advanced.php | 48 ++++++++++++++++++++------------------------
1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/scripts/advanced.php b/scripts/advanced.php
index bfcd285..f3859df 100644
--- a/scripts/advanced.php
+++ b/scripts/advanced.php
@@ -109,27 +109,16 @@ if(isset($_GET['submit'])) {
}
}
- if(isset($_GET["privacy_mode"])) {
- $privacy_mode = $_GET["privacy_mode"];
- if(strcmp($config['PRIVACY_MODE'], "1") == 0 ) {
+ if(isset($_GET["privacy_threshold"])) {
+ $privacy_threshold = $_GET["privacy_threshold"];
+ if(strcmp($config['PRIVACY_THRESHOLD'], "1") == 0 ) {
$pmode = "on";
- }elseif(strcmp($config['PRIVACY_MODE'], "") == 0) {
+ }elseif(strcmp($config['PRIVACY_THRESHOLD'], "") == 0) {
$pmode = "off";
}
- if(strcmp($privacy_mode,$pmode) !== 0) {
- $contents = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents);
- $contents2 = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents2);
- if(strcmp($privacy_mode,"on") == 0) {
- exec('sudo sed -i \'s/\/usr\/local\/bin\/server.py/\/usr\/local\/bin\/privacy_server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service');
- exec('sudo systemctl daemon-reload');
- exec('restart_services.sh');
- header('Location: /log');
- } elseif(strcmp($privacy_mode,"off") == 0) {
- exec('sudo sed -i \'s/\/usr\/local\/bin\/privacy_server.py/\/usr\/local\/bin\/server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service');
- exec('sudo systemctl daemon-reload');
- exec('restart_services.sh');
- header('Location: /log');
- }
+ if(strcmp($privacy_threshold,$pmode) !== 0) {
+ $contents = preg_replace("/PRIVACY_THRESHOLD=.*/", "PRIVACY_THRESHOLD=$privacy_threshold", $contents);
+ $contents2 = preg_replace("/PRIVACY_THRESHOLD=.*/", "PRIVACY_THRESHOLD=$privacy_threshold", $contents2);
}
}
@@ -194,14 +183,21 @@ if (file_exists('./scripts/thisrun.txt')) {
?>
Advanced Settings