Skip to content

A live bird collage card for your Home Assistant dashboard.

refining some forms and chaning FULL_DISK to words settings

mcguirepr8911c09dd9f4a9
diff --git a/Birders_Guide_Installer.sh b/Birders_Guide_Installer.sh
deleted file mode 100755
index 01b4d688..00000000
--- a/Birders_Guide_Installer.sh
+++ /dev/null
@@ -1,300 +0,0 @@
-#!/usr/bin/env bash
-set -e
-USER=pi
-HOME=/home/pi
-my_dir=${HOME}/BirdNET-Pi
-branch=main
-trap '${my_dir}/scripts/dump_logs.sh && exit' EXIT SIGHUP SIGINT
-
-if [ "$(uname -m)" != "aarch64" ];then
- echo "BirdNET-Pi requires a 64-bit OS.
-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"
- exit 1
-fi
-
-stage_1() {
- echo
- echo "Beginning Stage 1"
- echo
- echo "Ensuring the system is up-to-date."
- sudo apt -qq update
- sudo apt -qqy full-upgrade
- sudo apt -y autoremove --purge
- echo "System Updated!"
- if ! which git &> /dev/null; then
- echo "Installing git"
- sudo apt install -qqy git
- fi
- touch ${HOME}/stage_1_complete
- echo "Stage 1 complete"
-}
-
-stage_2() {
- echo
- echo "Beginning stage 2"
- echo
- echo "Checking for an internet connection to continue . . ."
- until ping -c 1 8.8.8.8 &> /dev/null; do
- sleep 1
- done
- echo "Connected!"
- echo
- if [ ! -d ${my_dir} ];then
- cd ${HOME} || exit 1
- echo "Cloning the BirdNET-Pi repository $branch branch into your home directory"
- git clone -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi
- else
- cd ${my_dir} && git checkout ${branch}
- fi
-
- source ${my_dir}/Birders_Guide_Installer_Configuration.txt
- if [ -z ${LATITUDE} ] || [ -z ${LONGITUDE} ] || [ -z ${CADDY_PWD} ] || [ -z ${ICE_PWD} ] || [ -z ${DB_PWD} ];then
- echo
- echo "Follow the instructions to fill out the LATITUDE and LONGITUDE variables
-and set the passwords for the live audio stream. Save the file after editing
-and then close the Mouse Pad editing window to continue."
- echo
- if [ -z "$SSH_CONNECTION" ];then
- EDITOR=mousepad
- else
- EDITOR=nano
- fi
- $EDITOR ${my_dir}/Birders_Guide_Installer_Configuration.txt
- while pgrep $EDITOR &> /dev/null;do
- sleep 1
- done
- source ${my_dir}/Birders_Guide_Installer_Configuration.txt || exit 1
- fi
- echo "Installing the BirdNET-Pi configuration file."
- install_birdnet_config || exit 1
- echo "Installing BirdNET-Lite"
- if ${my_dir}/scripts/install_birdnet.sh;then
-echo "The next time you power on the raspberry pi, all of the services will start up automatically.
-
-The installation has finished. Press Enter to close this window."
- read
- else
- echo "Something went wrong during installation. Open a github issue or email [email protected]"
- fi
-}
-
-install_birdnet_config() {
- cat << EOF > ${my_dir}/birdnet.conf
-################################################################################
-# Configuration settings for BirdNET-Pi #
-################################################################################
-
-############ CHANGE THE LATITUDE AND LONGITUDE TO STATIC VALUES ################
-
-
-## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at
-## maps.google.com.
-## Example: these coordinates would indicate the Eiffel Tower in Paris, France.
-## LATITUDE=48.858
-## LONGITUDE=2.294
-
-## These are input as shell substitutions so that this will work out of the box.
-## It guesses your latitude and longitude based off of your network information.
-## THESE SHOULD BE CHANGED TO STATIC NUMBERS!!!!
-LATITUDE=${LATITUDE}
-LONGITUDE=${LONGITUDE}
-
-## RECS_DIR is the location birdnet_analysis.service will look for the data-set
-## it needs to analyze. Be sure this directory is readable and writable for
-## the BIRDNET_USER. If you are going to be accessing a remote data-set, you
-## still need to set this, as this will be where the remote directory gets
-## mounted locally.
-
-RECS_DIR=/home/pi/BirdSongs
-
-#----------------------- Web Interface User Password ------------------------#
-#____________________The variable below sets the 'birdnet'_____________________#
-#___________________user password for the live audio stream,___________________#
-#_________________web tools, system info, and processed files__________________#
-
-## CADDY_PWD is the plaintext password (that will be hashed) and used to access
-## certain parts of the web interface
-
-CADDY_PWD=changeme
-
-#------------------------- MariaDB User Passwords ---------------------------#
-#_____________The variable below sets the password for the_____________________#
-#_______________________'birder' user on the MariaDB___________________________#
-
-## DB_PWD is for the 'birder' user
-DB_PWD=changeme
-
-#------------------------- Live Audio Stream --------------------------------#
-#_____________The variable below configures/enables the live___________________#
-#_____________________________audio stream.____________________________________#
-
-
-## ICE_PWD is the password that icecast2 will use to authenticate ffmpeg as a
-## trusted source for the stream. You will never need to enter this manually
-## anywhere other than here.
-
-ICE_PWD=changeme
-
-#--------------------- BirdWeather Station Information -----------------------#
-#_____________The variable below can be set to have your BirdNET-Pi____________#
-#__________________also act as a BirdWeather listening station_________________#
-
-BIRDWEATHER_ID=${BIRDWEATHER_ID}
-
-#----------------------- Web-hosting/Caddy File-server -----------------------#
-#________The four variables below can be set to enable internet access_________#
-#____________to your data,(e.g., extractions, raw data, live___________________#
-#______________audio stream, BirdNET.selection.txt files)______________________#
-
-
-## BIRDNETPI_URL is the URL where the extractions, data-set, and live-stream
-## will be web-hosted. If you do not own a domain, or would just prefer to keep
-## the BirdNET-Pi on your local network, keep this EMPTY.
-
-BIRDNETPI_URL=${BIRDNETPI_URL}
-EXTRACTIONLOG_URL=${EXTRACTIONLOG_URL}
-BIRDNETLOG_URL=${BIRDNETLOG_URL}
-
-
-#------------------- 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.___________________________#
-
-# Keep these EMPTY if haven't setup a Pushed.co App yet. #
-
-## Pushed.co App Key and App Secret
-
-PUSHED_APP_KEY=${PUSHED_APP_KEY}
-PUSHED_APP_SECRET=${PUSHED_APP_SECRET}
-
-################################################################################
-#-------------------------------- Defaults ----------------------------------#
-################################################################################
-
-#------------------------------- NoMachine ----------------------------------#
-#_____________The variable below can be set include NoMachine__________________#
-#_________________remote desktop software to be installed._____________________#
-
-# Keep this EMPTY if you do not want to install NoMachine. #
-
-## INSTALL_NOMACHINE is simply a setting that can be enabled to install
-## NoMachine alongside the BirdNET-Pi for remote desktop access. This in-
-## staller assumes personal use. Please reference the LICENSE file included
-## in this repository for more information.
-## Set this to Y or y to install NoMachine alongside the BirdNET-Lite
-
-INSTALL_NOMACHINE=y
-
-#
-#------------------------------ Extraction Service ---------------------------#
-
-## DO_EXTRACTIONS is simply a setting for enabling the extraction.service.
-## Set this to Y or y to enable extractions.
-
-DO_EXTRACTIONS=y
-
-#----------------------------- Recording Service ----------------------------#
-#____________________The variable below can be set to enable __________________#
-#________________________the birdnet_recording.service ________________________#
-
-## DO_RECORDING is simply a setting for enabling the 24/7
-## birdnet_recording.service.
-## Set this to Y or y to enable recording.
-
-DO_RECORDING=y
-
-## REC_CARD is the sound card you would want the birdnet_recording.service to
-## use. This setting is irrelevant if you are not planning on doing data
-## collection via recording on this machine. The command substitution below
-## looks for a USB microphone's dsnoop alsa device. The dsnoop device lets
-## birdnet_recording.service and livestream.service share the raw audio stream
-## from the microphone. If you would like to use a different microphone than
-## what this produces, or if your microphone does not support creating a
-## dsnoop device, you can set this explicitly from a list of the available
-## devices from the output of running 'aplay -L'
-
-REC_CARD=default
-
-## PROCESSED is the directory where the formerly 'Analyzed' files are moved
-## after extractions have been made from them. This includes both WAVE and
-## BirdNET.selection.txt files.
-
-PROCESSED=/home/pi/BirdSongs/Processed
-
-## EXTRACTED is the directory where the extracted audio selections are moved.
-
-EXTRACTED=/home/pi/BirdSongs/Extracted
-
-## IDFILE is the file that keeps a complete list of every spececies that
-## BirdNET has identified from your data-set. It is persistent across
-## data-sets, so would need to be whiped clean through deleting or renaming
-## it. A backup is automatically made from this variable each time it is
-## updated (structure: ${IDFILE}.bak), and would also need to be removed
-## or renamed to start a new file between data-sets. Alternately, you can
-## change this variable between data-sets to preserve records of disparate
-## data-sets according to name.
-
-IDFILE=${HOME}/BirdNET-Pi/IdentifiedSoFar.txt
-
-## OVERLAP is the value in seconds which BirdNET should use when analyzing
-## the data. The values must be between 0.0-2.9.
-
-OVERLAP=0.0
-
-## CONFIDENCE is the minimum confidence level from 0.0-1.0 BirdNET's analysis
-## should reach before creating an entry in the BirdNET.selection.txt file.
-## Don't set this to 1.0 or you won't have any results.
-
-CONFIDENCE=0.7
-
-## SENSITIVITY is the detection sensitivity from 0.5-1.5.
-
-SENSITIVITY=1.25
-
-## CHANNELS holds the variabel that corresponds to the number of channels the
-## sound card supports.
-
-CHANNELS=2
-
-## FULL_DISK can be set to configure how the system reacts to a full disk
-## 0 = Remove the oldest day's worth of recordings
-## 1 = Keep all data and 'stop_core_services.sh'
-
-FULL_DISK=0
-
-## VENV is the virtual environment where the the BirdNET python build is found,
-## i.e, VENV is the virtual environment miniforge built for BirdNET.
-
-VENV=/home/pi/BirdNET-Pi/birdnet
-
-## RECORDING_LENGTH sets the length of the recording that BirdNET-Lite will analyze.
-RECORDING_LENGTH=
-
-## EXTRACTION_LENGTH sets the length of the audio extractions that will be made
-## from each BirdNET-Lite detection.
-EXTRACTION_LENGTH=
-
-## BIRDNET_USER should be the non-root user systemd should use to execute each
-## service.
-
-BIRDNET_USER=pi
-
-
-## These are just for debugging
-LAST_RUN=
-THIS_RUN=
-EOF
- [ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
- sudo ln -sf ${my_dir}/birdnet.conf /etc/birdnet/birdnet.conf
-}
-if [ ! -f ${HOME}/stage_1_complete ] ;then
- stage_1
- stage_2
-else
- stage_2
-fi
-
diff --git a/Birders_Guide_Installer_Configuration.txt b/Birders_Guide_Installer_Configuration.txt
deleted file mode 100644
index 1bbf484b..00000000
--- a/Birders_Guide_Installer_Configuration.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-# Birders Guide Installer Configuration File
-
-################################################################################
-# Fill this out in order to install BirdNET-Lite
-# Follow the instructions for each section.
-################################################################################
-
-
-# 1. To find your latitude and longitude, you can go to https://maps.google.com
-# 1a. Find the location on the map where you will be putting the BirdNET-Lite
-# 1b. Right-click the location to view the latitude and longitude and click
-# them to copy them to your clip-board.
-# 2. Enter the latitude and longitude here. Be certain not to mix them up.
-# The first number is the latitude, and the second is longitude. See the
-# example below.
-#
-# Example: these coordinates would indicate the Eiffel Tower in Paris, France.
-# LATITUDE=48.858
-# LONGITUDE=2.294
-
-LATITUDE=
-LONGITUDE=
-
-# 1. CADDY_PWD is the password you will use to access your live audio stream and
-# maintenance tools. You can set this to anything, but keep it alpha-numeric.
-# You will probably also want to write this one down if you ever plan to
-# listen to the live stream.
-# 2. ICE_PWD is the password that IceCast2 will use to authenticate the stream
-# source.You can set this to anything also, but keep it alpha-numeric. You
-# will never use this again, so just set it to your favorite word.
-
-CADDY_PWD=
-ICE_PWD=
-
-# DB_PWD is the password that the system will use to access the database. Set
-# this to anything you want.
-
-DB_PWD=
-
-# This section can be left alone. If you setup a Pushed.co
-# mobile application, you can enter the App secret and secret
-# key in order to enable phone notifications for new species
-# detections.
-PUSHED_APP_SECRET=
-PUSHED_APP_KEY=
-
-# If you own your own domain, you can input that here to have caddy register
-# TLS certificates for the web interface
-
-BIRDNETPI_URL=
-BIRDNETLOG_URL=
-EXTRACTIONLOG_URL=
-
-# If you would like to POST your BirdNET-Pi detections to
-# https://app.birdweather.com, reach out to github:@timsterc for a unique and
-# confidential BirdWeather ID. Place that here if you have one already.
-# You can always add this later and the system will immediately start POSTing.
-
-BIRDWEATHER_ID=
diff --git a/scripts/advanced.php b/scripts/advanced.php
index 39e0be8e..d56b3d70 100644
--- a/scripts/advanced.php
+++ b/scripts/advanced.php
@@ -1,5 +1,20 @@
+<?php
+error_reporting(E_ALL);
+ini_set('display_errors',1);
+?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
+/* Chrome, Safari, Edge, Opera */
+input::-webkit-outer-spin-button,
+input::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+/* Firefox */
+input[type=number] {
+ -moz-appearance: textfield;
+}
* {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif';
@@ -84,14 +99,26 @@ input {
<div class="column first">
<form action="write_advanced.php" method="POST">
<?php
+
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
} ?>
<h3>Defaults</h3>
- <label for="full_disk">Full Disk Behavior: </label>
- <input name="full_disk" type="text" value="<?php print($config['FULL_DISK']);?>" required/><br>
+ <label>Full Disk Behavior: </label>
+ <label style="width:30%;" for="purge">
+ <input style="width:15%;" name="full_disk" type="radio" id="purge" value="purge"
+<?php
+if (strcmp($config['FULL_DISK'], "purge") == 0) {
+ echo "checked";
+}?>>Purge</label>
+ <label style="width:30%;" for="keep">
+ <input style="width:15%" name="full_disk" type="radio" id="keep" value="keep"
+<?php
+if (strcmp($config['FULL_DISK'], "keep") == 0) {
+ echo "checked";
+}?>>Keep</label>
<label for="rec_card">Audio Card: </label>
<input name="rec_card" type="text" value="<?php print($config['REC_CARD']);?>" required/><br>
<label for="channels">Audio Channels: </label>
diff --git a/scripts/config.php b/scripts/config.php
index b27283e9..82c61652 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -1,5 +1,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
+/* Chrome, Safari, Edge, Opera */
+input::-webkit-outer-spin-button,
+input::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+}
+
+/* Firefox */
+input[type=number] {
+ -moz-appearance: textfield;
+}
* {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif';
@@ -104,9 +115,9 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
} ?>
<label for="latitude">Latitude: </label>
- <input name="latitude" type="text" value="<?php print($config['LATITUDE']);?>" required/><br>
+ <input name="latitude" type="number" max="90" min="-90" step="0.0001" value="<?php print($config['LATITUDE']);?>" required/><br>
<label for="longitude">Longitude: </label>
- <input name="longitude" type="text" value="<?php print($config['LONGITUDE']);?>" required/><br>
+ <input name="longitude" type="number" max="180" min="-180" step="0.0001" value="<?php print($config['LONGITUDE']);?>" required/><br>
<label for="birdweather_id">BirdWeather ID: </label>
<input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
<label for="pushed_app_key">Pushed App Key: </label>
@@ -167,3 +178,4 @@ if(isset($_SESSION['success'])){
</div>
</div>
</body>
+<input type="reset" form=">
diff --git a/scripts/disk_check.sh b/scripts/disk_check.sh
index 4f76dfb8..8fb7973a 100755
--- a/scripts/disk_check.sh
+++ b/scripts/disk_check.sh
@@ -6,19 +6,19 @@ if [ "${used//%}" -ge 95 ]; then
source /etc/birdnet/birdnet.conf
case $FULL_DISK in
- 0) echo "Removing oldest data"
+ purge) echo "Removing oldest data"
rm -drfv "$(find ${EXTRACTED}/By_Date/* -maxdepth 1 -type d -prune \
| sort -r | tail -n1)";;
- *) echo "Stopping Core Services"
+ keep) echo "Stopping Core Services"
/usr/local/bin/stop_core_services.sh;;
esac
fi
sleep 1
if [ "${used//%}" -ge 95 ]; then
case $FULL_DISK in
- 0) echo "Removing more data"
+ purge) echo "Removing more data"
rm -rfv ${PROCESSED}/*;;
- *) echo "Stopping Core Services"
+ keep) echo "Stopping Core Services"
/usr/local/bin/stop_core_services.sh;;
esac
fi
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index 600eebb5..d9044e15 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -344,10 +344,10 @@ SENSITIVITY=${SENSITIVITY}
CHANNELS=${CHANNELS}
## FULL_DISK can be set to configure how the system reacts to a full disk
-## 0 = Remove the oldest day's worth of recordings
-## 1 = Keep all data and 'stop_core_services.sh'
+## purge = Remove the oldest day's worth of recordings
+## keep = Keep all data and 'stop_core_services.sh'
-FULL_DISK=0
+FULL_DISK=purge
## VENV is the virtual environment where the the BirdNET python build is found,
## i.e, VENV is the virtual environment miniforge built for BirdNET.
diff --git a/scripts/update_birdnet2.sh b/scripts/update_birdnet2.sh
index ac0e9df5..675321d9 100755
--- a/scripts/update_birdnet2.sh
+++ b/scripts/update_birdnet2.sh
@@ -11,10 +11,10 @@ if ! grep FULL_DISK ${birdnet_conf};then
cat << EOF >> ${birdnet_conf}
## FULL_DISK can be set to configure how the system reacts to a full disk
-## 0 = Remove the oldest day's worth of recordings
-## 1 = Keep all data and `stop_core_services.sh`
+## purge = Remove the oldest day's worth of recordings
+## keep = Keep all data and `stop_core_services.sh`
-FULL_DISK=0
+FULL_DISK=purge
EOF
fi