From 5c2aab01e44dd0e51e39b25a858b55ac289723f5 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 26 May 2022 10:24:45 -0400 Subject: [PATCH 01/26] Show # of commits local repo is behind by, on Sys Controls --- homepage/style.css | 12 ++++++++++++ scripts/system_controls.php | 10 ++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/homepage/style.css b/homepage/style.css index 88ac29e..f54d98d 100644 --- a/homepage/style.css +++ b/homepage/style.css @@ -687,4 +687,16 @@ dialog::backdrop { #gain.centered { margin-bottom:10px; +} + +.updatenumber { + margin-left:5px; + position:absolute; + display:inline-block; + background-color:#c8191a; + color:white; + width:20px; + line-height:20px; + border-radius:12px; + text-align:center; } \ No newline at end of file diff --git a/scripts/system_controls.php b/scripts/system_controls.php index 35e5072..6abc714 100644 --- a/scripts/system_controls.php +++ b/scripts/system_controls.php @@ -1,3 +1,9 @@ + /dev/null 2>&1 && git -C ".$home."/BirdNET-Pi status | sed -n '2 p' | cut -d ' ' -f 7")); +?>
@@ -7,12 +13,12 @@
- +
-
+ From 4ec734890157f0425c0cb977770f6fae71fde57f Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 26 May 2022 10:27:26 -0400 Subject: [PATCH 02/26] More update clarity --- homepage/views.php | 1 + 1 file changed, 1 insertion(+) diff --git a/homepage/views.php b/homepage/views.php index 49c0537..cc5d30a 100644 --- a/homepage/views.php +++ b/homepage/views.php @@ -268,6 +268,7 @@ if(isset($_GET['view'])){ $results = str_replace("FAILURE", "FAILURE", $results); $results = str_replace("failed", "failed",$results); $results = str_replace("active (running)", "active (running)",$results); + $results = str_replace("Your branch is up to date", "Your branch is up to date",$results); if(strlen($results) == 0) { $results = "This command has no output."; } From 847db6d65f77aa0711c05ee0dcdd3bf6307bbc08 Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Thu, 26 May 2022 11:00:57 -0400 Subject: [PATCH 03/26] silencing that check --- scripts/update_birdnet_snippets.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 7c13581..9022d25 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -61,7 +61,7 @@ fi if ! grep FLICKR_API_KEY /etc/birdnet/birdnet.conf &>/dev/null;then sudo -u$USER echo "FLICKR_API_KEY=" >> /etc/birdnet/birdnet.conf fi -if systemctl list-unit-files pushed_notifications.service;then +if systemctl list-unit-files pushed_notifications.service &>/dev/null;then sudo systemctl disable --now pushed_notifications.service sudo rm -f /usr/lib/systemd/system/pushed_notifications.service sudo rm $HOME/BirdNET-Pi/templates/pushed_notifications.service From 61adf3fec55c9cc3f37742990abb9e2e732b6428 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 26 May 2022 12:10:11 -0400 Subject: [PATCH 04/26] No leaky Flickr API keys on error --- scripts/overview.php | 2 ++ scripts/stats.php | 5 ++--- scripts/todays_detections.php | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index 889ba03..fdc6d22 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -1,4 +1,6 @@ Date: Thu, 26 May 2022 12:38:41 -0400 Subject: [PATCH 05/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e062b65..d93bea3 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Currently listening in these countries . . . that I know of . . . * [Tiny File Manager](https://tinyfilemanager.github.io/) * FTP server included * SQLite3 Database -* Adminer database maintenance +* [Adminer]([url](https://www.adminer.org/)) database maintenance * [phpSysInfo](https://github.com/phpsysinfo/phpsysinfo) * [Apprise Notifications](https://github.com/caronc/apprise) supporting 70+ notification platforms * Localization supported From 9f4c4b1291d25fc9a53bbd1a933b5df03a17e9b8 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 26 May 2022 13:20:26 -0400 Subject: [PATCH 06/26] Update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..160740e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. From ae7fce7d5eedc38df04af48d2d8230b8b26515c0 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 26 May 2022 13:21:08 -0400 Subject: [PATCH 07/26] Update issue templates --- .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 6739586f90ba60194d7780c06f3ee96b7bdac7e1 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 26 May 2022 14:30:04 -0400 Subject: [PATCH 08/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d93bea3..dcfdb89 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Currently listening in these countries . . . that I know of . . . * [Tiny File Manager](https://tinyfilemanager.github.io/) * FTP server included * SQLite3 Database -* [Adminer]([url](https://www.adminer.org/)) database maintenance +* [Adminer](https://www.adminer.org/) database maintenance * [phpSysInfo](https://github.com/phpsysinfo/phpsysinfo) * [Apprise Notifications](https://github.com/caronc/apprise) supporting 70+ notification platforms * Localization supported From 10696da550aabdabdc0bfbd404af5a3abaab8a3a Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 26 May 2022 14:31:48 -0400 Subject: [PATCH 09/26] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dcfdb89..659126c 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Currently listening in these countries . . . that I know of . . . * Live audio stream & spectrogram * [BirdWeather](https://app.birdweather.com) integration -- you can request a BirdWeather ID from BirdNET-Pi's "Tools" > "Settings" page * Web interface access to all data and logs provided by [Caddy](https://caddyserver.com) -* Web Terminal +* [GoTTY](https://github.com/yudai/gotty) Web Terminal * [Tiny File Manager](https://tinyfilemanager.github.io/) * FTP server included * SQLite3 Database From 1062e1cc66235182d7d5a22bd0a276208e6a291b Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Thu, 26 May 2022 14:44:00 -0400 Subject: [PATCH 10/26] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 659126c..75b71c9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ BirdNET-Pi

-A realtime acoustic bird classification system for the Raspberry Pi 4B +A realtime acoustic bird classification system for the Raspberry Pi 4B, 3B+, and 0W2

@@ -60,12 +60,13 @@ Currently listening in these countries . . . that I know of . . . * Localization supported ## Requirements -* A Raspberry Pi 4B or Raspberry Pi 3B+ (The 3B+ must run on RaspiOS-ARM64-**Lite**) -* An SD Card with the **_64-bit version of RaspiOS_** installed (please use Bullseye) -- Lite is recommended, but the installation works on RaspiOS-ARM64-Full as well. [(Download the latest here)](https://downloads.raspberrypi.org/raspios_lite_arm64/images/) +* A Raspberry Pi 4B, Raspberry Pi 3B+, or Raspberry Pi 0W2 (The 3B+ and 0W2 must run on RaspiOS-ARM64-**Lite**) +* An SD Card with the **_64-bit version of RaspiOS_** installed (please use Bullseye) -- Lite is recommended, but the installation works on RaspiOS-ARM64-Full as well. Downloads available within the [Raspberry Pi Imager](https://www.raspberrypi.com/software/). * A USB Microphone or Sound Card ## Installation [A comprehensive installation guide is available here](https://github.com/mcguirepr89/BirdNET-Pi/wiki/Installation-Guide). +[Raspberry Pi 0W2 installation guide available here](https://github.com/mcguirepr89/BirdNET-Pi/wiki/RPi0W2-Installation-Guide) The system can be installed with: ``` From 47c756c3e06a6a8b9ae2c86a2538457c439c4393 Mon Sep 17 00:00:00 2001 From: Jake Herbst Date: Thu, 26 May 2022 16:33:11 -0400 Subject: [PATCH 11/26] Adding better support for database language configuration --- birdnet.conf-defaults | 4 + scripts/config.php | 258 +++++++++++++++++------------ scripts/install_birdnet.sh | 14 +- scripts/install_config.sh | 4 +- scripts/install_language_label.sh | 26 +++ scripts/update_birdnet_snippets.sh | 14 +- 6 files changed, 197 insertions(+), 123 deletions(-) create mode 100755 scripts/install_language_label.sh diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults index e53af20..3ada803 100644 --- a/birdnet.conf-defaults +++ b/birdnet.conf-defaults @@ -150,6 +150,10 @@ EXTRACTION_LENGTH= AUDIOFMT=mp3 +## DATABASE_LANG is used to set the language for the database + +DATABASE_LANG=en + ## These are just for debugging LAST_RUN= THIS_RUN= diff --git a/scripts/config.php b/scripts/config.php index 8b13084..bd55200 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -2,89 +2,112 @@ error_reporting(E_ERROR); ini_set('display_errors',1); -# Basic Settings -if(isset($_GET["latitude"])){ -$latitude = $_GET["latitude"]; -$longitude = $_GET["longitude"]; -$birdweather_id = $_GET["birdweather_id"]; -$apprise_input = $_GET['apprise_input']; -$apprise_notification_title = $_GET['apprise_notification_title']; -$apprise_notification_body = $_GET['apprise_notification_body']; -$flickr_api_key = $_GET['flickr_api_key']; -if(isset($_GET['apprise_notify_each_detection'])) { - $apprise_notify_each_detection = 1; -} else { - $apprise_notify_each_detection = 0; -} -if(isset($_GET['apprise_notify_new_species'])) { - $apprise_notify_new_species = 1; -} else { - $apprise_notify_new_species = 0; -} +function syslog_shell_exec($cmd, $sudo_user = null) { + if ($sudo_user) { + $cmd = "sudo -u $sudo_user $cmd"; + } + $output = shell_exec($cmd); -// logic for setting the date and time based on user inputs from the form below -if(isset($_GET['date']) && isset($_GET['time'])) { - // can't set the date manually if it's getting it from the internet, disable ntp - exec("sudo timedatectl set-ntp false"); - - exec("sudo date -s '".$_GET['date']." ".$_GET['time']."'"); -} else { - // user checked 'use time from internet if available,' so make sure that's on - if(strlen(trim(exec("sudo timedatectl | grep \"NTP service: active\""))) == 0){ - exec("sudo timedatectl set-ntp true"); - sleep(3); + if (strlen($output) > 0) { + syslog(LOG_INFO, $output); } } +# Basic Settings +if(isset($_GET["latitude"])){ + $latitude = $_GET["latitude"]; + $longitude = $_GET["longitude"]; + $birdweather_id = $_GET["birdweather_id"]; + $apprise_input = $_GET['apprise_input']; + $apprise_notification_title = $_GET['apprise_notification_title']; + $apprise_notification_body = $_GET['apprise_notification_body']; + $flickr_api_key = $_GET['flickr_api_key']; + $language = $_GET["language"]; + + if(isset($_GET['apprise_notify_each_detection'])) { + $apprise_notify_each_detection = 1; + } else { + $apprise_notify_each_detection = 0; + } + if(isset($_GET['apprise_notify_new_species'])) { + $apprise_notify_new_species = 1; + } else { + $apprise_notify_new_species = 0; + } + + // logic for setting the date and time based on user inputs from the form below + if(isset($_GET['date']) && isset($_GET['time'])) { + // can't set the date manually if it's getting it from the internet, disable ntp + exec("sudo timedatectl set-ntp false"); + + exec("sudo date -s '".$_GET['date']." ".$_GET['time']."'"); + } else { + // user checked 'use time from internet if available,' so make sure that's on + if(strlen(trim(exec("sudo timedatectl | grep \"NTP service: active\""))) == 0){ + exec("sudo timedatectl set-ntp true"); + sleep(3); + } + } + + // Update Language settings only if a change is requested + if (file_exists('./scripts/thisrun.txt')) { + $lang_config = parse_ini_file('./scripts/thisrun.txt'); + } elseif (file_exists('./scripts/firstrun.ini')) { + $lang_config = parse_ini_file('./scripts/firstrun.ini'); + } + if ($language != $lang_config['DATABASE_LANG']){ + $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd")); + $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd")); + + // Archive old language file + syslog_shell_exec("cp -f $home/BirdNET-Pi/model/labels.txt $home/BirdNET-Pi/model/labels.txt.old", $user); + + // Install new language label file + syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh -l $language", $user); + + syslog(LOG_INFO, "Successfully changed language to '$language'"); + } + $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("/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); + $contents = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents); + $contents = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents); + $contents = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents); -$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("/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); -$contents = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents); -$contents = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $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("/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); + $contents2 = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents2); + $contents2 = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents2); + $contents2 = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents2); -$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("/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); -$contents2 = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents2); -$contents2 = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents2); + $fh = fopen("/etc/birdnet/birdnet.conf", "w"); + $fh2 = fopen("./scripts/thisrun.txt", "w"); + fwrite($fh, $contents); + fwrite($fh2, $contents2); + if(isset($apprise_input)){ + $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); + $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); + $home = trim($home); -$fh = fopen("/etc/birdnet/birdnet.conf", "w"); -$fh2 = fopen("./scripts/thisrun.txt", "w"); -fwrite($fh, $contents); -fwrite($fh2, $contents2); + $appriseconfig = fopen($home."/BirdNET-Pi/apprise.txt", "w"); + fwrite($appriseconfig, $apprise_input); + } -if(isset($apprise_input)){ - $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"); - $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); - $home = trim($home); - $command = "sudo -u".$user." mv ".$home."/BirdNET-Pi/model/labels.txt ".$home."/BirdNET-Pi/model/labels.txt.old && sudo -u".$user." unzip ".$home."/BirdNET-Pi/model/labels_l18n.zip ".$language." -d ".$home."/BirdNET-Pi/model && sudo -u".$user." mv ".$home."/BirdNET-Pi/model/".$language." ".$home."/BirdNET-Pi/model/labels.txt"; - $command_output = `$command`; - `sudo restart_services.sh`; -} + syslog(LOG_INFO, "Restarting Services"); + shell_exec("sudo restart_services.sh"); } ?> @@ -95,12 +118,12 @@ if ($language != "none"){

Basic Settings

-Localization

- 0) { + if (strlen($tdc) > 0) { $checkedvalue = "checked"; $disabledvalue = "disabled"; } else { diff --git a/scripts/install_birdnet.sh b/scripts/install_birdnet.sh index e09d495..432bdc1 100755 --- a/scripts/install_birdnet.sh +++ b/scripts/install_birdnet.sh @@ -11,7 +11,7 @@ cd $my_dir/scripts || exit 1 if [ "$(uname -m)" != "aarch64" ];then echo "BirdNET-Pi requires a 64-bit OS. -It looks like your operating system is using $(uname -m), +It looks like your operating system is using $(uname -m), but would need to be aarch64. Please take a look at https://birdnetwiki.pmcgui.xyz for more information" @@ -31,14 +31,10 @@ install_birdnet() { pip3 install -U -r $HOME/BirdNET-Pi/requirements.txt } -unpack_labels() { - unzip $HOME/BirdNET-Pi/model/labels_l18n.zip labels_en.txt \ - -d $HOME/BirdNET-Pi/model - mv $HOME/BirdNET-Pi/model/labels_en.txt $HOME/BirdNET-Pi/model/labels.txt -} - [ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} &> /dev/null -install_birdnet -unpack_labels +install_birdnet + +./install_language_label.sh -l $DATABASE_LANG || exit 1 + exit 0 diff --git a/scripts/install_config.sh b/scripts/install_config.sh index daab688..6b579e8 100755 --- a/scripts/install_config.sh +++ b/scripts/install_config.sh @@ -163,6 +163,8 @@ EXTRACTION_LENGTH= AUDIOFMT=mp3 +## DATABASE_LANG is the language used for the bird species database +DATABASE_LANG=en ## These are just for debugging LAST_RUN= @@ -171,7 +173,7 @@ IDFILE=$HOME/BirdNET-Pi/IdentifiedSoFar.txt EOF } -# Checks for a birdnet.conf file +# Checks for a birdnet.conf file if ! [ -f ${birdnet_conf} ];then install_config fi diff --git a/scripts/install_language_label.sh b/scripts/install_language_label.sh new file mode 100755 index 0000000..4ba0b27 --- /dev/null +++ b/scripts/install_language_label.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +usage() { echo "Usage: $0 -l " 1>&2; exit 1; } + +while getopts "l:" o; do + case "${o}" in + l) + lang=${OPTARG} + ;; + *) + usage + ;; + esac +done +shift $((OPTIND-1)) + +HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd) + +label_file_name="labels_${lang}.txt" + +unzip -o $HOME/BirdNET-Pi/model/labels_l18n.zip $label_file_name \ + -d $HOME/BirdNET-Pi/model \ + && mv -f $HOME/BirdNET-Pi/model/$label_file_name $HOME/BirdNET-Pi/model/labels.txt \ + && logger "[$0] Changed language label file to '$label_file_name'"; + +exit 0 diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 9022d25..90ed2e8 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -40,6 +40,14 @@ fi if ! grep APPRISE_NOTIFY_NEW_SPECIES /etc/birdnet/birdnet.conf &>/dev/null;then sudo -u$USER echo "APPRISE_NOTIFY_NEW_SPECIES=0 " >> /etc/birdnet/birdnet.conf fi + +# If the config does not contain the DATABASE_LANG setting, we'll want to add it. +# Defaults to not-selected, which config.php will know to render as a language option. +# The user can then select a language in the web interface and update with that. +if ! grep DATABASE_LANG /etc/birdnet/birdnet.conf &>/dev/null;then + sudo -u$USER echo "DATABASE_LANG=not-selected" >> /etc/birdnet/birdnet.conf +fi + apprise_installation_status=$(~/BirdNET-Pi/birdnet/bin/python3 -c 'import pkgutil; print("installed" if pkgutil.find_loader("apprise") else "not installed")') if [[ "$apprise_installation_status" = "not installed" ]];then ~/BirdNET-Pi/birdnet/bin/pip3 install -U pip @@ -66,11 +74,11 @@ if systemctl list-unit-files pushed_notifications.service &>/dev/null;then sudo rm -f /usr/lib/systemd/system/pushed_notifications.service sudo rm $HOME/BirdNET-Pi/templates/pushed_notifications.service fi + if [ ! -f $HOME/BirdNET-Pi/model/labels.txt ] then - unzip $HOME/BirdNET-Pi/model/labels_l18n.zip labels_en.txt \ - -d $HOME/BirdNET-Pi/model - mv $HOME/BirdNET-Pi/model/labels_en.txt $HOME/BirdNET-Pi/model/labels.txt + $my_dir/install_language_label.sh -l $DATABASE_LANG \ + && logger "[$0] Installed new language label file for '$DATABASE_LANG'"; fi sudo systemctl daemon-reload From d9c80c52310fab0f45ccc365a61aeeb85cc6cff1 Mon Sep 17 00:00:00 2001 From: David Lamkin Date: Fri, 27 May 2022 10:52:32 +0100 Subject: [PATCH 12/26] reduce excessive ffmpeg logging In livestream.sh logging is set to 52 which seems excessive a value of 32 (the default): 'Show informative messages during processing. This is in addition to warnings and errors.' would seem to be more appropriate. --- scripts/livestream.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/livestream.sh b/scripts/livestream.sh index d081d53..077f479 100755 --- a/scripts/livestream.sh +++ b/scripts/livestream.sh @@ -5,11 +5,11 @@ source /etc/birdnet/birdnet.conf if [ -z ${REC_CARD} ];then echo "Stream not supported" elif [[ ! -z ${RTSP_STREAM} ]];then - ffmpeg -loglevel 52 -ac ${CHANNELS} -i ${RTSP_STREAM} -acodec libmp3lame \ + ffmpeg -loglevel 32 -ac ${CHANNELS} -i ${RTSP_STREAM} -acodec libmp3lame \ -b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \ -f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re else - ffmpeg -loglevel 52 -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \ + ffmpeg -loglevel 32 -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \ -b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \ -f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re -fi \ No newline at end of file +fi From 02c7ff72e08be92215c400ecbb7b30595b0acc0e Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Fri, 27 May 2022 07:04:12 -0400 Subject: [PATCH 13/26] Update todays_detections.php --- scripts/todays_detections.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index 675b67d..f2af8cb 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -127,7 +127,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=".str_replace(" ", "%20", $engname)."&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance&per_page=5&orientation=square,portrait&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"][0]; $modaltext = "https://flickr.com/photos/".$flickrjson["owner"]."/".$flickrjson["id"]; $authorlink = "https://flickr.com/people/".$flickrjson["owner"]; - $imageurl = 'http://farm' .$flickrjson["farm"]. '.static.flickr.com/' .$flickrjson["server"]. '/' .$flickrjson["id"]. '_' .$flickrjson["secret"]. '.jpg'; + $imageurl = 'https://farm' .$flickrjson["farm"]. '.static.flickr.com/' .$flickrjson["server"]. '/' .$flickrjson["id"]. '_' .$flickrjson["secret"]. '.jpg'; array_push($_SESSION['images'], array($comname,$imageurl,$flickrjson["title"], $modaltext, $authorlink)); $image = $_SESSION['images'][count($_SESSION['images'])-1]; } From b330ac64c13a2573b19d0a158f143ee9f02c2708 Mon Sep 17 00:00:00 2001 From: Patrick McGuire <60325264+mcguirepr89@users.noreply.github.com> Date: Fri, 27 May 2022 07:36:02 -0400 Subject: [PATCH 14/26] Update bashrc --- templates/bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/bashrc b/templates/bashrc index 7c0a0d8..22913ad 100644 --- a/templates/bashrc +++ b/templates/bashrc @@ -114,7 +114,7 @@ fi cd ~/BirdNET-Pi function remove() { source /etc/birdnet/birdnet.conf - find $RECS_DIR -iname *${1}* -exec rm -drfv {} + + find $EXTRACTED -iname *${1}* -exec rm -drfv {} + } alias rerc="source ~/.bashrc" alias vimrc="vim ~/.bashrc" From eb571354e004dcbfb94333672ba8b19e9ddbc14a Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Fri, 27 May 2022 09:58:17 -0400 Subject: [PATCH 15/26] Update style.css --- homepage/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/homepage/style.css b/homepage/style.css index f54d98d..e5ddda3 100644 --- a/homepage/style.css +++ b/homepage/style.css @@ -699,4 +699,5 @@ dialog::backdrop { line-height:20px; border-radius:12px; text-align:center; + font-size:small; } \ No newline at end of file From 7f36f09b9ad167241e0c4bcef22990c9ece19ccb Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Fri, 27 May 2022 13:15:24 -0400 Subject: [PATCH 16/26] Live Spectrogram Improvements --- scripts/spectrogram.php | 86 +++++++++++++++++++++++++++++++++++------ 1 file changed, 74 insertions(+), 12 deletions(-) diff --git a/scripts/spectrogram.php b/scripts/spectrogram.php index 304704c..0516520 100644 --- a/scripts/spectrogram.php +++ b/scripts/spectrogram.php @@ -1,3 +1,36 @@ +