diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults index 3c8d158..2b6f9f3 100644 --- a/birdnet.conf-defaults +++ b/birdnet.conf-defaults @@ -56,17 +56,11 @@ BIRDNETPI_URL= RTSP_STREAM= -#------------------- Mobile Notifications via Pushed.co ---------------------# -#____________The two variables below enable mobile notifications_______________# -#_____________See https://pushed.co/quick-start-guide to get___________________# -#_________________________these values for your app.___________________________# +#----------------------- Apprise Miscellanous Configuration -------------------# -# Keep these EMPTY if haven't setup a Pushed.co App yet. # - -## Pushed.co App Key and App Secret - -PUSHED_APP_KEY= -PUSHED_APP_SECRET= +APPRISE_NOTIFICATION_TITLE="New BirdNET-Pi Detection" +APPRISE_NOTIFICATION_BODY="A \$sciname \$comname was just detected with a confidence of \$confidence" +APPRISE_NOTIFY_EACH_DETECTION=false ################################################################################ #-------------------------------- Defaults ----------------------------------# diff --git a/requirements.txt b/requirements.txt index 9f651b4..22f27e2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ pandas seaborn streamlit plotly +apprise \ No newline at end of file diff --git a/scripts/config.php b/scripts/config.php index fa6388a..7f2b1fb 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -9,26 +9,49 @@ $longitude = $_GET["longitude"]; $birdweather_id = $_GET["birdweather_id"]; $pushed_app_key = $_GET["pushed_app_key"]; $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']; +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); $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("/APPRISE_NOTIFICATION_TITLE=.*/", "APPRISE_NOTIFICATION_TITLE=\"$apprise_notification_title\"", $contents); +$contents = preg_replace("/APPRISE_NOTIFICATION_BODY=.*/", "APPRISE_NOTIFICATION_BODY=\"$apprise_notification_body\"", $contents); +$contents = preg_replace("/APPRISE_NOTIFY_EACH_DETECTION=.*/", "APPRISE_NOTIFY_EACH_DETECTION=$apprise_notify_each_detection", $contents); + $contents2 = file_get_contents("./scripts/thisrun.txt"); $contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2); $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"); fwrite($fh, $contents); fwrite($fh2, $contents2); +if(strlen($apprise_input) > 0){ + $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); + $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); + $home = trim($home); + + $appriseconfig = fopen($home."/BirdNET-Pi/apprise.txt", "w"); + fwrite($appriseconfig, $apprise_input); +} + + $language = $_GET["language"]; if ($language != "none"){ $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); @@ -54,6 +77,14 @@ if (file_exists('./scripts/thisrun.txt')) { } elseif (file_exists('./scripts/firstrun.ini')) { $config = parse_ini_file('./scripts/firstrun.ini'); } +$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); +$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); +$home = trim($home); +if (file_exists($home."/BirdNET-Pi/apprise.txt")) { + $apprise_config = file_get_contents($home."/BirdNET-Pi/apprise.txt"); +} else { + $apprise_config = ""; +} $caddypwd = $config['CADDY_PWD']; if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); @@ -78,12 +109,24 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {

Set your Latitude and Longitude to 4 decimal places. Get your coordinates here.


-

BirdWeather.com is a weather map for bird sounds. Stations around the world supply audio and video streams to BirdWeather where they are then analyzed by BirdNET and compared to eBird Grid data. BirdWeather catalogues the bird audio and spectrogram visualizations so that you can listen to, view, and read about birds throughout the world. Email Tim to request a BirdWeather ID

- -
- -
-

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.

+

BirdWeather.com is a weather map for bird sounds. Stations around the world supply audio and video streams to BirdWeather where they are then analyzed by BirdNET and compared to eBird Grid data. BirdWeather catalogues the bird audio and spectrogram visualizations so that you can listen to, view, and read about birds throughout the world. Email Tim to request a BirdWeather ID


+

Notifications

+

Apprise Notifications can be setup and enabled for 70+ notification services. Each service should be on its own line.

+ +

+ +
+ +
+ +
+ > +

+

Localization

-