consistent birdnet.conf generation

This commit is contained in:
Patrick McGuire
2021-11-10 15:38:49 -05:00
parent dede5e97af
commit 5b939e308e
+86 -99
View File
@@ -172,87 +172,53 @@ configure() {
install_birdnet_conf() {
cat << EOF > $(dirname ${my_dir})/birdnet.conf
################################################################################
# Configuration settings for BirdNET as a service #
# Configuration settings for BirdNET-Pi #
################################################################################
INSTALL_DATE="$(date "+%D")"
#___________The four variables below are the only that are required.___________#
## BIRDNET_USER should be the non-root user systemd should use to execute each
## service.
############ CHANGE THE LATITUDE AND LONGITUDE TO STATIC VALUES ################
BIRDNET_USER=${USER}
## 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. See REMOTE_RECS_DIR below for mounting remote data-sets.
## mounted locally.
RECS_DIR=${RECS_DIR}
## LATITUDE and LONGITUDE are self-explanatroy. Find them easily at
## maps.google.com. Only go to the thousanths place for these variables
## Example: these coordinates would indicate the Eiffel Tower in Paris, France.
## LATITUDE=48.858
## LONGITUDE=2.294
LATITUDE=${LATITUDE}
LONGITUDE=${LONGITUDE}
################################################################################
#------------------------------ Extraction Service ---------------------------#
# Keep this EMPTY if you do not want this device to perform the extractions #
## DO_EXTRACTIONS is simply a setting for enabling the extraction.service.
## Set this to Y or y to enable extractions.
DO_EXTRACTIONS=${DO_EXTRACTIONS}
################################################################################
#----------------------------- Recording Service ----------------------------#
#____________________The variable below can be set to enable __________________#
#________________________the birdnet_recording.service ________________________#
# Keep this EMPTY if you do not want this device to perform the recording. #
## 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=${DO_RECORDING}
################################################################################
#----------------------- 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)______________________#
# Leave these EMPTY if you do not want to enable web access #
## 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
## BirdNET-Pi on your local network, you can set this to http://localhost.
## Setting this (even to http://localhost) will also allow you to enable the
## GoTTY web logging features below.
BIRDNETPI_URL=${BIRDNETPI_URL}
EXTRACTIONLOG_URL=${EXTRACTIONLOG_URL}
BIRDNETLOG_URL=${BIRDNETLOG_URL}
#----------------------- 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
## the "Processed" directory and live audio stream. This MUST be set if you
## choose to enable this feature.
## certain parts of the web interface
CADDY_PWD=${CADDY_PWD}
################################################################################
#------------------------- 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=${DB_PWD}
#------------------------- Live Audio Stream --------------------------------#
#_____________The variable below configures/enables the live___________________#
#_____________________________audio stream.____________________________________#
# Keep this EMPTY if you do not wish to enable the live stream #
# or if this device is not doing the recording #
## 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
@@ -260,7 +226,21 @@ CADDY_PWD=${CADDY_PWD}
ICE_PWD=${ICE_PWD}
################################################################################
#----------------------- 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___________________#
@@ -274,6 +254,9 @@ 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._____________________#
@@ -284,14 +267,27 @@ PUSHED_APP_SECRET=${PUSHED_APP_SECRET}
## 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-Pi
## Set this to Y or y to install NoMachine alongside the BirdNET-Lite
INSTALL_NOMACHINE=${INSTALL_NOMACHINE}
################################################################################
#-------------------------------- Defaults ----------------------------------#
#________The seven variables below are default settings that you (probably)____#
#__________________don't need to change at all, but can._______________________#
#
#------------------------------ Extraction Service ---------------------------#
## DO_EXTRACTIONS is simply a setting for enabling the extraction.service.
## Set this to Y or y to enable extractions.
DO_EXTRACTIONS=${DO_EXTRACTIONS}
#----------------------------- 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=${DO_RECORDING}
## 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
@@ -309,11 +305,11 @@ REC_CARD=${REC_CARD}
## after extractions have been made from them. This includes both WAVE and
## BirdNET.selection.txt files.
PROCESSED=${RECS_DIR}/Processed
PROCESSED=${PROCESSED}
## EXTRACTED is the directory where the extracted audio selections are moved.
EXTRACTED=${RECS_DIR}/Extracted
EXTRACTED=${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
@@ -324,70 +320,61 @@ EXTRACTED=${RECS_DIR}/Extracted
## change this variable between data-sets to preserve records of disparate
## data-sets according to name.
IDFILE=${HOME}/BirdNET-Pi/IdentifiedSoFar.txt
IDFILE=${IDFILE}
## 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
OVERLAP=${OVERLAP}
## 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
CONFIDENCE=${CONFIDENCE}
## SENSITIVITY is the detection sensitivity from 0.5-1.5.
SENSITIVITY=1.25
################################################################################
#------------------------------ Auto-Generated ------------------------------#
#_____________________The variables below are auto-generated___________________#
#______________________________during installation_____________________________#
SENSITIVITY=${SENSITIVITY}
## CHANNELS holds the variabel that corresponds to the number of channels the
## sound card supports.
CHANNELS=${CHANNELS}
# Don't touch the variables below
## SYSTEMD_MOUNT is created from the RECS_DIR variable to comply with systemd
## mount naming requirements.
SYSTEMD_MOUNT=$(echo ${RECS_DIR#/} | tr / -).mount
## 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=$(dirname ${my_dir})/birdnet
VENV=/home/pi/BirdNET-Pi/birdnet
################################################################################
#---------------------------------- Testing -----------------------------------#
#_____________These variables are for testing. Please don't touch______________#
#_______________them if you are not testing these features.____________________#
## RECORDING_LENGTH sets the length of the recording that BirdNET-Lite will analyze.
RECORDING_LENGTH=${RECORDING_LENGTH}
## EXTRACTION_LENGTH sets the length of the audio extractions that will be made
## from each BirdNET-Lite detection.
EXTRACTION_LENGTH=${EXTRACTION_LENGTH}
RECORDING_LENGTH=
## BIRDNET_USER should be the non-root user systemd should use to execute each
## service.
EXTRACTION_LENGTH=
BIRDNET_USER=pi
DB_PWD=${DB_PWD}
LAST_RUN=$(dirname ${my_dir})/lastrun.txt
THIS_RUN=$(dirname ${my_dir})/thisrun.txt
## These are just for debugging
LAST_RUN=${LAST_RUN}
THIS_RUN=${THIS_RUN}
EOF
[ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf
}
# Checks for a birdnet.conf file in the BirdNET-Pi directory for a
# non-interactive installation. Otherwise,the installation is interactive.
if [ -f ${BIRDNET_CONF} ];then
source ${BIRDNET_CONF}
install_birdnet_conf
#install_birdnet_conf
[ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf
else
configure
install_birdnet_conf
[ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf
fi