@@ -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 mcguirepr89@gmail.com"
|
||||
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
|
||||
|
||||
@@ -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=
|
||||
@@ -1,5 +1,5 @@
|
||||
<h1 align="center">
|
||||
BirdNET-Pi <img src="https://img.shields.io/badge/version-0.11-orange" />
|
||||
BirdNET-Pi <img src="https://img.shields.io/badge/version-0.11.1-orange" />
|
||||
</h1>
|
||||
<p align="center">
|
||||
A realtime acoustic bird classification system for the Raspberry Pi 4B
|
||||
@@ -37,6 +37,9 @@ If your installation isn't in one of the countries listed above, please let me k
|
||||
* 24/7 recording and BirdNET-Lite analysis
|
||||
* [BirdWeather](https://app.birdweather.com) integration (you will need to be issued a BirdWeather ID -- for now, request that from [@timsterc here](https://github.com/mcguirepr89/BirdNET-Pi/discussions/82))
|
||||
* Web interface access to all data and logs
|
||||
* Web Terminal
|
||||
* [Tiny File Manager](https://tinyfilemanager.github.io/)
|
||||
* FTP server included
|
||||
* Automatic extraction of detected data (creating audio clips of detected bird sounds)
|
||||
* Spectrograms available for all extractions
|
||||
* MariaDB integration
|
||||
@@ -47,27 +50,25 @@ If your installation isn't in one of the countries listed above, please let me k
|
||||
* Localization supported
|
||||
|
||||
## Requirements
|
||||
* A Raspberry Pi 4B
|
||||
* An SD Card with the 64-bit version of RaspiOS installed (please use Bullseye) [(download the latest here)](https://downloads.raspberrypi.org/raspios_arm64/images/)
|
||||
* A Raspberry Pi 4B or Raspberry Pi 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 USB Microphone or Sound Card
|
||||
|
||||
## Installation
|
||||
Headless installation guide available [HERE](https://github.com/mcguirepr89/BirdNET-Pi/wiki/%22Headless%22-installation-using-VNC)<br>
|
||||
Pre-installeld beta image available for testing [HERE](https://github.com/mcguirepr89/BirdNET-Pi/discussions/11#discussioncomment-1751201)
|
||||
[An installation guide is available here](https://github.com/mcguirepr89/BirdNET-Pi/wiki/Installation-Guide).
|
||||
|
||||
The system can be installed with:
|
||||
```
|
||||
curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/main/newinstaller.sh | bash
|
||||
curl -s https://raw.githubusercontent.com/mcguirepr89/BirdNET-Pi/main/newinstaller.sh | bash | tee -a installation.log 2>&1 && sudo reboot
|
||||
```
|
||||
The installer takes care of any and all necessary updates, so you can run that as the very first command upon the first boot, if you'd like.
|
||||
|
||||
The installation creates a log in `/home/pi/installation.log` that you can [email me](mailto:mcguirepr89@gmail.com) if you encounter any issues during installation.
|
||||
|
||||
## Access
|
||||
The BirdNET-Pi system can be accessed from any web browser on the same network:
|
||||
- http://birdnetpi.local
|
||||
|
||||
#### Access Credentials:
|
||||
- Username:`birdnet`
|
||||
- Password: The "CADDY_PWD" password set during installation
|
||||
|
||||
## Uninstallation
|
||||
```
|
||||
/usr/local/bin/uninstall.sh && cd ~ && rm -drf BirdNET-Pi
|
||||
@@ -87,7 +88,7 @@ I hope that if you find BirdNET-Pi has been worth your time, you will share your
|
||||
## ToDo, Notes, and Coming Soon
|
||||
|
||||
### Internationalization:
|
||||
The bird names are in English by default, but other localized versions are available thanks to the wonderful efforts of [@patlevin](https://github.com/patlevin). Please unzip `model/labels_l18n.zip` and replace `model/labels.txt` with your corresponding language. For instance, if you want the Swedish labels, rename the current `labels.txt` to `labels_en.txt` and then rename `labels_sv.txt` to `labels.txt`. (I will make this more straightforward in the future.)
|
||||
The bird names are in English by default, but other localized versions are available thanks to the wonderful efforts of [@patlevin](https://github.com/patlevin). Use the web interface's "Tools" > "Settings" and select your "Database Language" to have the detections in your language.
|
||||
|
||||
### Realtime Analysis Predictions View
|
||||
The pre-built TFLite binaries for this project also support [the BirdNET-Demo](https://github.com/kahst/BirdNET-Demo), which I am currently testing for integration into the BirdNET-Pi. If you know anything about JavaScript and are willing to help, please let me know in the [Live Analysis discussion](https://github.com/mcguirepr89/BirdNET-Pi/discussions/24).
|
||||
@@ -101,7 +102,7 @@ Expect FULL internationalization options during installation (and available post
|
||||
- French
|
||||
- Spanish
|
||||
|
||||
and detection/database localization for the following languages:
|
||||
Current database languages include the list below:
|
||||
| Language | Missing Species out of 6,362 | Missing labels (%) |
|
||||
| -------- | ------- | ------ |
|
||||
| Afrikaans | 5774 | 90.76% |
|
||||
|
||||
-353
@@ -1,353 +0,0 @@
|
||||
# BirdWeather edits by @timsterc
|
||||
# Other edits by @CaiusX and @mcguirepr89
|
||||
import os
|
||||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
||||
os.environ['CUDA_VISIBLE_DEVICES'] = ''
|
||||
|
||||
try:
|
||||
import tflite_runtime.interpreter as tflite
|
||||
except:
|
||||
from tensorflow import lite as tflite
|
||||
|
||||
import argparse
|
||||
import operator
|
||||
import librosa
|
||||
import numpy as np
|
||||
import math
|
||||
import time
|
||||
from decimal import Decimal
|
||||
import json
|
||||
###############################################################################
|
||||
import requests
|
||||
import mysql.connector
|
||||
###############################################################################
|
||||
import datetime
|
||||
import pytz
|
||||
from tzlocal import get_localzone
|
||||
from pathlib import Path
|
||||
|
||||
def loadModel():
|
||||
|
||||
global INPUT_LAYER_INDEX
|
||||
global OUTPUT_LAYER_INDEX
|
||||
global MDATA_INPUT_INDEX
|
||||
global CLASSES
|
||||
|
||||
print('LOADING TF LITE MODEL...', end=' ')
|
||||
|
||||
# Load TFLite model and allocate tensors.
|
||||
interpreter = tflite.Interpreter(model_path='model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||
interpreter.allocate_tensors()
|
||||
|
||||
# Get input and output tensors.
|
||||
input_details = interpreter.get_input_details()
|
||||
output_details = interpreter.get_output_details()
|
||||
|
||||
# Get input tensor index
|
||||
INPUT_LAYER_INDEX = input_details[0]['index']
|
||||
MDATA_INPUT_INDEX = input_details[1]['index']
|
||||
OUTPUT_LAYER_INDEX = output_details[0]['index']
|
||||
|
||||
# Load labels
|
||||
CLASSES = []
|
||||
with open('model/labels.txt', 'r') as lfile:
|
||||
for line in lfile.readlines():
|
||||
CLASSES.append(line.replace('\n', ''))
|
||||
|
||||
print('DONE!')
|
||||
|
||||
return interpreter
|
||||
|
||||
def loadCustomSpeciesList(path):
|
||||
|
||||
slist = []
|
||||
if os.path.isfile(path):
|
||||
with open(path, 'r') as csfile:
|
||||
for line in csfile.readlines():
|
||||
slist.append(line.replace('\r', '').replace('\n', ''))
|
||||
|
||||
return slist
|
||||
|
||||
def splitSignal(sig, rate, overlap, seconds=3.0, minlen=1.5):
|
||||
|
||||
# Split signal with overlap
|
||||
sig_splits = []
|
||||
for i in range(0, len(sig), int((seconds - overlap) * rate)):
|
||||
split = sig[i:i + int(seconds * rate)]
|
||||
|
||||
# End of signal?
|
||||
if len(split) < int(minlen * rate):
|
||||
break
|
||||
|
||||
# Signal chunk too short? Fill with zeros.
|
||||
if len(split) < int(rate * seconds):
|
||||
temp = np.zeros((int(rate * seconds)))
|
||||
temp[:len(split)] = split
|
||||
split = temp
|
||||
|
||||
sig_splits.append(split)
|
||||
|
||||
return sig_splits
|
||||
|
||||
def readAudioData(path, overlap, sample_rate=48000):
|
||||
|
||||
print('READING AUDIO DATA...', end=' ', flush=True)
|
||||
|
||||
# Open file with librosa (uses ffmpeg or libav)
|
||||
sig, rate = librosa.load(path, sr=sample_rate, mono=True, res_type='kaiser_fast')
|
||||
|
||||
# Split audio into 3-second chunks
|
||||
chunks = splitSignal(sig, rate, overlap)
|
||||
|
||||
print('DONE! READ', str(len(chunks)), 'CHUNKS.')
|
||||
|
||||
return chunks
|
||||
|
||||
def convertMetadata(m):
|
||||
|
||||
# Convert week to cosine
|
||||
if m[2] >= 1 and m[2] <= 48:
|
||||
m[2] = math.cos(math.radians(m[2] * 7.5)) + 1
|
||||
else:
|
||||
m[2] = -1
|
||||
|
||||
# Add binary mask
|
||||
mask = np.ones((3,))
|
||||
if m[0] == -1 or m[1] == -1:
|
||||
mask = np.zeros((3,))
|
||||
if m[2] == -1:
|
||||
mask[2] = 0.0
|
||||
|
||||
return np.concatenate([m, mask])
|
||||
|
||||
def custom_sigmoid(x, sensitivity=1.0):
|
||||
return 1 / (1.0 + np.exp(-sensitivity * x))
|
||||
|
||||
def predict(sample, interpreter, sensitivity):
|
||||
|
||||
# Make a prediction
|
||||
interpreter.set_tensor(INPUT_LAYER_INDEX, np.array(sample[0], dtype='float32'))
|
||||
interpreter.set_tensor(MDATA_INPUT_INDEX, np.array(sample[1], dtype='float32'))
|
||||
interpreter.invoke()
|
||||
prediction = interpreter.get_tensor(OUTPUT_LAYER_INDEX)[0]
|
||||
|
||||
# Apply custom sigmoid
|
||||
p_sigmoid = custom_sigmoid(prediction, sensitivity)
|
||||
|
||||
# Get label and scores for pooled predictions
|
||||
p_labels = dict(zip(CLASSES, p_sigmoid))
|
||||
|
||||
# Sort by score
|
||||
p_sorted = sorted(p_labels.items(), key=operator.itemgetter(1), reverse=True)
|
||||
|
||||
# Remove species that are on blacklist
|
||||
for i in range(min(10, len(p_sorted))):
|
||||
if p_sorted[i][0] in ['Human_Human', 'Non-bird_Non-bird', 'Noise_Noise']:
|
||||
p_sorted[i] = (p_sorted[i][0], 0.0)
|
||||
|
||||
# Only return first the top ten results
|
||||
return p_sorted[:10]
|
||||
|
||||
def analyzeAudioData(chunks, lat, lon, week, sensitivity, overlap, interpreter):
|
||||
|
||||
detections = {}
|
||||
start = time.time()
|
||||
print('ANALYZING AUDIO...', end=' ', flush=True)
|
||||
|
||||
# Convert and prepare metadata
|
||||
mdata = convertMetadata(np.array([lat, lon, week]))
|
||||
mdata = np.expand_dims(mdata, 0)
|
||||
|
||||
# Parse every chunk
|
||||
pred_start = 0.0
|
||||
for c in chunks:
|
||||
|
||||
# Prepare as input signal
|
||||
sig = np.expand_dims(c, 0)
|
||||
|
||||
# Make prediction
|
||||
p = predict([sig, mdata], interpreter, sensitivity)
|
||||
|
||||
# Save result and timestamp
|
||||
pred_end = pred_start + 3.0
|
||||
detections[str(pred_start) + ';' + str(pred_end)] = p
|
||||
pred_start = pred_end - overlap
|
||||
|
||||
print('DONE! Time', int((time.time() - start) * 10) / 10.0, 'SECONDS')
|
||||
|
||||
return detections
|
||||
|
||||
def writeResultsToFile(detections, min_conf, path):
|
||||
|
||||
print('WRITING RESULTS TO', path, '...', end=' ')
|
||||
rcnt = 0
|
||||
with open(path, 'w') as rfile:
|
||||
rfile.write('Start (s);End (s);Scientific name;Common name;Confidence\n')
|
||||
for d in detections:
|
||||
for entry in detections[d]:
|
||||
if entry[1] >= min_conf and (entry[0] in WHITE_LIST or len(WHITE_LIST) == 0):
|
||||
rfile.write(d + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + '\n')
|
||||
rcnt += 1
|
||||
print('DONE! WROTE', rcnt, 'RESULTS.')
|
||||
|
||||
def main():
|
||||
|
||||
global WHITE_LIST
|
||||
|
||||
# Parse passed arguments
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--i', help='Path to input file.')
|
||||
parser.add_argument('--o', default='result.csv', help='Path to output file. Defaults to result.csv.')
|
||||
parser.add_argument('--lat', type=float, default=-1, help='Recording location latitude. Set -1 to ignore.')
|
||||
parser.add_argument('--lon', type=float, default=-1, help='Recording location longitude. Set -1 to ignore.')
|
||||
parser.add_argument('--week', type=int, default=-1, help='Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Set -1 to ignore.')
|
||||
parser.add_argument('--overlap', type=float, default=0.0, help='Overlap in seconds between extracted spectrograms. Values in [0.0, 2.9]. Defaults tp 0.0.')
|
||||
parser.add_argument('--sensitivity', type=float, default=1.0, help='Detection sensitivity; Higher values result in higher sensitivity. Values in [0.5, 1.5]. Defaults to 1.0.')
|
||||
parser.add_argument('--min_conf', type=float, default=0.1, help='Minimum confidence threshold. Values in [0.01, 0.99]. Defaults to 0.1.')
|
||||
parser.add_argument('--custom_list', default='', help='Path to text file containing a list of species. Not used if not provided.')
|
||||
parser.add_argument('--birdweather_id', default='99999', help='Private Station ID for BirdWeather.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Load model
|
||||
interpreter = loadModel()
|
||||
|
||||
# Load custom species list
|
||||
if not args.custom_list == '':
|
||||
WHITE_LIST = loadCustomSpeciesList(args.custom_list)
|
||||
else:
|
||||
WHITE_LIST = []
|
||||
|
||||
birdweather_id = args.birdweather_id
|
||||
|
||||
# Read audio data
|
||||
audioData = readAudioData(args.i, args.overlap)
|
||||
|
||||
# Get Date/Time from filename in case Pi gets behind
|
||||
#now = datetime.now()
|
||||
full_file_name = args.i
|
||||
file_name = Path(full_file_name).stem
|
||||
file_date = file_name.split('-birdnet-')[0]
|
||||
file_time = file_name.split('-birdnet-')[1]
|
||||
date_time_str = file_date + ' ' + file_time
|
||||
date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
|
||||
#print('Date:', date_time_obj.date())
|
||||
#print('Time:', date_time_obj.time())
|
||||
print('Date-time:', date_time_obj)
|
||||
now = date_time_obj
|
||||
current_date = now.strftime("%Y/%m/%d")
|
||||
current_time = now.strftime("%H:%M:%S")
|
||||
current_iso8601 = now.astimezone(get_localzone()).isoformat()
|
||||
|
||||
week_number = int(now.strftime("%V"))
|
||||
week = max(1, min(week_number, 48))
|
||||
|
||||
sensitivity = max(0.5, min(1.0 - (args.sensitivity - 1.0), 1.5))
|
||||
|
||||
# Process audio data and get detections
|
||||
detections = analyzeAudioData(audioData, args.lat, args.lon, week, sensitivity, args.overlap, interpreter)
|
||||
|
||||
# Write detections to output file
|
||||
min_conf = max(0.01, min(args.min_conf, 0.99))
|
||||
writeResultsToFile(detections, min_conf, args.o)
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
soundscape_uploaded = False
|
||||
|
||||
# Write detections to Database
|
||||
for i in detections:
|
||||
print("\n", detections[i][0],"\n")
|
||||
with open('BirdDB.txt', 'a') as rfile:
|
||||
for d in detections:
|
||||
print("\n", "Database Entry", "\n")
|
||||
for entry in detections[d]:
|
||||
if entry[1] >= min_conf and (entry[0] in WHITE_LIST or len(WHITE_LIST) == 0):
|
||||
rfile.write(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' \
|
||||
+ str(entry[1]) +";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' \
|
||||
+ str(sensitivity) +';' + str(args.overlap) + '\n')
|
||||
|
||||
def insert_variables_into_table(Date, Time, Sci_Name, Com_Name, Confidence, Lat, Lon, Cutoff, Week, Sens, Overlap):
|
||||
try:
|
||||
connection = mysql.connector.connect(host='localhost',
|
||||
database='birds',
|
||||
user='birder',
|
||||
password='databasepassword')
|
||||
cursor = connection.cursor()
|
||||
mySql_insert_query = """INSERT INTO detections (Date, Time, Sci_Name, Com_Name, Confidence, Lat, Lon, Cutoff, Week, Sens, Overlap)
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """
|
||||
|
||||
record = (Date, Time, Sci_Name, Com_Name, Confidence, Lat, Lon, Cutoff, Week, Sens, Overlap)
|
||||
|
||||
cursor.execute(mySql_insert_query, record)
|
||||
connection.commit()
|
||||
print("Record inserted successfully into detections table")
|
||||
|
||||
|
||||
except mysql.connector.Error as error:
|
||||
print("Failed to insert record into detections table {}".format(error))
|
||||
|
||||
finally:
|
||||
if connection.is_connected():
|
||||
connection.close()
|
||||
print("MySQL connection is closed")
|
||||
|
||||
species = entry[0]
|
||||
sci_name,com_name = species.split('_')
|
||||
insert_variables_into_table(str(current_date), str(current_time), sci_name, com_name, \
|
||||
str(entry[1]), str(args.lat), str(args.lon), str(min_conf), str(week), \
|
||||
str(args.sensitivity), str(args.overlap))
|
||||
|
||||
print(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) +";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' + str(args.sensitivity) +';' + str(args.overlap) + '\n')
|
||||
|
||||
if birdweather_id != "99999":
|
||||
|
||||
if soundscape_uploaded is False:
|
||||
# POST soundscape to server
|
||||
soundscape_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/soundscapes" + "?timestamp=" + current_iso8601
|
||||
|
||||
with open(args.i, 'rb') as f:
|
||||
wav_data = f.read()
|
||||
response = requests.post(url=soundscape_url, data=wav_data, headers={'Content-Type': 'application/octet-stream'})
|
||||
print("Soundscape POST Response Status - ", response.status_code)
|
||||
sdata = response.json()
|
||||
soundscape_id = sdata['soundscape']['id']
|
||||
soundscape_uploaded = True
|
||||
|
||||
# POST detection to server
|
||||
detection_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/detections"
|
||||
start_time = d.split(';')[0]
|
||||
end_time = d.split(';')[1]
|
||||
post_begin = "{ "
|
||||
now_p_start = now + datetime.timedelta(seconds=float(start_time))
|
||||
current_iso8601 = now_p_start.astimezone(get_localzone()).isoformat()
|
||||
post_timestamp = "\"timestamp\": \"" + current_iso8601 + "\","
|
||||
post_lat = "\"lat\": " + str(args.lat) + ","
|
||||
post_lon = "\"lon\": " + str(args.lon) + ","
|
||||
post_soundscape_id = "\"soundscapeId\": " + str(soundscape_id) + ","
|
||||
post_soundscape_start_time = "\"soundscapeStartTime\": " + start_time + ","
|
||||
post_soundscape_end_time = "\"soundscapeEndTime\": " + end_time + ","
|
||||
post_commonName = "\"commonName\": \"" + entry[0].split('_')[1] + "\","
|
||||
post_scientificName = "\"scientificName\": \"" + entry[0].split('_')[0] + "\","
|
||||
post_algorithm = "\"algorithm\": " + "\"alpha\"" + ","
|
||||
post_confidence = "\"confidence\": " + str(entry[1])
|
||||
post_end = " }"
|
||||
|
||||
post_json = post_begin + post_timestamp + post_lat + post_lon + post_soundscape_id + post_soundscape_start_time + post_soundscape_end_time + post_commonName + post_scientificName + post_algorithm + post_confidence + post_end
|
||||
print(post_json)
|
||||
response = requests.post(detection_url, json=json.loads(post_json))
|
||||
print("Detection POST Response Status - ", response.status_code)
|
||||
|
||||
#time.sleep(3)
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
main()
|
||||
|
||||
# Example calls
|
||||
# python3 analyze.py --i 'example/XC558716 - Soundscape.mp3' --lat 35.4244 --lon -120.7463 --week 18
|
||||
# python3 analyze.py --i 'example/XC563936 - Soundscape.mp3' --lat 47.6766 --lon -122.294 --week 11 --overlap 1.5 --min_conf 0.25 --sensitivity 1.25 --custom_list 'example/custom_species_list.txt'
|
||||
+38
-43
@@ -2,33 +2,26 @@
|
||||
# Configuration settings for BirdNET-Pi #
|
||||
################################################################################
|
||||
|
||||
############ CHANGE THE LATITUDE AND LONGITUDE TO STATIC VALUES ################
|
||||
#--------------------- Required: Latitude, and Longitude ----------------------#
|
||||
|
||||
## The shell substitution below guesses these based on your network. THESE NEED
|
||||
## TO BE CHANGED TO STATIC VALUES
|
||||
## Please only go to 4 decimal places. Example:43.3984
|
||||
|
||||
## 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="$(curl -s4 ifconfig.co/json | awk '/lat/ {print $2}' | tr -d ',')"
|
||||
LONGITUDE="$(curl -s4 ifconfig.co/json | awk '/lon/ {print $2}' | tr -d ',')"
|
||||
|
||||
## 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
|
||||
#--------------------- BirdWeather Station Information -----------------------#
|
||||
#_____________The variable below can be set to have your BirdNET-Pi____________#
|
||||
#__________________also act as a BirdWeather listening station_________________#
|
||||
|
||||
BIRDWEATHER_ID=
|
||||
|
||||
#----------------------- Web Interface User Password ------------------------#
|
||||
#____________________The variable below sets the 'birdnet'_____________________#
|
||||
#___________________user password for the live audio stream,___________________#
|
||||
#_________________web tools, system info, and processed files__________________#
|
||||
#___________________user password for the Live Audio Stream,___________________#
|
||||
#_________________Tools, System Links, and the Processed files ________________#
|
||||
|
||||
## CADDY_PWD is the plaintext password (that will be hashed) and used to access
|
||||
## certain parts of the web interface
|
||||
@@ -39,7 +32,8 @@ CADDY_PWD=
|
||||
#_____________The variable below sets the password for the_____________________#
|
||||
#_______________________'birder' user on the MariaDB___________________________#
|
||||
|
||||
## DB_PWD is for the 'birder' user
|
||||
## DB_PWD is for the 'birder' user. The shell substitution below sets a random
|
||||
## password for you during installation.
|
||||
DB_PWD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)
|
||||
|
||||
#------------------------- Live Audio Stream --------------------------------#
|
||||
@@ -49,16 +43,10 @@ DB_PWD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)
|
||||
|
||||
## 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.
|
||||
## anywhere other than here and it stays on 'localhost.'
|
||||
|
||||
ICE_PWD=birdnetpi
|
||||
|
||||
#--------------------- BirdWeather Station Information -----------------------#
|
||||
#_____________The variable below can be set to have your BirdNET-Pi____________#
|
||||
#__________________also act as a BirdWeather listening station_________________#
|
||||
|
||||
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___________________#
|
||||
@@ -70,8 +58,8 @@ BIRDWEATHER_ID=
|
||||
## the BirdNET-Pi on your local network, keep this EMPTY.
|
||||
|
||||
BIRDNETPI_URL=
|
||||
EXTRACTIONLOG_URL=
|
||||
BIRDNETLOG_URL=
|
||||
WEBTERMINAL_URL=
|
||||
|
||||
|
||||
#------------------- Mobile Notifications via Pushed.co ---------------------#
|
||||
@@ -90,19 +78,11 @@ PUSHED_APP_SECRET=
|
||||
#-------------------------------- Defaults ----------------------------------#
|
||||
################################################################################
|
||||
|
||||
#------------------------------- NoMachine ----------------------------------#
|
||||
#_____________The variable below can be set include NoMachine__________________#
|
||||
#_________________remote desktop software to be installed._____________________#
|
||||
## 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.
|
||||
|
||||
# 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
|
||||
RECS_DIR=/home/pi/BirdSongs
|
||||
|
||||
#
|
||||
#------------------------------ Extraction Service ---------------------------#
|
||||
@@ -176,10 +156,10 @@ SENSITIVITY=1.25
|
||||
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`
|
||||
## 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.
|
||||
@@ -187,7 +167,7 @@ FULL_DISK=0
|
||||
VENV=/home/pi/BirdNET-Pi/birdnet
|
||||
|
||||
## RECORDING_LENGTH sets the length of the recording that BirdNET-Lite will analyze.
|
||||
RECORDING_LENGTH=
|
||||
RECORDING_LENGTH=15
|
||||
|
||||
## EXTRACTION_LENGTH sets the length of the audio extractions that will be made
|
||||
## from each BirdNET-Lite detection.
|
||||
@@ -202,3 +182,18 @@ BIRDNET_USER=pi
|
||||
## These are just for debugging
|
||||
LAST_RUN=
|
||||
THIS_RUN=
|
||||
|
||||
## DEPRECATED
|
||||
#------------------------------- 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
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Configure `birdnet.conf`</title>
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||
}
|
||||
|
||||
h1,h2,h3 {
|
||||
text-align:center;
|
||||
}
|
||||
input {
|
||||
font-size:large;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<h1>Configure BirdNET-Pi</h1>
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<form style="text-align:center;" action="write_config.php" method="POST">
|
||||
<h3>Required</h3>
|
||||
<input name="field1" type="text" value="LATITUDE" />
|
||||
<input name="field2" type="text" /><br>
|
||||
<input name="field3" type="text" value="LONGITUDE" />
|
||||
<input name="field4" type="text" /><br>
|
||||
<input name="field5" type="text" value="CADDY_PWD" />
|
||||
<input name="field6" type="text" value="changeme" /><br>
|
||||
<input name="field7" type="text" value="DB_PWD" />
|
||||
<input name="field8" type="text" value="changeme" /><br>
|
||||
<input name="field9" type="text" value="ICE_PWD" />
|
||||
<input name="field10" type="text" value="changeme" /><br>
|
||||
<input type="submit" name="submit" value="Save Settings">
|
||||
</form>
|
||||
<form style="text-align:center;" action="write_config.php" method="POST">
|
||||
<h3>Optional Services</h3>
|
||||
<input name="field11" type="text" value="BIRDWEATHER_ID" />
|
||||
<input name="field12" type="text" /><br>
|
||||
<input name="field13" type="text" value="PUSHED_APP_KEY" />
|
||||
<input name="field14" type="text" /><br>
|
||||
<input name="field15" type="text" value="PUSHED_APP_SECRET" />
|
||||
<input name="field16" type="text" /><br>
|
||||
<input type="submit" name="submit" value="Save Settings">
|
||||
</form>
|
||||
<form style="text-align:center;" action="write_config.php" method="POST">
|
||||
<h3>Custom URLs</h3>
|
||||
<input name="field17" type="text" value="BIRDNETPI_URL" />
|
||||
<input name="field18" type="text" /><br>
|
||||
<input name="field19" type="text" value="EXTRACTIONLOG_URL" />
|
||||
<input name="field20" type="text" /><br>
|
||||
<input name="field21" type="text" value="BIRDNETLOG_URL" />
|
||||
<input name="field22" type="text" /><br>
|
||||
<input type="submit" name="submit" value="Save Settings">
|
||||
</form>
|
||||
<form style="text-align:center;" action="write_config.php" method="POST">
|
||||
<h3>Default Services</h3>
|
||||
<input name="field23" type="text" value="INSTALL_NOMACHINE" />
|
||||
<input name="field24" type="text" value="y" /><br>
|
||||
<input name="field25" type="text" value="DO_EXTRACTIONS" />
|
||||
<input name="field26" type="text" value="y" /><br>
|
||||
<input name="field27" type="text" value="DO_RECORDING" />
|
||||
<input name="field28" type="text" value="y" /><br>
|
||||
<input type="submit" name="submit" value="Save Settings">
|
||||
</form>
|
||||
<form style="text-align:center;" action="write_config.php" method="POST">
|
||||
<h3>Advanced Configuration</h3>
|
||||
<input name="field29" type="text" value="REC_CARD" />
|
||||
<input name="field30" type="text" value="default" /><br>
|
||||
<input name="field31" type="text" value="OVERLAP" />
|
||||
<input name="field32" type="text" value="0.0" /><br>
|
||||
<input name="field33" type="text" value="CONFIDENCE" />
|
||||
<input name="field34" type="text" value="0.7" /><br>
|
||||
<input name="field35" type="text" value="SENSITIVITY" />
|
||||
<input name="field36" type="text" value="1.25" /><br>
|
||||
<input name="field37" type="text" value="CHANNELS" />
|
||||
<input name="field38" type="text" value="2" /><br>
|
||||
<input name="field39" type="text" value="RECORDING_LENGTH" />
|
||||
<input name="field40" type="text" value="15" /><br>
|
||||
<input name="field41" type="text" value="EXTRACTION_LENGTH" />
|
||||
<input name="field42" type="text" value="6" /><br>
|
||||
<input type="submit" name="submit" value="Save Settings">
|
||||
</form>
|
||||
<a style="font-weight:bold;color:black;" href='phpconfig.txt'>View Current Config</a>
|
||||
</body>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
if($_POST['Submit']){
|
||||
$open = fopen("scripts/birdnet.conf","w+");
|
||||
$text = $_POST['update'];
|
||||
fwrite($open, $text);
|
||||
fclose($open);
|
||||
echo "File updated.<br />";
|
||||
echo "File:<br />";
|
||||
$file = file("scripts/birdnet.conf");
|
||||
foreach($file as $text) {
|
||||
echo $text."<br />";
|
||||
}
|
||||
}else{
|
||||
$file = file("scripts/birdnet.conf");
|
||||
echo "<form style=\"text-align:center;\" action=\"".$PHP_SELF."\" method=\"post\">";
|
||||
echo "<textarea Name=\"update\" cols=\"80\" rows=\"100\">";
|
||||
foreach($file as $text) {
|
||||
echo $text;
|
||||
}
|
||||
echo "</textarea>";
|
||||
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
|
||||
</form>";
|
||||
}
|
||||
?>
|
||||
+15
-16
@@ -21,7 +21,7 @@ h3 {
|
||||
text-align: center;
|
||||
}
|
||||
h4,h5 {
|
||||
text-align: center;
|
||||
text-align: left;
|
||||
margin: 0px 0px 5px 0px;
|
||||
}
|
||||
footer {
|
||||
@@ -43,34 +43,33 @@ body::-webkit-scrollbar {
|
||||
<body>
|
||||
|
||||
<h5>Extractions</h5>
|
||||
- <a href="http://birdnetpi.local/By_Date/" target="content">By Date</a><br>
|
||||
- <a href="http://birdnetpi.local/By_Common_Name/" target="content">By Common Name</a><br>
|
||||
- <a href="http://birdnetpi.local/By_Scientific_Name/" target="content">By Scientific Name</a><br>
|
||||
- <a href="http://birdnetpi.local/Processed/" target="content">Processed</a><br>
|
||||
- <a href="/By_Date/" target="content">By Date</a><br>
|
||||
- <a href="/By_Common_Name/" target="content">By Common Name</a><br>
|
||||
- <a href="/By_Scientific_Name/" target="content">By Scientific Name</a><br>
|
||||
- <a href="/Processed/" target="content">Processed</a><br>
|
||||
|
||||
<hr class="solid">
|
||||
|
||||
<h5>System Links</h5>
|
||||
- <a href="http://birdnetpi.local/scripts/" target="content">Tools</a><br>
|
||||
- <a href="http://birdnetpi.local/phpsysinfo/" target="content">System Info</a><br>
|
||||
- <a href="http://birdnetpi.local:8080" target="content">BirdNET-Lite Log</a><br>
|
||||
- <a href="http://birdnetpi.local:8888" target="content">Extraction Log</a><br>
|
||||
<h5>System</h5>
|
||||
- <a href="/scripts/" target="content">Tools</a><br>
|
||||
- <a href="/phpsysinfo/" target="content">Info</a><br>
|
||||
- <a href="http://birdnetpi.local:8080" target="content">Log</a><br>
|
||||
|
||||
<hr class="solid">
|
||||
|
||||
<h5>External Links</h5>
|
||||
<h5>External</h5>
|
||||
- <a href="https://app.birdweather.com" target="_content">BirdWeather</a><br>
|
||||
- <a href="https://github.com/mcguirepr89/BirdNET-Pi" target="_content">Repository</a><br>
|
||||
- <a href="https://github.com/mcguirepr89/BirdNET-Pi/wiki" target="_content">Wiki Help Page</a><br>
|
||||
- <a href="https://v2.wttr.in/" target="content">Wttr.in Report</a><br>
|
||||
- <a href="https://birdnet.cornell.edu" target="_content">BirdNET @ Cornell</a><br>
|
||||
- <a href="https://birdnet.cornell.edu" target="_content">BirdNET</a><br>
|
||||
<hr class="solid">
|
||||
|
||||
<h5>Other<br>BirdNET-Pis</h5>
|
||||
- <a href="https://birdnetpi.pmcgui.xyz" target="_content">United States</a><br>
|
||||
- <a href="https://birds.naturestation.net" target="_content">South Africa</a><br>
|
||||
- <a href="https://birdnet.svardsten.se" target="_content">Sweden</a><br>
|
||||
- <a href="https://birdnetgv.ddnss.de" target="_content">Germany</a>
|
||||
- <a href="https://birdnetpi.pmcgui.xyz" target="top">United States</a><br>
|
||||
- <a href="https://birds.naturestation.net" target="top">South Africa</a><br>
|
||||
- <a href="https://birdnet.svardsten.se" target="top">Sweden</a><br>
|
||||
- <a href="https://birdnetgv.ddnss.de" target="top">Germany</a>
|
||||
|
||||
</body>
|
||||
<footer style="font-size: small;">
|
||||
|
||||
+3
-3
@@ -42,9 +42,9 @@ footer {
|
||||
<img style="padding-left: 150px;margin:0;" src="images/version.svg"/>
|
||||
<p style="margin:0;padding-left:150px;padding-top:5px">
|
||||
<a href="/overview.php" target="content">Overview</a> |
|
||||
<a href="/viewdb.php" target="content">Database View</a> |
|
||||
<a href="/viewday.php" target="content">Today View</a> |
|
||||
<a href="/spectrogram.php" target="content">Spectrogram View</a>
|
||||
<a href="/viewdb.php" target="content">Database</a> |
|
||||
<a href="/viewday.php" target="content">Today</a> |
|
||||
<a href="/spectrogram.php" target="content">Spectrogram</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,295 +0,0 @@
|
||||
<?php
|
||||
if(isset($_POST['field1']) && isset($_POST['field2'])) {
|
||||
$data = $_POST['field1'] . '=' . $_POST['field2'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field3']) && isset($_POST['field4'])) {
|
||||
$data = $_POST['field3'] . '=' . $_POST['field4'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field5']) && isset($_POST['field6'])) {
|
||||
$data = $_POST['field5'] . '=' . $_POST['field6'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field7']) && isset($_POST['field8'])) {
|
||||
$data = $_POST['field7'] . '=' . $_POST['field8'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field9']) && isset($_POST['field10'])) {
|
||||
$data = $_POST['field9'] . '=' . $_POST['field10'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field11']) && isset($_POST['field12'])) {
|
||||
$data = $_POST['field11'] . '=' . $_POST['field12'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field13']) && isset($_POST['field14'])) {
|
||||
$data = $_POST['field13'] . '=' . $_POST['field14'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field15']) && isset($_POST['field16'])) {
|
||||
$data = $_POST['field15'] . '=' . $_POST['field16'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field17']) && isset($_POST['field18'])) {
|
||||
$data = $_POST['field17'] . '=' . $_POST['field18'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field19']) && isset($_POST['field20'])) {
|
||||
$data = $_POST['field19'] . '=' . $_POST['field20'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field21']) && isset($_POST['field22'])) {
|
||||
$data = $_POST['field21'] . '=' . $_POST['field22'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field23']) && isset($_POST['field24'])) {
|
||||
$data = $_POST['field23'] . '=' . $_POST['field24'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field25']) && isset($_POST['field26'])) {
|
||||
$data = $_POST['field25'] . '=' . $_POST['field26'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field27']) && isset($_POST['field28'])) {
|
||||
$data = $_POST['field27'] . '=' . $_POST['field28'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field29']) && isset($_POST['field30'])) {
|
||||
$data = $_POST['field29'] . '=' . $_POST['field30'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field31']) && isset($_POST['field32'])) {
|
||||
$data = $_POST['field31'] . '=' . $_POST['field32'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field33']) && isset($_POST['field34'])) {
|
||||
$data = $_POST['field33'] . '=' . $_POST['field34'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field35']) && isset($_POST['field36'])) {
|
||||
$data = $_POST['field35'] . '=' . $_POST['field36'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field37']) && isset($_POST['field38'])) {
|
||||
$data = $_POST['field37'] . '=' . $_POST['field38'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field39']) && isset($_POST['field40'])) {
|
||||
$data = $_POST['field39'] . '=' . $_POST['field40'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
if(isset($_POST['field41']) && isset($_POST['field42'])) {
|
||||
$data = $_POST['field41'] . '=' . $_POST['field42'] . "\r\n";
|
||||
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
|
||||
if($ret === false) {
|
||||
die('There was an error writing this file');
|
||||
}
|
||||
else {
|
||||
echo "$ret bytes written to file";
|
||||
}
|
||||
}
|
||||
else {
|
||||
die('no post data to process');
|
||||
}
|
||||
|
||||
+2
-2
@@ -7,6 +7,6 @@ if ! which git &> /dev/null;then
|
||||
sudo apt update
|
||||
sudo apt -y install git
|
||||
fi
|
||||
git clone -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi
|
||||
cp ${HOME}/BirdNET-Pi/birdnet.conf-defaults ${HOME}/BirdNET-Pi/birdnet.conf
|
||||
git clone -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi &&
|
||||
cp ${HOME}/BirdNET-Pi/birdnet.conf-defaults ${HOME}/BirdNET-Pi/birdnet.conf &&
|
||||
${HOME}/BirdNET-Pi/scripts/install_birdnet.sh
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
$file='/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
||||
$str=file_get_contents("$file");
|
||||
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
||||
file_put_contents("$file", "$str");
|
||||
|
||||
if (isset($_POST['species']))
|
||||
foreach ($_POST['species'] as $selectedOption)
|
||||
file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||
header("Location: {$_SERVER['HTTP_REFERER']}");
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
$file='/home/pi/BirdNET-Pi/include_species_list.txt';
|
||||
$str=file_get_contents("$file");
|
||||
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
||||
file_put_contents("$file", "$str");
|
||||
|
||||
if (isset($_POST['species']))
|
||||
foreach ($_POST['species'] as $selectedOption)
|
||||
file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||
header("Location: {$_SERVER['HTTP_REFERER']}");
|
||||
exit;
|
||||
?>
|
||||
+63
-38
@@ -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';
|
||||
@@ -14,7 +25,7 @@
|
||||
width: calc(50% - 70px);
|
||||
}
|
||||
.second {
|
||||
width: calc(50% - 30px);
|
||||
width: calc(50% - 70px);
|
||||
}
|
||||
.
|
||||
/* Clear floats after the columns */
|
||||
@@ -32,12 +43,9 @@ a {
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
width:100%;
|
||||
width:50%;
|
||||
border: none;
|
||||
background-color: #04AA6D;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
padding: 10px 10px;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
@@ -64,18 +72,20 @@ input {
|
||||
text-align:center;
|
||||
font-size:large;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
h2 {
|
||||
margin-bottom:0px;
|
||||
@media screen and (max-width: 1000px) {
|
||||
h2,h3 {
|
||||
text-align:center;
|
||||
} form {
|
||||
text-align:left;
|
||||
margin-left:0px;
|
||||
}
|
||||
}
|
||||
form {
|
||||
margin:0;
|
||||
}
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
input, label {
|
||||
width: 100%;
|
||||
{
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -85,22 +95,34 @@ 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');
|
||||
$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');
|
||||
$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>
|
||||
<input name="channels" type="text" value="<?php print($config['CHANNELS']);?>" required/><br>
|
||||
<input name="channels" type="number" min="1" max="32" step="1" value="<?php print($config['CHANNELS']);?>" required/><br>
|
||||
<label for="recording_length">Recording Length: </label>
|
||||
<input name="recording_length" type="text" value="<?php print($config['RECORDING_LENGTH']);?>" /><br>
|
||||
<input name="recording_length" type="number" min="3" max="60" step="1" value="<?php print($config['RECORDING_LENGTH']);?>" required/><br>
|
||||
<label for="extraction_length">Extraction Length: </label>
|
||||
<input name="extraction_length" type="text" value="<?php print($config['EXTRACTION_LENGTH']);?>" /><br>
|
||||
<input name="extraction_length" type="number" min="3" max="<?php print($config['RECORDING_LENGTH']);?>" value="<?php print($config['EXTRACTION_LENGTH']);?>" /><br>
|
||||
<h3>Passwords</h3>
|
||||
<label for="caddy_pwd">Webpage: </label>
|
||||
<input name="caddy_pwd" type="text" value="<?php print($config['CADDY_PWD']);?>" /><br>
|
||||
@@ -109,37 +131,40 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
<label for="ice_pwd">Live Audio Stream: </label>
|
||||
<input name="ice_pwd" type="text" value="<?php print($config['ICE_PWD']);?>" required/><br>
|
||||
</div>
|
||||
<div class="column first">
|
||||
<div class="column second">
|
||||
<h3>Custom URLs</h3>
|
||||
<label for="birdnetpi_url">BirdNET-Pi URL: </label>
|
||||
<input name="birdnetpi_url" type="text" value="<?php print($config['BIRDNETPI_URL']);?>" /><br>
|
||||
<label for="extractionlog_url">Extraction Log URL: </label>
|
||||
<input name="extractionlog_url" type="text" value="<?php print($config['EXTRACTIONLOG_URL']);?>" /><br>
|
||||
<input name="birdnetpi_url" type="url" value="<?php print($config['BIRDNETPI_URL']);?>" /><br>
|
||||
<label for="birdnetlog_url">BirdNET-Lite Log URL: </label>
|
||||
<input name="birdnetlog_url" type="text" value="<?php print($config['BIRDNETLOG_URL']);?>" /><br>
|
||||
<input name="birdnetlog_url" type="url" value="<?php print($config['BIRDNETLOG_URL']);?>" /><br>
|
||||
<label for="webterminal_url">Web Terminal URL: </label>
|
||||
<input name="webterminal_url" type="url" value="<?php print($config['WEBTERMINAL_URL']);?>" /><br>
|
||||
<h3>BirdNET-Lite Settings</h3>
|
||||
<label for="overlap">Overlap: </label>
|
||||
<input name="overlap" type="text" value="<?php print($config['OVERLAP']);?>" required/><br>
|
||||
<input name="overlap" type="number" min="0.0" max="2.9" step="0.1" value="<?php print($config['OVERLAP']);?>" required/><br>
|
||||
<label for="confidence">Minimum Confidence: </label>
|
||||
<input name="confidence" type="text" value="<?php print($config['CONFIDENCE']);?>" required/><br>
|
||||
<input name="confidence" type="number" min="0.01" max="0.99" step="0.01" value="<?php print($config['CONFIDENCE']);?>" required/><br>
|
||||
<label for="sensitivity">Sigmoid Sensitivity: </label>
|
||||
<input name="sensitivity" type="text" value="<?php print($config['SENSITIVITY']);?>" required/><br>
|
||||
<br>
|
||||
<br>
|
||||
<input type="submit" value="<?php
|
||||
@session_start();
|
||||
<input name="sensitivity" type="number" min="0.5" max="1.5" step="0.01" value="<?php print($config['SENSITIVITY']);?>" required/><br>
|
||||
<br><br>
|
||||
<button type="submit" class="block"><?php
|
||||
@session_start();
|
||||
|
||||
if(isset($_SESSION['success'])){
|
||||
echo "Success!";
|
||||
unset($_SESSION['success']);
|
||||
echo "Success!";
|
||||
unset($_SESSION['success']);
|
||||
} else {
|
||||
echo "Update Settings";
|
||||
echo "Update Settings";
|
||||
}
|
||||
?>">
|
||||
?></button>
|
||||
<br>
|
||||
</form>
|
||||
<form action="config.php" style="margin:0;">
|
||||
<button type="submit" class="block">Basic Settings</button>
|
||||
</form>
|
||||
<br>
|
||||
<br>
|
||||
<button type="text"><a href="config.php">Basic Settings</a></button>
|
||||
<form action="index.html" style="margin:0;">
|
||||
<button type="submit" class="block">Tools</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
import argparse
|
||||
import socket
|
||||
|
||||
HEADER = 64
|
||||
PORT = 5050
|
||||
FORMAT = 'utf-8'
|
||||
DISCONNECT_MESSAGE = "!DISCONNECT"
|
||||
SERVER = "127.0.1.1"
|
||||
ADDR = (SERVER, PORT)
|
||||
|
||||
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
client.connect(ADDR)
|
||||
|
||||
def send(msg):
|
||||
message = msg.encode(FORMAT)
|
||||
msg_length = len(message)
|
||||
send_length = str(msg_length).encode(FORMAT)
|
||||
send_length += b' ' * (HEADER - len(send_length))
|
||||
client.send(send_length)
|
||||
client.send(message)
|
||||
print(client.recv(2048).decode(FORMAT))
|
||||
|
||||
def main():
|
||||
|
||||
global INCLUDE_LIST
|
||||
global EXCLUDE_LIST
|
||||
|
||||
# Parse passed arguments
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--i', help='Path to input file.')
|
||||
parser.add_argument('--o', default='result.csv', help='Path to output file. Defaults to result.csv.')
|
||||
parser.add_argument('--lat', type=float, default=-1, help='Recording location latitude. Set -1 to ignore.')
|
||||
parser.add_argument('--lon', type=float, default=-1, help='Recording location longitude. Set -1 to ignore.')
|
||||
parser.add_argument('--week', type=int, default=-1, help='Week of the year when the recording was made. Values in [1, 48] (4 weeks per month). Set -1 to ignore.')
|
||||
parser.add_argument('--overlap', type=float, default=0.0, help='Overlap in seconds between extracted spectrograms. Values in [0.0, 2.9]. Defaults tp 0.0.')
|
||||
parser.add_argument('--sensitivity', type=float, default=1.0, help='Detection sensitivity; Higher values result in higher sensitivity. Values in [0.5, 1.5]. Defaults to 1.0.')
|
||||
parser.add_argument('--min_conf', type=float, default=0.1, help='Minimum confidence threshold. Values in [0.01, 0.99]. Defaults to 0.1.')
|
||||
parser.add_argument('--include_list', default='null', help='Path to text file containing a list of included species. Not used if not provided.')
|
||||
parser.add_argument('--exclude_list', default='null', help='Path to text file containing a list of excluded species. Not used if not provided.')
|
||||
parser.add_argument('--birdweather_id', default='99999', help='Private Station ID for BirdWeather.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
sockParams = ''
|
||||
if args.i:
|
||||
sockParams += 'i=' + args.i + '||'
|
||||
if args.o:
|
||||
sockParams += 'o=' + args.o + '||'
|
||||
if args.birdweather_id:
|
||||
sockParams += 'birdweather_id=' + args.birdweather_id + '||'
|
||||
if args.include_list:
|
||||
sockParams += 'include_list=' + args.include_list + '||'
|
||||
if args.exclude_list:
|
||||
sockParams += 'exclude_list=' + args.exclude_list + '||'
|
||||
if args.overlap:
|
||||
sockParams += 'overlap=' + str(args.overlap) + '||'
|
||||
if args.week:
|
||||
sockParams += 'week=' + str(args.week) + '||'
|
||||
if args.sensitivity:
|
||||
sockParams += 'sensitivity=' + str(args.sensitivity) + '||'
|
||||
if args.min_conf:
|
||||
sockParams += 'min_conf=' + str(args.min_conf) + '||'
|
||||
if args.lat:
|
||||
sockParams += 'lat=' + str(args.lat) + '||'
|
||||
if args.lon:
|
||||
sockParams += 'lon=' + str(args.lon) + '||'
|
||||
|
||||
send(sockParams)
|
||||
|
||||
send(DISCONNECT_MESSAGE)
|
||||
#time.sleep(3)
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
main()
|
||||
|
||||
# Example calls
|
||||
# python3 analyze.py --i 'example/XC558716 - Soundscape.mp3' --lat 35.4244 --lon -120.7463 --week 18
|
||||
# python3 analyze.py --i 'example/XC563936 - Soundscape.mp3' --lat 47.6766 --lon -122.294 --week 11 --overlap 1.5 --min_conf 0.25 --sensitivity 1.25 --custom_list 'example/custom_species_list.txt'
|
||||
@@ -7,7 +7,7 @@
|
||||
set -x
|
||||
birdnetpi_dir=/home/pi/BirdNET-Pi
|
||||
birders_config=${birdnetpi_dir}/Birders_Guide_Installer_Configuration.txt
|
||||
branch=main
|
||||
branch=forms
|
||||
INTERACTIVE=True
|
||||
ASK_TO_REBOOT=0
|
||||
BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf
|
||||
|
||||
+140
-28
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs BirdNET-Lite
|
||||
#set -x
|
||||
set -x
|
||||
source /etc/birdnet/birdnet.conf
|
||||
# Document this run's birdnet.conf settings
|
||||
# Make a temporary file to compare the current birdnet.conf with
|
||||
@@ -22,12 +22,26 @@ if ! diff ${LAST_RUN} ${THIS_RUN};then
|
||||
echo "The birdnet.conf file has changed"
|
||||
echo "Reloading services"
|
||||
cat ${THIS_RUN} > ${LAST_RUN}
|
||||
until restart_services.sh;do
|
||||
sleep 1
|
||||
done
|
||||
sudo systemctl stop birdnet_recording.service
|
||||
sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
|
||||
fi
|
||||
|
||||
CUSTOM_LIST="/home/pi/BirdNET-Pi/custom_species_list.txt"
|
||||
INCLUDE_LIST="/home/pi/BirdNET-Pi/include_species_list.txt"
|
||||
EXCLUDE_LIST="/home/pi/BirdNET-Pi/exclude_species_list.txt"
|
||||
if [ ! -f ${INCLUDE_LIST} ];then
|
||||
touch ${INCLUDE_LIST} &&
|
||||
chmod g+rw ${INCLUDE_LIST}
|
||||
fi
|
||||
if [ ! -f ${EXCLUDE_LIST} ];then
|
||||
touch ${EXCLUDE_LIST} &&
|
||||
chmod g+rw ${EXCLUDE_LIST}
|
||||
fi
|
||||
if [ "$(du ${INCLUDE_LIST} | awk '{print $1}')" -lt 4 ];then
|
||||
INCLUDE_LIST=null
|
||||
fi
|
||||
if [ "$(du ${EXCLUDE_LIST} | awk '{print $1}')" -lt 4 ];then
|
||||
EXCLUDE_LIST=null
|
||||
fi
|
||||
|
||||
# Create an array of the audio files
|
||||
# Takes one argument:
|
||||
@@ -63,7 +77,7 @@ move_analyzed() {
|
||||
# Uses one argument:
|
||||
# - {DIRECTORY}
|
||||
run_analysis() {
|
||||
sleep .5
|
||||
sleep .5
|
||||
echo "Starting run_analysis() for ${1:19}"
|
||||
|
||||
|
||||
@@ -80,30 +94,36 @@ run_analysis() {
|
||||
WEEK="$(echo "${WEEK_OF_YEAR} + 4" |bc -l)"
|
||||
fi
|
||||
|
||||
cd ${HOME}/BirdNET-Pi || exit 1
|
||||
cd ${HOME}/BirdNET-Pi/scripts || exit 1
|
||||
for i in "${files[@]}";do
|
||||
echo "${1}/${i}" > ./analyzing_now.txt
|
||||
echo "${1}/${i}" > ../analyzing_now.txt
|
||||
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
||||
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
||||
[ -z $FILE_LENGTH ] && sleep 3 && continue
|
||||
[ -z $FILE_LENGTH ] && sleep 1 && continue
|
||||
echo "RECORDING_LENGTH set to ${RECORDING_LENGTH}"
|
||||
a=1
|
||||
a=0
|
||||
if [ "${RECORDING_LENGTH}" == "01:00" ];then
|
||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "${RECORDING_LENGTH}" ];do
|
||||
sleep 1
|
||||
[ $a -ge 60 ] && sudo rm -f ${1}/${i} && break
|
||||
[ $a -ge 60 ] && rm -f ${1}/${i} && break
|
||||
a=$((a+1))
|
||||
done
|
||||
else
|
||||
elif [ "${RECORDING_LENGTH}" -lt 10 ];then
|
||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:0${RECORDING_LENGTH}" ];do
|
||||
sleep 1
|
||||
[ $a -ge ${RECORDING_LENGTH} ] && rm -f ${1}/${i} && break
|
||||
a=$((a+1))
|
||||
done
|
||||
else
|
||||
until [ "$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)" == "00:${RECORDING_LENGTH}" ];do
|
||||
sleep 1
|
||||
[ $a -ge ${RECORDING_LENGTH} ] && sudo rm -f ${1}/${i} && break
|
||||
[ $a -ge ${RECORDING_LENGTH} ] && rm -f ${1}/${i} && break
|
||||
a=$((a+1))
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ] && [ -z $BIRDWEATHER_ID ];then
|
||||
if [ -f ${1}/${i} ] && [ ! -f ${INCLUDE_LIST} ] && [ ! -f ${EXCLUDE_LIST} ] && [ -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -120,9 +140,9 @@ run_analysis() {
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}"
|
||||
elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ] && [ -z $BIRDWEATHER_ID ];then
|
||||
elif [ -f ${1}/${i} ] && [ -f ${INCLUDELIST} ] && [ ! -f ${EXCLUDE_LIST} ] && [ -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -132,7 +152,7 @@ run_analysis() {
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--custom_list "${CUSTOM_LIST}""
|
||||
--include_list "${INCLUDE_LIST}""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -140,10 +160,10 @@ run_analysis() {
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--custom_list "${CUSTOM_LIST}"
|
||||
elif [ -f ${1}/${i} ] && [ ! -f ${CUSTOM_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
|
||||
--include_list "${INCLUDE_LIST}"
|
||||
elif [ -f ${1}/${i} ] && [ ! -f ${INCLUDE_LIST} ] && [ -f ${EXCLUDE_LIST} ] && [ -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -153,7 +173,7 @@ run_analysis() {
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--birdweather_id IN_USE"
|
||||
--exclude_list "${EXCLUDE_LIST}""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -161,10 +181,10 @@ run_analysis() {
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--birdweather_id "${BIRDWEATHER_ID}"
|
||||
elif [ -f ${1}/${i} ] && [ -f ${CUSTOM_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
|
||||
--exclude_list "${EXCLUDE_LIST}"
|
||||
elif [ -f ${1}/${i} ] && [ -f ${INCLUDE_LIST} ] && [ -f ${EXCLUDE_LIST} ] && [ -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -174,8 +194,8 @@ run_analysis() {
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--custom_list "${CUSTOM_LIST}" \
|
||||
--birdweather_id IN_USE"
|
||||
--include_list "${INCLUDE_LIST}" \
|
||||
--exclude_list "${EXCLUDE_LIST}""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
@@ -183,9 +203,101 @@ run_analysis() {
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--custom_list "${CUSTOM_LIST}" \
|
||||
--include_list "${INCLUDE_LIST}" \
|
||||
--exclude_list "${EXCLUDE_LIST}"
|
||||
elif [ -f ${1}/${i} ] && [ ! -f ${INCLUDE_LIST} ] && [ ! -f ${EXCLUDE_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--birdweather_id "IN_USE""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--birdweather_id "${BIRDWEATHER_ID}"
|
||||
elif [ -f ${1}/${i} ] && [ -f ${INCLUDE_LIST} ] && [ ! -f ${EXCLUDE_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--include_list "${INCLUDE_LIST}" \
|
||||
--birdweather_id "IN_USE""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--include_list "${INCLUDE_LIST}" \
|
||||
--birdweather_id "${BIRDWEATHER_ID}"
|
||||
elif [ -f ${1}/${i} ] && [ ! -f ${INCLUDE_LIST} ] && [ -f ${EXCLUDE_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--exclude_list "${EXCLUDE_LIST}" \
|
||||
--birdweather_id "IN_USE""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--exclude_list "${EXCLUDE_LIST}" \
|
||||
--birdweather_id "${BIRDWEATHER_ID}"
|
||||
elif [ -f ${1}/${i} ] && [ -f ${INCLUDE_LIST} ] && [ -f ${EXCLUDE_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
|
||||
echo "python3 analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--include_list "${INCLUDE_LIST}" \
|
||||
--exclude_list "${EXCLUDE_LIST}" \
|
||||
--birdweather_id "IN_USE""
|
||||
"${VENV}"/bin/python analyze.py \
|
||||
--i "${1}/${i}" \
|
||||
--o "${1}/${i}.csv" \
|
||||
--lat "${LATITUDE}" \
|
||||
--lon "${LONGITUDE}" \
|
||||
--week "${WEEK}" \
|
||||
--overlap "${OVERLAP}" \
|
||||
--sensitivity "${SENSITIVITY}" \
|
||||
--min_conf "${CONFIDENCE}" \
|
||||
--include_list "${INCLUDE_LIST}" \
|
||||
--exclude_list "${EXCLUDE_LIST}" \
|
||||
--birdweather_id "${BIRDWEATHER_ID}"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?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');
|
||||
}
|
||||
$template = file_get_contents("email_template");
|
||||
|
||||
foreach($config as $key => $value)
|
||||
{
|
||||
$template = str_replace('{{ '.$key.' }}', $value, $template);
|
||||
}
|
||||
echo $template;
|
||||
?>
|
||||
|
||||
+37
-22
@@ -13,7 +13,7 @@ echo "Removing all data . . . "
|
||||
sudo rm -drf "${RECS_DIR}"
|
||||
sudo rm -f "${IDFILE}"
|
||||
sudo rm -f $(dirname ${my_dir})/BirdDB.txt
|
||||
echo "Recreating necessary directories"
|
||||
echo "Creating necessary directories"
|
||||
[ -d ${EXTRACTED} ] || sudo -u ${USER} mkdir -p ${EXTRACTED}
|
||||
[ -d ${EXTRACTED}/By_Date ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Date
|
||||
[ -d ${EXTRACTED}/By_Common_Name ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/By_Common_Name
|
||||
@@ -24,50 +24,65 @@ echo "Recreating necessary directories"
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED}
|
||||
if [ ! -z ${BIRDNETLOG_URL} ];then
|
||||
BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u ${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "birdnetpi.local:8080" ${my_dir}/*.php)"
|
||||
sudo -u${USER} sed -i "s/http:\/\/$(hostname).local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "$(hostname).local:8080" ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u ${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" ${i}
|
||||
sudo -u${USER} sed -i "s/http:\/\/$(hostname).local:8080/"${BIRDNETLOG_URL}"/g" ${i}
|
||||
done
|
||||
fi
|
||||
if [ ! -z ${EXTRACTIONLOG_URL} ];then
|
||||
EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u ${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "birdnetpi.local:8888" ${my_dir}/*.php)"
|
||||
if [ ! -z ${WEBTERMINAL_URL} ];then
|
||||
WEBTERMINAL_URL="$(echo ${WEBTERMINAL_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/$(hostname).local:8888/"${WEBTERMINAL_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "$(hostname).local:8888" ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u ${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" ${i}
|
||||
sudo -u${USER} sed -i "s/http:\/\/$(hostname).local:8888/"${WEBTERMINAL_URL}"/g" ${i}
|
||||
done
|
||||
fi
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/model/labels.txt ${my_dir}/
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED}
|
||||
if [ ! -z ${BIRDNETPI_URL} ];then
|
||||
if [ -z ${BIRDNETPI_URL} ];then
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
else
|
||||
BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u ${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l birdnetpi.local ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u ${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" ${i}
|
||||
done
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/overview.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewday.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/overview.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewdb.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/images/favicon.ico ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
|
||||
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
|
||||
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
|
||||
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
|
||||
|
||||
echo "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}""
|
||||
sudo -u ${USER} git -C $(dirname ${my_dir}) checkout -f homepage/menu.html
|
||||
sudo -u ${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
|
||||
sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
|
||||
chmod -R g+rw $(dirname ${my_dir})
|
||||
chmod -R g+rw ${RECS_DIR}
|
||||
|
||||
echo "Generating BirdDB.txt"
|
||||
[ -f $(dirname ${my_dir})/BirdDB.txt ] || sudo -u ${USER} touch $(dirname ${my_dir})/BirdDB.txt
|
||||
echo "Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap" | sudo -u ${BIRDNET_USER} tee -a $(dirname ${my_dir})/BirdDB.txt
|
||||
if ! [ -f $(dirname ${my_dir})/BirdDB.txt ];then
|
||||
sudo -u ${USER} touch $(dirname ${my_dir})/BirdDB.txt
|
||||
echo "Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap" | sudo -u ${USER} tee -a $(dirname ${my_dir})/BirdDB.txt
|
||||
elif ! grep Date $(dirname ${my_dir})/BirdDB.txt;then
|
||||
sudo -u ${USER} sed -i '1 i\Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap' $(dirname ${my_dir})/BirdDB.txt
|
||||
fi
|
||||
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt &&
|
||||
chown pi:pi ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt
|
||||
|
||||
|
||||
sudo -u ${BIRDNET_USER} cp -f ${HOME}/BirdNET-Pi/homepage/index.html ${EXTRACTED}/
|
||||
echo "Dropping and re-creating database"
|
||||
sudo /home/pi/BirdNET-Pi/scripts/createdb_bullseye.sh
|
||||
echo "Restarting services"
|
||||
sudo systemctl restart birdnet_recording.service
|
||||
sudo systemctl start birdnet_recording.service
|
||||
|
||||
+43
-19
@@ -1,5 +1,22 @@
|
||||
<?php
|
||||
session_start();
|
||||
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';
|
||||
@@ -31,12 +48,9 @@ a {
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
width:100%;
|
||||
width:50%;
|
||||
border: none;
|
||||
background-color: #04AA6D;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
padding: 10px 10px;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
@@ -55,6 +69,7 @@ form {
|
||||
text-align:left;
|
||||
margin-left:20px;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom:0px;
|
||||
}
|
||||
@@ -73,6 +88,9 @@ input {
|
||||
font-size:large;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
select {
|
||||
width:100%;
|
||||
}
|
||||
h2 {
|
||||
margin-bottom:0px;
|
||||
text-align:center;
|
||||
@@ -82,9 +100,12 @@ input {
|
||||
margin-left:0px;
|
||||
}
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
input, label {
|
||||
width:100%;
|
||||
{
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -92,7 +113,7 @@ input {
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
<form action="write_config.php" method="POST">
|
||||
<form action="write_config.php" method="POST" name="normal">
|
||||
<?php
|
||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
||||
@@ -100,16 +121,17 @@ 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>
|
||||
<p><a href="mailto:tim@birdweather.com?subject=Request%20BirdWeather%20ID&body=<?php include('birdweather_request.php'); ?>" target="top">Email Tim</a> to request a BirdWeather ID</p>
|
||||
<label for="pushed_app_key">Pushed App Key: </label>
|
||||
<input name="pushed_app_key" type="text" value="<?php print($config['PUSHED_APP_KEY']);?>" /><br>
|
||||
<label for="pushed_app_secret">Pushed App Secret: </label>
|
||||
<input name="pushed_app_secret" type="text" value="<?php print($config['PUSHED_APP_SECRET']);?>" /><br>
|
||||
<label for"language">Database Language: </label>
|
||||
<label for="language">Database Language: </label>
|
||||
<select name="language">
|
||||
<option value="none">Select your language</option>
|
||||
<option value="labels_af.txt">Afrikaans</option>
|
||||
@@ -143,20 +165,22 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
<option value="labels_uk.txt">Ukrainian</option>
|
||||
</select>
|
||||
<br><br>
|
||||
<input type="submit" value="<?php
|
||||
@session_start();
|
||||
|
||||
<button type="submit" name="normal" class="block"><?php
|
||||
if(isset($_SESSION['success'])){
|
||||
echo "Success!";
|
||||
unset($_SESSION['success']);
|
||||
} else {
|
||||
echo "Update Settings";
|
||||
}
|
||||
?>">
|
||||
<br>
|
||||
<br>
|
||||
<button type="text"><a href="advanced.php">Advanced Settings</a></button>
|
||||
?></button>
|
||||
</form>
|
||||
<form action="advanced.php" class="form2">
|
||||
<button type="submit" class="block">Advanced Settings</button>
|
||||
</form>
|
||||
<form action="index.html" class="form2">
|
||||
<button type="submit" class="block">Tools</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ GRANT ALL ON birds.* TO 'birder'@'localhost' IDENTIFIED BY '${DB_PWD}' WITH GRAN
|
||||
FLUSH PRIVILEGES;
|
||||
exit
|
||||
EOF
|
||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/server.py
|
||||
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# This script performs the mysql_secure_installation
|
||||
# Creates the birds database
|
||||
# Creates the detections table
|
||||
# Creates the birder user and grants them appropriate
|
||||
# permissions
|
||||
# If using this script to re-initialize (DROP then CREATE)
|
||||
# the DB, be sure to run this as root or with sudo
|
||||
source /etc/birdnet/birdnet.conf
|
||||
DB_ROOT_PWD=staggerwontonpurporting
|
||||
mysql_secure_installation << EOF
|
||||
|
||||
y
|
||||
${DB_ROOT_PWD}
|
||||
${DB_ROOT_PWD}
|
||||
y
|
||||
y
|
||||
y
|
||||
EOF
|
||||
|
||||
mysql << EOF
|
||||
DROP DATABASE IF EXISTS birds;
|
||||
CREATE DATABASE IF NOT EXISTS birds;
|
||||
|
||||
USE birds;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS detections (
|
||||
Date DATE,
|
||||
Time TIME,
|
||||
Sci_Name VARCHAR(100) NOT NULL,
|
||||
Com_Name VARCHAR(100) NOT NULL,
|
||||
Confidence FLOAT,
|
||||
Lat FLOAT,
|
||||
Lon FLOAT,
|
||||
Cutoff FLOAT,
|
||||
Week INT,
|
||||
Sens FLOAT,
|
||||
Overlap FLOAT);
|
||||
GRANT ALL ON birds.* TO 'birder'@'localhost' IDENTIFIED BY '${DB_PWD}' WITH GRANT OPTION;
|
||||
FLUSH PRIVILEGES;
|
||||
exit
|
||||
EOF
|
||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewday.php
|
||||
sudo -u${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/overview.php
|
||||
+81
-67
@@ -1,4 +1,9 @@
|
||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
||||
|
||||
import mysql.connector as sql
|
||||
import os
|
||||
import configparser
|
||||
|
||||
import pandas as pd
|
||||
import seaborn as sns
|
||||
# import numpy as np
|
||||
@@ -7,82 +12,75 @@ from matplotlib.colors import LogNorm
|
||||
from datetime import datetime
|
||||
import textwrap
|
||||
|
||||
#Extract DB_PWD from thisrun.txt
|
||||
with open('/home/pi/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||
this_run = f.readlines()
|
||||
db_pwd = str(str(str([i for i in this_run if i.startswith('DB_PWD')]).split('=')[1]).split('\\')[0])
|
||||
|
||||
|
||||
#Read database into Pandas dataframe
|
||||
df = pd.read_csv('~/BirdNET-Pi/BirdDB.txt', sep=';')
|
||||
db_connection = sql.connect(host='localhost',
|
||||
database='birds',
|
||||
user='birder',
|
||||
password=db_pwd)
|
||||
|
||||
|
||||
db_cursor=db_connection.cursor(dictionary=True)
|
||||
|
||||
db_cursor.execute('SELECT * FROM detections')
|
||||
|
||||
table_rows = db_cursor.fetchall()
|
||||
|
||||
df=pd.DataFrame(table_rows)
|
||||
|
||||
#Convert Date and Time Fields to Panda's format
|
||||
df['Date']=pd.to_datetime(df['Date'])
|
||||
df['Time']=pd.to_datetime(df['Time'])
|
||||
df['Time']=pd.to_datetime(df['Time'], unit='ns')
|
||||
|
||||
|
||||
#Add round hours to dataframe
|
||||
df['Hour of Day'] = [r.hour for r in df.Time]
|
||||
|
||||
#Create separate dataframes for separate locations
|
||||
df_jhb=df[df.Lat > -32]
|
||||
df_ec = df[df.Lat < -32]
|
||||
df_plt=df #Default to use the whole Dbase
|
||||
|
||||
#Get todays readings for Joburg
|
||||
#Get todays readings
|
||||
now = datetime.now()
|
||||
df_jhb_today = df_jhb[df_jhb['Date']==now.strftime("%Y-%m-%d")]
|
||||
df_plt_today = df_plt[df_plt['Date']==now.strftime("%Y-%m-%d")]
|
||||
|
||||
# Definition to start getting top N detections - work in process
|
||||
def filter_by_freq(df: pd.DataFrame, column: str, min_freq: int) -> pd.DataFrame:
|
||||
"""Filters the DataFrame based on the value frequency in the specified column.
|
||||
#Set number of species to report
|
||||
readings=10
|
||||
|
||||
:param df: DataFrame to be filtered.
|
||||
:param column: Column name that should be frequency filtered.
|
||||
:param min_freq: Minimal value frequency for the row to be accepted.
|
||||
:return: Frequency filtered DataFrame.
|
||||
"""
|
||||
# Frequencies of each value in the column.
|
||||
freq = df[column].value_counts()
|
||||
# Select frequent values. Value is in the index.
|
||||
frequent_values = freq[freq >= min_freq].index
|
||||
# Return only rows with value frequency above threshold.
|
||||
return df[df[column].isin(frequent_values)]
|
||||
|
||||
#Get top readings today
|
||||
min_valuecounts = 2
|
||||
|
||||
|
||||
jhb_gt_min = filter_by_freq (df_jhb_today,'Com_Name', min_valuecounts)
|
||||
|
||||
jhb_gt_min_counts = jhb_gt_min['Com_Name'].value_counts()
|
||||
print(jhb_gt_min_counts)
|
||||
|
||||
|
||||
jhb_top10_today = (df_jhb_today['Com_Name'].value_counts()[:10])
|
||||
df_jhb_top10_today = df_jhb_today[df_jhb_today.Com_Name.isin(jhb_top10_today.index)]
|
||||
|
||||
#Get bottom 10 today
|
||||
jhb_bot10_today=(df_jhb_today['Com_Name'].value_counts()[-10:])
|
||||
df_jhb_bot10_today = df_jhb_today[df_jhb_today.Com_Name.isin(jhb_bot10_today.index)]
|
||||
plt_top10_today = (df_plt_today['Com_Name'].value_counts()[:readings])
|
||||
df_plt_top10_today = df_plt_today[df_plt_today.Com_Name.isin(plt_top10_today.index)]
|
||||
|
||||
#Set Palette for graphics
|
||||
pal = "Greens"
|
||||
|
||||
#Set up plot axes and titles
|
||||
f, axs = plt.subplots(1, 2, figsize = (10, 4), gridspec_kw=dict(width_ratios=[3, 5]))
|
||||
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0, hspace=None)
|
||||
f, axs = plt.subplots(1, 3, figsize = (10, 4), gridspec_kw=dict(width_ratios=[3, 2, 5]))
|
||||
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0, hspace=0)
|
||||
|
||||
|
||||
#Generate frequency plot
|
||||
plot=sns.countplot(y='Com_Name', data = df_jhb_top10_today, palette = pal+"_r", order=pd.value_counts(df_jhb_top10_today['Com_Name']).iloc[:20].index, ax=axs[0])
|
||||
plot=sns.countplot(y='Com_Name', data = df_plt_top10_today, palette = pal+"_r", order=pd.value_counts(df_plt_top10_today['Com_Name']).iloc[:readings].index, ax=axs[0])
|
||||
|
||||
#Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
||||
# plot.grid(True, axis='y')
|
||||
|
||||
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(),15)) for ticklabel in plot.get_yticklabels()])
|
||||
z=plot.get_ymajorticklabels()
|
||||
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(),15)) for ticklabel in plot.get_yticklabels()], fontsize = 10)
|
||||
plot.set(ylabel=None)
|
||||
plot.set(xlabel="Detections")
|
||||
|
||||
huw=df_plt_top10_today.groupby('Com_Name')['Confidence'].mean()
|
||||
plot = sns.boxenplot(x=df_plt_top10_today['Confidence']*100,color='Green', y=df_plt_top10_today['Com_Name'], ax=axs[1],order=pd.value_counts(df_plt_top10_today['Com_Name']).iloc[:readings].index)
|
||||
plot.set(xlabel="Confidence", ylabel=None,yticklabels=[])
|
||||
|
||||
|
||||
#Generate crosstab matrix for heatmap plot
|
||||
|
||||
heat = pd.crosstab(df_jhb_top10_today['Com_Name'],df_jhb_top10_today['Hour of Day'])
|
||||
heat = pd.crosstab(df_plt_top10_today['Com_Name'],df_plt_top10_today['Hour of Day'])
|
||||
#Order heatmap Birds by frequency of occurrance
|
||||
heat.index = pd.CategoricalIndex(heat.index, categories = pd.value_counts(df_jhb_top10_today['Com_Name']).iloc[:10].index)
|
||||
heat.index = pd.CategoricalIndex(heat.index, categories = pd.value_counts(df_plt_top10_today['Com_Name']).iloc[:readings].index)
|
||||
heat.sort_index(level=0, inplace=True)
|
||||
|
||||
|
||||
@@ -91,7 +89,7 @@ heat_frame = pd.DataFrame(data=0, index=heat.index, columns = hours_in_day)
|
||||
heat=(heat+heat_frame).fillna(0)
|
||||
|
||||
#Generatie heatmap plot
|
||||
plot = sns.heatmap(heat, norm=LogNorm(), annot=True, fmt="g", annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False)
|
||||
plot = sns.heatmap(heat, norm=LogNorm(), annot=True, annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[2], yticklabels = False)
|
||||
|
||||
# Set heatmap border
|
||||
for _, spine in plot.spines.items():
|
||||
@@ -100,55 +98,71 @@ for _, spine in plot.spines.items():
|
||||
plot.set(ylabel=None)
|
||||
plot.set(xlabel="Hour of Day")
|
||||
#Set combined plot layout and titles
|
||||
plt.tight_layout()
|
||||
# plt.tight_layout()
|
||||
f.subplots_adjust(top=0.9)
|
||||
plt.suptitle("Last Updated: "+ str(now.strftime("%B, %d at %T")))
|
||||
plt.suptitle("Last Updated: "+ str(now.strftime("%d %m %Y %H:%M")))
|
||||
|
||||
#Save combined plot
|
||||
savename='/home/pi/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%d-%m-%Y"))+'.png'
|
||||
plt.savefig(savename)
|
||||
# plt.show()
|
||||
plt.close()
|
||||
|
||||
|
||||
#Get bottom 10 today
|
||||
jhb_bot10_today=(df_jhb_today['Com_Name'].value_counts()[-10:])
|
||||
df_jhb_bot10_today = df_jhb_today[df_jhb_today.Com_Name.isin(jhb_bot10_today.index)]
|
||||
plt_bot10_today = (df_plt_today['Com_Name'].value_counts()[-readings:])
|
||||
df_plt_bot10_today = df_plt_today[df_plt_today.Com_Name.isin(plt_bot10_today.index)]
|
||||
|
||||
#Set Palette for graphics
|
||||
pal = "Reds"
|
||||
|
||||
#Set up plot axes and titles
|
||||
f, axs = plt.subplots(1, 2, figsize = (8, 4), gridspec_kw=dict(width_ratios=[3, 5]))
|
||||
f, axs = plt.subplots(1, 3, figsize = (10, 4), gridspec_kw=dict(width_ratios=[3, 2, 5]))
|
||||
plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0, hspace=0)
|
||||
|
||||
|
||||
#Generate frequency plot
|
||||
plot=sns.countplot(y='Com_Name', data = df_jhb_bot10_today, palette = pal+"_r", order=pd.value_counts(df_jhb_bot10_today['Com_Name']).iloc[:10].index, ax=axs[0])
|
||||
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(),17)) for ticklabel in plot.get_yticklabels()])
|
||||
plot.set(ylabel=None)
|
||||
plot.set(xlabel="no. of detections")
|
||||
#Generate crosstab matrix for heatmap plot
|
||||
heat = pd.crosstab(df_jhb_bot10_today['Com_Name'],df_jhb_bot10_today['Hour of Day'])
|
||||
plot=sns.countplot(y='Com_Name', data = df_plt_bot10_today, palette = pal+"_r", order=pd.value_counts(df_plt_bot10_today['Com_Name']).iloc[-readings:].index, ax=axs[0])
|
||||
|
||||
#Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars
|
||||
# plot.grid(True, axis='y')
|
||||
z=plot.get_ymajorticklabels()
|
||||
plot.set_yticklabels(['\n'.join(textwrap.wrap(ticklabel.get_text(),15)) for ticklabel in plot.get_yticklabels()], fontsize = 10)
|
||||
plot.set(ylabel=None)
|
||||
plot.set(xlabel="Detections")
|
||||
|
||||
huw=df_plt_bot10_today.groupby('Com_Name')['Confidence'].mean()
|
||||
plot = sns.boxenplot(x=df_plt_bot10_today['Confidence']*100,color='Red', y=df_plt_bot10_today['Com_Name'], ax=axs[1],order=pd.value_counts(df_plt_bot10_today['Com_Name']).iloc[-readings:].index)
|
||||
plot.set(xlabel="Confidence", ylabel=None,yticklabels=[])
|
||||
|
||||
|
||||
#Generate crosstab matrix for heatmap plot
|
||||
|
||||
heat = pd.crosstab(df_plt_bot10_today['Com_Name'],df_plt_bot10_today['Hour of Day'])
|
||||
#Order heatmap Birds by frequency of occurrance
|
||||
heat.index = pd.CategoricalIndex(heat.index, categories = pd.value_counts(df_jhb_bot10_today['Com_Name']).iloc[:10].index)
|
||||
heat.index = pd.CategoricalIndex(heat.index, categories = pd.value_counts(df_plt_bot10_today['Com_Name']).iloc[-readings:].index)
|
||||
heat.sort_index(level=0, inplace=True)
|
||||
|
||||
|
||||
hours_in_day = pd.Series(data = range(0,24))
|
||||
heat_frame = pd.DataFrame(data=0, index=heat.index, columns = hours_in_day)
|
||||
heat=(heat+heat_frame).fillna(0)
|
||||
|
||||
#Generate heatmap plot
|
||||
plot = sns.heatmap(heat, norm=LogNorm(), annot=True, annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[1], yticklabels = False)
|
||||
#Generatie heatmap plot
|
||||
plot = sns.heatmap(heat, norm=LogNorm(), annot=True, annot_kws={"fontsize":7}, cmap = pal , square = False, cbar=False, linewidths = 0.5, linecolor = "Grey", ax=axs[2], yticklabels = False)
|
||||
|
||||
# Set heatmap border
|
||||
for _, spine in plot.spines.items():
|
||||
spine.set_visible(True)
|
||||
plot.set(ylabel=None)
|
||||
|
||||
#Set combined plot layout and titles
|
||||
plt.tight_layout()
|
||||
f.subplots_adjust(top=0.9)
|
||||
plt.suptitle("Bottom 10 Detected: "+ str(now.strftime("%d-%h-%Y %H:%M")))
|
||||
plot.set(ylabel=None)
|
||||
plot.set(xlabel="Hour of Day")
|
||||
#Set combined plot layout and titles
|
||||
# plt.tight_layout()
|
||||
f.subplots_adjust(top=0.9)
|
||||
plt.suptitle("Last Updated: "+ str(now.strftime("%d %m %Y %H:%M")))
|
||||
|
||||
#Save combined plot
|
||||
savename='/home/pi/BirdSongs/Extracted/Charts/Combo2-'+str(now.strftime("%d-%m-%Y"))+'.png'
|
||||
plt.savefig(savename)
|
||||
|
||||
#plt.show()
|
||||
plt.close()
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
$file='/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
||||
$str=file_get_contents("$file");
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
|
||||
if (isset($_POST['species']))
|
||||
foreach($_POST['species'] as $selectedOption) {
|
||||
$content = file_get_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt");
|
||||
$newcontent = str_replace($selectedOption, "", "$content");
|
||||
file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", "$newcontent");
|
||||
}
|
||||
$file='/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
||||
$str=file_get_contents("$file");
|
||||
//$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
header("Location: {$_SERVER['HTTP_REFERER']}");
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
$file='/home/pi/BirdNET-Pi/include_species_list.txt';
|
||||
$str=file_get_contents("$file");
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
|
||||
if (isset($_POST['species']))
|
||||
foreach($_POST['species'] as $selectedOption) {
|
||||
$content = file_get_contents("/home/pi/BirdNET-Pi/include_species_list.txt");
|
||||
$newcontent = str_replace($selectedOption, "", "$content");
|
||||
file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", "$newcontent");
|
||||
}
|
||||
$file='/home/pi/BirdNET-Pi/include_species_list.txt';
|
||||
$str=file_get_contents("$file");
|
||||
//$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
header("Location: {$_SERVER['HTTP_REFERER']}");
|
||||
exit;
|
||||
?>
|
||||
+11
-2
@@ -6,10 +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
|
||||
purge) echo "Removing more data"
|
||||
rm -rfv ${PROCESSED}/*;;
|
||||
keep) echo "Stopping Core Services"
|
||||
/usr/local/bin/stop_core_services.sh;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Hi, Tim, and thank you so much for BirdWeather.com!
|
||||
%0A%0A
|
||||
Below is the information I would like to use to request a BirdWeather ID
|
||||
%0A%0A
|
||||
Latitude={{ LATITUDE }}%0A
|
||||
Longitude={{ LONGITUDE }}%0A
|
||||
Location= [ Create a location name ]%0A
|
||||
%0A%0A
|
||||
Thank you so much!%0A
|
||||
[ Your Name Here ]
|
||||
%0A%0A
|
||||
Disclaimer: By requesting this BirdWeather ID, I acknowledge that my location%0A
|
||||
and recording data will be made public.
|
||||
@@ -0,0 +1,121 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||
box-sizing: border-box;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Create two unequal columns that floats next to each other */
|
||||
.column {
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.first {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.second {
|
||||
width: 10%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.third {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
/* Clear floats after the columns */
|
||||
.row:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
body {
|
||||
background-color: rgb(119, 196, 135);
|
||||
}
|
||||
|
||||
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
width:100%;
|
||||
border: none;
|
||||
background-color: #04AA6D;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
h2 {
|
||||
text-align: center;
|
||||
}
|
||||
select {
|
||||
width:100%
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
//remove <script></script> and add php start and close tag
|
||||
//comment these two lines when code started working fine
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
$filename = 'labels.txt';
|
||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
|
||||
?>
|
||||
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
<h2>All Species Labels</h2>
|
||||
<form action="add_to_exclude.php" method="POST" id="add">
|
||||
<select name="species[]" id="species" multiple size="30">
|
||||
<option selected value="base">Please Select</option>
|
||||
<?php
|
||||
foreach($eachlines as $lines){
|
||||
echo "<option value='".$lines."'>$lines</option>";
|
||||
}?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="column second">
|
||||
<button type="submit" form="add" class="block">Add to list</button><br>
|
||||
<button type="submit" form="del" class="block">Remove from list</button>
|
||||
</div>
|
||||
|
||||
<div class="column third">
|
||||
<h2>Excluded Species List</h2>
|
||||
<form action="del_from_exclude.php" method="POST" id="del">
|
||||
<select name="species[]" id="value2" multiple size="30">
|
||||
<option selected value="base">Please Select</option>
|
||||
<?php
|
||||
$filename = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
foreach($eachlines as $lines){
|
||||
echo "<option value='".$lines."'>$lines</option>";
|
||||
}?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -124,6 +124,11 @@ for h in "${SCAN_DIRS[@]}";do
|
||||
if (( $(echo "${START} < 1" | bc -l) ));then START=0;fi
|
||||
if (( $(echo "${END} > ${RECORDING_LENGTH}" | bc -l) ));then END=${RECORDING_LENGTH};fi
|
||||
|
||||
if [ "${RECORDING_LENGTH}" == "${EXTRACTION_LENGTH}" ];then
|
||||
START=0
|
||||
END=${RECORDING_LENGTH}
|
||||
fi
|
||||
|
||||
ffmpeg -hide_banner -loglevel error -nostdin -i "${h}/${OLDFILE}" \
|
||||
-acodec copy -ss "${START}" -to "${END}"\
|
||||
"${NEWSPECIES_BYDATE}/${NEWFILE}"
|
||||
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
The team takes security bugs seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.
|
||||
|
||||
To report a security issue, email ccpprogrammers[at]gmail.com and include the word "SECURITY" in the subject line.
|
||||
|
||||
The team will send a response indicating the next steps in handling your report. After the initial reply to your report you will be kept informed of the progress towards a fix and full announcement.
|
||||
|
||||
Report security bugs in third-party modules to the person or team maintaining the module.
|
||||
|
||||
## Disclosure Policy
|
||||
|
||||
When the security team receives a security bug report, they will assign it to a
|
||||
primary handler. This person will coordinate the fix and release process,
|
||||
involving the following steps:
|
||||
|
||||
* Confirm the problem and determine the affected versions.
|
||||
* Audit code to find any potential similar problems.
|
||||
* Prepare fixes for all releases still under maintenance. These fixes will be
|
||||
released as fast as possible to npm.
|
||||
|
||||
## Comments on this Policy
|
||||
|
||||
If you have suggestions on how this process could be improved please submit a
|
||||
pull request.
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,153 @@
|
||||
<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';
|
||||
box-sizing: border-box;
|
||||
}
|
||||
body {
|
||||
width: 50%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
background-color: rgb(119, 196, 135);
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.block {
|
||||
display: block;
|
||||
width:100%;
|
||||
border: none;
|
||||
padding: 10px 10px;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
select {
|
||||
font-size:large;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
select option {
|
||||
font-size:large;
|
||||
}
|
||||
|
||||
form {
|
||||
text-align:left;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-bottom:0px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-left: -10px;
|
||||
}
|
||||
label {
|
||||
float:left;
|
||||
width:40%;
|
||||
font-weight:bold;
|
||||
}
|
||||
input {
|
||||
width:60%;
|
||||
text-align:center;
|
||||
font-size:large;
|
||||
}
|
||||
.center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
h1, h2 {
|
||||
text-align:center;
|
||||
}
|
||||
form {
|
||||
text-align:left;
|
||||
margin-left:0px;
|
||||
}
|
||||
select, body, button, input, label {
|
||||
width:100%;
|
||||
{
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<?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');
|
||||
} ?>
|
||||
|
||||
<h1 style="float:top;text-align:center;">Welcome!</h1>
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<form action="write_config.php" method="POST" name="firstboot">
|
||||
<p style="font-size:large">Thank you for installing BirdNET-Pi!
|
||||
to get started, fill out the Required sections below.</p>
|
||||
<h2>Required</h2>
|
||||
<label for="latitude">Latitude: </label>
|
||||
<input name="latitude" type="number" min="-90" max="90" step="0.0001" value="<?php print($config['LATITUDE']);?>" required/><br>
|
||||
<label for="longitude">Longitude: </label>
|
||||
<input name="longitude" type="number" min="-180" max="180" step="0.0001" value="<?php print($config['LONGITUDE']);?>" required/><br>
|
||||
<h2>Optional Services</h2>
|
||||
<p>The services below are not required, but they are pretty cool.</p>
|
||||
<label for="birdweather_id">BirdWeather ID: </label>
|
||||
<input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
|
||||
<p>app.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 detections and visualizations so that you can listen to, view, and read about the birds in various regions across the globe! Pretty cool! <a href="mailto:tim@birdweather.com?subject=Request%20BirdWeather%20ID&body=<?php include('birdweather_request.php'); ?>" target="top">Email Tim</a> to request a BirdWeather ID</p>
|
||||
|
||||
<label for="pushed_app_key">Pushed App Key: </label>
|
||||
<input name="pushed_app_key" type="text" value="" /><br>
|
||||
<label for="pushed_app_secret">Pushed App Secret: </label>
|
||||
<input name="pushed_app_secret" type="text" value="" /><br>
|
||||
<p>Pushed.co is used to offer New Species notifications. Sorry Android users, but the Pushed.co Application is only for iOS.</p>
|
||||
<label for="language">Database Language: </label>
|
||||
<select name="language">
|
||||
<option value="none">English</option>
|
||||
<option value="labels_af.txt">Afrikaans</option>
|
||||
<option value="labels_ca.txt">Catalan</option>
|
||||
<option value="labels_cs.txt">Czech</option>
|
||||
<option value="labels_zh.txt">Chinese</option>
|
||||
<option value="labels_hr.txt">Croatian</option>
|
||||
<option value="labels_da.txt">Danish</option>
|
||||
<option value="labels_nl.txt">Dutch</option>
|
||||
<option value="labels_et.txt">Estonian</option>
|
||||
<option value="labels_fi.txt">Finnish</option>
|
||||
<option value="labels_fr.txt">French</option>
|
||||
<option value="labels_de.txt">German</option>
|
||||
<option value="labels_hu.txt">Hungarian</option>
|
||||
<option value="labels_is.txt">Icelandic</option>
|
||||
<option value="labels_id.txt">Indonesia</option>
|
||||
<option value="labels_it.txt">Italian</option>
|
||||
<option value="labels_ja.txt">Japanese</option>
|
||||
<option value="labels_lv.txt">Latvian</option>
|
||||
<option value="labels_lt.txt">Lithuania</option>
|
||||
<option value="labels_no.txt">Norwegian</option>
|
||||
<option value="labels_pl.txt">Polish</option>
|
||||
<option value="labels_pt.txt">Portugues</option>
|
||||
<option value="labels_ru.txt">Russian</option>
|
||||
<option value="labels_sk.txt">Slovak</option>
|
||||
<option value="labels_sl.txt">Slovenian</option>
|
||||
<option value="labels_es.txt">Spanish</option>
|
||||
<option value="labels_sv.txt">Swedish</option>
|
||||
<option value="labels_th.txt">Thai</option>
|
||||
<option value="labels_uk.txt">Ukrainian</option>
|
||||
</select>
|
||||
<br><br>
|
||||
</body>
|
||||
<footer>
|
||||
<button type="submit" name"firstboot" class="block">I Am Finished!</button>
|
||||
</footer>
|
||||
</form>
|
||||
@@ -0,0 +1,121 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||
box-sizing: border-box;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Create two unequal columns that floats next to each other */
|
||||
.column {
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.first {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
.second {
|
||||
width: 10%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.third {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
/* Clear floats after the columns */
|
||||
.row:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
body {
|
||||
background-color: rgb(119, 196, 135);
|
||||
}
|
||||
|
||||
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
width:100%;
|
||||
border: none;
|
||||
background-color: #04AA6D;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
h2 {
|
||||
text-align: center;
|
||||
}
|
||||
select {
|
||||
width:100%
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
//remove <script></script> and add php start and close tag
|
||||
//comment these two lines when code started working fine
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
$filename = 'labels.txt';
|
||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
|
||||
?>
|
||||
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
<h2>All Species Labels</h2>
|
||||
<form action="add_to_include.php" method="POST" id="add">
|
||||
<select name="species[]" id="species" multiple size="30">
|
||||
<option selected value="base">Please Select</option>
|
||||
<?php
|
||||
foreach($eachlines as $lines){
|
||||
echo "<option value='".$lines."'>$lines</option>";
|
||||
}?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="column second">
|
||||
<button type="submit" form="add" class="block">Add to list</button><br>
|
||||
<button type="submit" form="del" class="block">Remove from list</button>
|
||||
</div>
|
||||
|
||||
<div class="column third">
|
||||
<h2>Included Species List</h2>
|
||||
<form action="del_from_include.php" method="POST" id="del">
|
||||
<select name="species[]" id="value2" multiple size="30">
|
||||
<option selected value="base">Please Select</option>
|
||||
<?php
|
||||
$filename = '/home/pi/BirdNET-Pi/include_species_list.txt';
|
||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
foreach($eachlines as $lines){
|
||||
echo "<option value='".$lines."'>$lines</option>";
|
||||
}?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
+26
-36
@@ -1,6 +1,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||
box-sizing: border-box;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@@ -45,55 +49,41 @@ a {
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
@media screen and (max-width: 1000px) {
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
|
||||
<form action="/scripts/stop_core_services.php" onclick="return confirm('Stop core services?')">
|
||||
<button type="submit" class="block">Stop Core Services</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_services.php" onclick="return confirm('Restart ALL services?')">
|
||||
<button type="submit" class="block">Restart ALL Services</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_birdnet_analysis.php">
|
||||
<button type="submit" class="block">Restart BirdNET Analysis</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_birdnet_recording.php">
|
||||
<button type="submit" class="block">Restart Recording</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_extraction.php">
|
||||
<button type="submit" class="block">Restart Extraction</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_caddy.php" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')">
|
||||
<button type="submit" class="block">Restart Caddy</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="column second">
|
||||
<form >
|
||||
<button type="submit" class="block"><a target="_content" href="/scripts/adminer.php">Database Maintenance</a></button>
|
||||
<form action="/scripts/filemanager/filemanager.php" target="_top">
|
||||
<button type="submit" class="block">File Manager</button>
|
||||
</form>
|
||||
<form action="/scripts/adminer.php" target="_top">
|
||||
<button type="submit" class="block">Database Maintenance</button>
|
||||
</form>
|
||||
<form action="/scripts/config.php">
|
||||
<button type="submit" class="block">Settings</button>
|
||||
</form>
|
||||
<form action="/scripts/system_controls.php">
|
||||
<button type="submit" class="block">System Controls</button>
|
||||
</form>
|
||||
<form action="/scripts/reboot_system.php" onclick="return confirm('Are you sure you want to reboot?')">
|
||||
<button type="submit" class="block">Reboot</button>
|
||||
</div>
|
||||
<div class="column second">
|
||||
<form action="http://birdnetpi.local:8888" target="top">
|
||||
<button type="submit" class="block">Web Terminal</button>
|
||||
</form>
|
||||
<form action="/scripts/update_birdnet.php" onclick="return confirm('BE SURE TO STASH ANY LOCAL CHANGES YOU HAVE MADE TO THE SYSTEM BEFORE UPDATING!!!')">
|
||||
<button style="color:blue;" type="submit" class="block">Update</button>
|
||||
<form action="/scripts/service_controls.php">
|
||||
<button type="submit" class="block">Manage Services</button>
|
||||
</form>
|
||||
<form action="/scripts/shutdown_system.php" onclick="return confirm('Are you sure you want to shutdown?')">
|
||||
<button style="color: red;" type="submit" class="block">Shutdown</button>
|
||||
<form action="/scripts/include_list.php">
|
||||
<button type="submit" class="block">Included Species List</button>
|
||||
</form>
|
||||
<form action="/scripts/clear_all_data.php" onclick="return confirm('Clear ALL Data? This cannot be undone.')">
|
||||
<button style="color: red;" type="submit" class="block">Clear ALL data</button>
|
||||
<form action="/scripts/exclude_list.php">
|
||||
<button type="submit" class="block">Excluded Species List</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -238,7 +238,7 @@ ICE_PWD=${ICE_PWD}
|
||||
## the BirdNET-Pi on your local network, keep this EMPTY.
|
||||
|
||||
BIRDNETPI_URL=${BIRDNETPI_URL}
|
||||
EXTRACTIONLOG_URL${EXTRACTIONLOG_URL}
|
||||
WEBTERMINAL_URL${WEBTERMINAL_URL}
|
||||
BIRDNETLOG_URL=${BIRDNETLOG_URL}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
+85
-59
@@ -12,13 +12,19 @@ gotty_url="https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_a
|
||||
config_file="$(dirname ${my_dir})/birdnet.conf"
|
||||
|
||||
set_hostname() {
|
||||
if [ "$(hostname)" != "birdnetpi" ];then
|
||||
if [ "$(hostname)" == "raspberrypi" ];then
|
||||
echo "Setting hostname to 'birdnetpi'"
|
||||
hostnamectl set-hostname birdnetpi
|
||||
sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts
|
||||
fi
|
||||
}
|
||||
|
||||
install_ftpd() {
|
||||
if ! [ -f /etc/ftpuseres ];then
|
||||
apt -y install ftpd
|
||||
fi
|
||||
}
|
||||
|
||||
update_system() {
|
||||
apt update && apt -y upgrade
|
||||
}
|
||||
@@ -51,9 +57,10 @@ install_birdnet_analysis() {
|
||||
cat << EOF > /etc/systemd/system/birdnet_analysis.service
|
||||
[Unit]
|
||||
Description=BirdNET Analysis
|
||||
After=birdnet_server.service
|
||||
Requires=birdnet_server.service
|
||||
[Service]
|
||||
Restart=always
|
||||
RuntimeMaxSec=10800
|
||||
Type=simple
|
||||
RestartSec=2
|
||||
User=${USER}
|
||||
@@ -64,6 +71,24 @@ EOF
|
||||
systemctl enable birdnet_analysis.service
|
||||
}
|
||||
|
||||
install_birdnet_server() {
|
||||
echo "Installing the birdnet_server.service"
|
||||
cat << EOF > /etc/systemd/system/birdnet_server.service
|
||||
[Unit]
|
||||
Description=BirdNET Analysis Server
|
||||
Before=birdnet_analysis.service
|
||||
[Service]
|
||||
Restart=always
|
||||
Type=simple
|
||||
RestartSec=10
|
||||
User=${USER}
|
||||
ExecStart=/usr/local/bin/server.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable birdnet_server.service
|
||||
}
|
||||
|
||||
install_extraction_service() {
|
||||
echo "Installing the extraction.service and extraction.timer"
|
||||
cat << EOF > /etc/systemd/system/extraction.service
|
||||
@@ -82,11 +107,9 @@ EOF
|
||||
[Unit]
|
||||
Description=BirdNET BirdSound Extraction Timer
|
||||
Requires=extraction.service
|
||||
|
||||
[Timer]
|
||||
Unit=extraction.service
|
||||
OnCalendar=*:*:0/10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
@@ -123,29 +146,37 @@ create_necessary_dirs() {
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED}
|
||||
if [ ! -z ${BIRDNETLOG_URL} ];then
|
||||
BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "birdnetpi.local:8080" ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" ${i}
|
||||
done
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
if [ ! -z ${EXTRACTIONLOG_URL} ];then
|
||||
EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "birdnetpi.local:8888" ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" ${i}
|
||||
done
|
||||
if [ ! -z ${WEBTERMINAL_URL} ];then
|
||||
WEBTERMINAL_URL="$(echo ${WEBTERMINAL_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
|
||||
fi
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/model/labels.txt ${my_dir}/
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED}
|
||||
if [ ! -z ${BIRDNETPI_URL} ];then
|
||||
if [ -z ${BIRDNETPI_URL} ];then
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
else
|
||||
BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l birdnetpi.local ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" ${i}
|
||||
done
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED}
|
||||
@@ -160,7 +191,8 @@ create_necessary_dirs() {
|
||||
|
||||
echo "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}""
|
||||
sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
|
||||
|
||||
chmod -R g+rw $(dirname ${my_dir})
|
||||
chmod -R g+rw ${RECS_DIR}
|
||||
}
|
||||
|
||||
generate_BirdDB() {
|
||||
@@ -171,6 +203,8 @@ generate_BirdDB() {
|
||||
elif ! grep Date $(dirname ${my_dir})/BirdDB.txt;then
|
||||
sudo -u ${USER} sed -i '1 i\Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap' $(dirname ${my_dir})/BirdDB.txt
|
||||
fi
|
||||
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt &&
|
||||
chown pi:pi ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt
|
||||
}
|
||||
|
||||
install_alsa() {
|
||||
@@ -207,7 +241,6 @@ install_recording_service() {
|
||||
cat << EOF > /etc/systemd/system/birdnet_recording.service
|
||||
[Unit]
|
||||
Description=BirdNET Recording
|
||||
|
||||
[Service]
|
||||
Environment=XDG_RUNTIME_DIR=/run/user/1000
|
||||
Restart=always
|
||||
@@ -215,7 +248,6 @@ Type=simple
|
||||
RestartSec=3
|
||||
User=${USER}
|
||||
ExecStart=/usr/local/bin/birdnet_recording.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
@@ -249,7 +281,7 @@ install_Caddyfile() {
|
||||
if ! [ -z ${CADDY_PWD} ];then
|
||||
HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD})
|
||||
cat << EOF > /etc/caddy/Caddyfile
|
||||
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
basicauth /Processed* {
|
||||
@@ -270,7 +302,7 @@ http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
EOF
|
||||
else
|
||||
cat << EOF > /etc/caddy/Caddyfile
|
||||
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
reverse_proxy /stream localhost:8000
|
||||
@@ -279,17 +311,25 @@ http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -z ${EXTRACTIONLOG_URL} ];then
|
||||
if [ ! -z ${WEBTERMINAL_URL} ] && [ ! -z ${HASHWORD} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
|
||||
${EXTRACTIONLOG_URL} {
|
||||
${WEBTERMINAL_URL} {
|
||||
basicauth {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
EOF
|
||||
elif [ ! -z ${WEBTERMINAL_URL} ] && [ -z ${HASHWORD} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
${WEBTERMINAL_URL} {
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -z ${BIRDNETLOG_URL} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
|
||||
${BIRDNETLOG_URL} {
|
||||
reverse_proxy localhost:8080
|
||||
}
|
||||
@@ -299,10 +339,7 @@ EOF
|
||||
}
|
||||
|
||||
update_etc_hosts() {
|
||||
#BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
#EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
#BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sed -ie s/'birdnetpi.local'/"birdnetpi.local ${BIRDNETPI_URL//https:\/\/} ${EXTRACTIONLOG_URL//https:\/\/} ${BIRDNETLOG_URL//https:\/\/}"/g /etc/hosts
|
||||
sed -ie s/'$(hostname).local'/"$(hostname).local ${BIRDNETPI_URL//https:\/\/} ${WEBTERMINAL_URL//https:\/\/} ${BIRDNETLOG_URL//https:\/\/}"/g /etc/hosts
|
||||
}
|
||||
|
||||
install_avahi_aliases() {
|
||||
@@ -317,17 +354,15 @@ install_avahi_aliases() {
|
||||
Description=Publish %I as alias for %H.local via mdns
|
||||
After=network.target network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
Type=simple
|
||||
ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' ' -f1)"
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable avahi-alias@birdnetpi.local.service
|
||||
systemctl enable avahi-alias@"$(hostname)".local.service
|
||||
}
|
||||
|
||||
install_spectrogram_service() {
|
||||
@@ -351,7 +386,6 @@ install_chart_viewer_service() {
|
||||
cat << EOF > /etc/systemd/system/chart_viewer.service
|
||||
[Unit]
|
||||
Description=BirdNET-Pi Chart Viewer Service
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=300
|
||||
@@ -372,40 +406,38 @@ install_gotty_logs() {
|
||||
fi
|
||||
sudo -u ${USER} ln -sf $(dirname ${my_dir})/templates/gotty \
|
||||
${HOME}/.gotty
|
||||
sudo -u ${USER} ln -sf $(dirname ${my_dir})/templates/bashrc \
|
||||
${HOME}/.bashrc
|
||||
echo "Installing the birdnet_log.service"
|
||||
cat << EOF > /etc/systemd/system/birdnet_log.service
|
||||
[Unit]
|
||||
Description=BirdNET Analysis Log
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
Type=simple
|
||||
User=${USER}
|
||||
Environment=TERM=xterm-256color
|
||||
ExecStart=/usr/local/bin/gotty -p 8080 --title-format "BirdNET-Pi Log" journalctl -o cat -fu birdnet_analysis.service
|
||||
|
||||
ExecStart=/usr/local/bin/gotty -p 8080 --title-format "BirdNET-Pi Log" journalctl -o cat -fu birdnet_server.service
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable birdnet_log.service
|
||||
echo "Installing the extraction_log.service"
|
||||
cat << EOF > /etc/systemd/system/extraction_log.service
|
||||
echo "Installing the web_terminal.service"
|
||||
cat << EOF > /etc/systemd/system/web_terminal.service
|
||||
[Unit]
|
||||
Description=BirdNET Extraction Log
|
||||
|
||||
Description=BirdNET-Pi Web Terminal
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
Type=simple
|
||||
User=${USER}
|
||||
Environment=TERM=xterm-256color
|
||||
ExecStart=/usr/local/bin/gotty -p 8888 --title-format "Extractions Log" journalctl -o cat -fu extraction.service
|
||||
|
||||
ExecStart=/usr/local/bin/gotty -w -p 8888 --title-format "BirdNET-Pi Terminal" bash
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable extraction_log.service
|
||||
systemctl enable web_terminal.service
|
||||
}
|
||||
|
||||
install_sox() {
|
||||
@@ -423,7 +455,7 @@ install_php() {
|
||||
if ! which php &> /dev/null || ! which php-fpm || ! apt list --installed | grep php-xml;then
|
||||
echo "Installing PHP modules"
|
||||
apt -qq update
|
||||
apt install -qqy php php-fpm php-mysql php-xml
|
||||
apt install -qqy php php-fpm php-mysql php-xml php-zip
|
||||
else
|
||||
echo "PHP and PHP-FPM installed"
|
||||
fi
|
||||
@@ -477,7 +509,6 @@ install_livestream_service() {
|
||||
Description=BirdNET-Pi Live Stream
|
||||
After=network-online.target
|
||||
Requires=network-online.target
|
||||
|
||||
[Service]
|
||||
Environment=XDG_RUNTIME_DIR=/run/user/1000
|
||||
Restart=always
|
||||
@@ -485,7 +516,6 @@ Type=simple
|
||||
RestartSec=3
|
||||
User=${USER}
|
||||
ExecStart=/usr/local/bin/livestream.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
@@ -505,13 +535,7 @@ install_nomachine() {
|
||||
|
||||
install_cleanup_cron() {
|
||||
echo "Installing the cleanup.cron"
|
||||
if ! crontab -u ${USER} -l &> /dev/null;then
|
||||
crontab -u ${USER} $(dirname ${my_dir})/templates/cleanup.cron &> /dev/null
|
||||
else
|
||||
crontab -u ${USER} -l > ${tmpfile}
|
||||
cat $(dirname ${my_dir})/templates/cleanup.cron >> ${tmpfile}
|
||||
crontab -u ${USER} "${tmpfile}" &> /dev/null
|
||||
fi
|
||||
cat $(dirname ${my_dir})/templates/cleanup.cron >> /etc/crontab
|
||||
}
|
||||
|
||||
install_selected_services() {
|
||||
@@ -519,6 +543,7 @@ install_selected_services() {
|
||||
update_system
|
||||
install_scripts
|
||||
install_birdnet_analysis
|
||||
install_birdnet_server
|
||||
|
||||
if [[ "${DO_EXTRACTIONS}" =~ [Yy] ]];then
|
||||
install_extraction_service
|
||||
@@ -553,6 +578,7 @@ install_selected_services() {
|
||||
create_necessary_dirs
|
||||
generate_BirdDB
|
||||
install_cleanup_cron
|
||||
install_ftpd
|
||||
}
|
||||
|
||||
if [ -f ${config_file} ];then
|
||||
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
#Display network info for phpsysinfo
|
||||
|
||||
echo "LAN IP: $(hostname -I|cut -d' ' -f1)"
|
||||
echo "Public IP: $(curl -s4 ifconfig.co)"
|
||||
echo
|
||||
echo "------------------------------"
|
||||
echo ' $(ip a) '
|
||||
ip a
|
||||
+17
-19
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
header("refresh: 300;");
|
||||
$myDate = date('d-m-Y');
|
||||
$chart = "Combo-$myDate.png";
|
||||
@@ -12,31 +15,26 @@ if ($mysqli->connect_error) {
|
||||
}
|
||||
|
||||
// SQL query to select data from database
|
||||
$sql0 = "SELECT * FROM detections";
|
||||
$fulltable = $mysqli->query($sql0);
|
||||
$totalcount = mysqli_num_rows($fulltable);
|
||||
$sql0 = "SELECT COUNT(*) AS 'Total' FROM detections";
|
||||
$totalcount = $mysqli->query($sql0);
|
||||
|
||||
$sql1 = "SELECT Com_Name, Date, Time FROM detections
|
||||
ORDER BY Date DESC, Time DESC LIMIT 1";
|
||||
$mostrecent = $mysqli->query($sql1);
|
||||
|
||||
$sql2 = "SELECT * FROM detections
|
||||
$sql2 = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
WHERE Date = CURDATE()";
|
||||
$todaystable = $mysqli->query($sql2);
|
||||
$todayscount = mysqli_num_rows($todaystable);
|
||||
$todayscount = $mysqli->query($sql2);
|
||||
|
||||
|
||||
$sql3 = "SELECT * FROM detections
|
||||
$sql3 = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
AND Time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)";
|
||||
$lasthourtable = $mysqli->query($sql3);
|
||||
$lasthourcount = mysqli_num_rows($lasthourtable);
|
||||
$lasthourcount = $mysqli->query($sql3);
|
||||
|
||||
$sql4 = "SELECT Com_Name, Date, Time, MAX(Confidence)
|
||||
FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
GROUP BY Com_Name
|
||||
ORDER BY MAX(Confidence) DESC";
|
||||
$sql4 = "SELECT Com_Name
|
||||
FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
GROUP BY Com_Name";
|
||||
$specieslist = $mysqli->query($sql4);
|
||||
$speciescount = mysqli_num_rows($specieslist);
|
||||
|
||||
@@ -104,9 +102,9 @@ while($rows=$mostrecent ->fetch_assoc())
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Number of Detections</th>
|
||||
<td><?php echo $totalcount;?></td>
|
||||
<td><?php echo $todayscount;?></td>
|
||||
<td><?php echo $lasthourcount;?></td>
|
||||
<td><?php while ($row = $totalcount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php while ($row = $todayscount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php while ($row = $lasthourcount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -122,7 +120,7 @@ while($rows=$mostrecent ->fetch_assoc())
|
||||
<h2>Today's Top 10 Species</h2>
|
||||
<?php
|
||||
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
|
||||
echo "<img src=\"/Charts/$chart?nocache=$time()\" style=\"width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
|
||||
echo "<img src=\"/Charts/$chart?nocache=time()\" style=\"width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
|
||||
} else {
|
||||
echo "<p style=\"text-align:center;margin-left:-150px;\">No Detections For Today</p>";
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pretty date suffixes
|
||||
TODAY="$(date +%e)"
|
||||
|
||||
if [[ $TODAY == ' 1' ]] || [[ $TODAY == 21 ]] || [[ $TODAY == 31 ]]; then
|
||||
SUFFIX="st"
|
||||
elif [[ $TODAY == ' 2' ]] || [[ $TODAY == 22 ]];then
|
||||
SUFFIX="nd"
|
||||
elif [[ $TODAY == ' 3' ]] || [[ $TODAY == 23 ]];then
|
||||
SUFFIX="rd"
|
||||
else
|
||||
SUFFIX="th"
|
||||
fi
|
||||
echo "$SUFFIX"
|
||||
@@ -2,7 +2,7 @@
|
||||
# Rebuild DB from BirdDB.txt
|
||||
source /etc/birdnet/birdnet.conf
|
||||
BIRDNET_DIR=/home/pi/BirdNET-Pi
|
||||
sudo ${BIRDNET_DIR}/scripts/createdb.sh
|
||||
sudo ${BIRDNET_DIR}/scripts/createdb_bullseye.sh
|
||||
sudo mysql birds -e "
|
||||
LOAD DATA LOCAL INFILE '/home/pi/BirdNET-Pi/BirdDB.txt'
|
||||
INTO TABLE detections
|
||||
|
||||
@@ -37,7 +37,7 @@ fi
|
||||
|
||||
if ! [ -z ${birdnetpi_url} ];then
|
||||
sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
sed -i s/'^EXTRACTIONLOG_URL=.*'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
sed -i s/'^WEBTERMINAL_URL=.*'/"WEBTERMINAL_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
sed -i s/'^BIRDNETLOG_URL=.*'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
# Restarts ALL services and removes ALL unprocessed audio
|
||||
source /etc/birdnet/birdnet.conf
|
||||
set -x
|
||||
my_dir=/home/pi/BirdNET-Pi/scripts
|
||||
|
||||
sudo systemctl stop birdnet_recording.service
|
||||
sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
|
||||
sudo systemctl start birdnet_recording.service
|
||||
|
||||
services=($(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort))
|
||||
services=(web_terminal.service
|
||||
spectrogram_viewer.service
|
||||
pushed_notifications.service
|
||||
livestream.service
|
||||
icecast2.service
|
||||
extraction.timer
|
||||
extraction.service
|
||||
chart_viewer.service
|
||||
birdnet_recording.service
|
||||
birdnet_log.service
|
||||
birdnet_server.service
|
||||
birdnet_analysis.service)
|
||||
|
||||
sudo pkill server.py
|
||||
for i in "${services[@]}";do
|
||||
sudo systemctl restart "${i}"
|
||||
done
|
||||
sudo systemctl restart extraction.timer
|
||||
|
||||
@@ -30,7 +30,7 @@ fi
|
||||
|
||||
if ! [ -z ${birdnetpi_url} ];then
|
||||
sed -i s/'^BIRDNETPI_URL=.*'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
sed -i s/'^EXTRACTIONLOG_URL=.*'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
sed -i s/'^WEBTERMINAL_URL=.*'/"WEBTERMINAL_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
sed -i s/'^BIRDNETLOG_URL=.*'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birdnet_conf}
|
||||
fi
|
||||
|
||||
|
||||
Executable
+431
@@ -0,0 +1,431 @@
|
||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
||||
import socket
|
||||
import threading
|
||||
import os
|
||||
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
||||
os.environ['CUDA_VISIBLE_DEVICES'] = ''
|
||||
|
||||
try:
|
||||
import tflite_runtime.interpreter as tflite
|
||||
except:
|
||||
from tensorflow import lite as tflite
|
||||
|
||||
import argparse
|
||||
import operator
|
||||
import librosa
|
||||
import numpy as np
|
||||
import math
|
||||
import time
|
||||
from decimal import Decimal
|
||||
import json
|
||||
###############################################################################
|
||||
import requests
|
||||
import mysql.connector
|
||||
###############################################################################
|
||||
import datetime
|
||||
import pytz
|
||||
from tzlocal import get_localzone
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
HEADER = 64
|
||||
PORT = 5050
|
||||
SERVER = socket.gethostbyname(socket.gethostname())
|
||||
ADDR = (SERVER, PORT)
|
||||
FORMAT = 'utf-8'
|
||||
DISCONNECT_MESSAGE = "!DISCONNECT"
|
||||
|
||||
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
server.bind(ADDR)
|
||||
|
||||
|
||||
# Open most recent Configuration and grab DB_PWD as a python variable
|
||||
with open('/home/pi/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||
this_run = f.readlines()
|
||||
db_pwd = str(str(str([i for i in this_run if i.startswith('DB_PWD')]).split('=')[1]).split('\\')[0])
|
||||
|
||||
|
||||
def loadModel():
|
||||
|
||||
global INPUT_LAYER_INDEX
|
||||
global OUTPUT_LAYER_INDEX
|
||||
global MDATA_INPUT_INDEX
|
||||
global CLASSES
|
||||
|
||||
print('LOADING TF LITE MODEL...', end=' ')
|
||||
|
||||
# Load TFLite model and allocate tensors.
|
||||
myinterpreter = tflite.Interpreter(model_path='/home/pi/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||
myinterpreter.allocate_tensors()
|
||||
|
||||
# Get input and output tensors.
|
||||
input_details = myinterpreter.get_input_details()
|
||||
output_details = myinterpreter.get_output_details()
|
||||
|
||||
# Get input tensor index
|
||||
INPUT_LAYER_INDEX = input_details[0]['index']
|
||||
MDATA_INPUT_INDEX = input_details[1]['index']
|
||||
OUTPUT_LAYER_INDEX = output_details[0]['index']
|
||||
|
||||
# Load labels
|
||||
CLASSES = []
|
||||
with open('/home/pi/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
||||
for line in lfile.readlines():
|
||||
CLASSES.append(line.replace('\n', ''))
|
||||
|
||||
print('DONE!')
|
||||
|
||||
return myinterpreter
|
||||
|
||||
def loadCustomSpeciesList(path):
|
||||
|
||||
slist = []
|
||||
if os.path.isfile(path):
|
||||
with open(path, 'r') as csfile:
|
||||
for line in csfile.readlines():
|
||||
slist.append(line.replace('\r', '').replace('\n', ''))
|
||||
|
||||
return slist
|
||||
|
||||
def splitSignal(sig, rate, overlap, seconds=3.0, minlen=1.5):
|
||||
|
||||
# Split signal with overlap
|
||||
sig_splits = []
|
||||
for i in range(0, len(sig), int((seconds - overlap) * rate)):
|
||||
split = sig[i:i + int(seconds * rate)]
|
||||
|
||||
# End of signal?
|
||||
if len(split) < int(minlen * rate):
|
||||
break
|
||||
|
||||
# Signal chunk too short? Fill with zeros.
|
||||
if len(split) < int(rate * seconds):
|
||||
temp = np.zeros((int(rate * seconds)))
|
||||
temp[:len(split)] = split
|
||||
split = temp
|
||||
|
||||
sig_splits.append(split)
|
||||
|
||||
return sig_splits
|
||||
|
||||
def readAudioData(path, overlap, sample_rate=48000):
|
||||
|
||||
print('READING AUDIO DATA...', end=' ', flush=True)
|
||||
|
||||
# Open file with librosa (uses ffmpeg or libav)
|
||||
sig, rate = librosa.load(path, sr=sample_rate, mono=True, res_type='kaiser_fast')
|
||||
|
||||
# Split audio into 3-second chunks
|
||||
chunks = splitSignal(sig, rate, overlap)
|
||||
|
||||
print('DONE! READ', str(len(chunks)), 'CHUNKS.')
|
||||
|
||||
return chunks
|
||||
|
||||
def convertMetadata(m):
|
||||
|
||||
# Convert week to cosine
|
||||
if m[2] >= 1 and m[2] <= 48:
|
||||
m[2] = math.cos(math.radians(m[2] * 7.5)) + 1
|
||||
else:
|
||||
m[2] = -1
|
||||
|
||||
# Add binary mask
|
||||
mask = np.ones((3,))
|
||||
if m[0] == -1 or m[1] == -1:
|
||||
mask = np.zeros((3,))
|
||||
if m[2] == -1:
|
||||
mask[2] = 0.0
|
||||
|
||||
return np.concatenate([m, mask])
|
||||
|
||||
def custom_sigmoid(x, sensitivity=1.0):
|
||||
return 1 / (1.0 + np.exp(-sensitivity * x))
|
||||
|
||||
def predict(sample, sensitivity):
|
||||
global INTERPRETER
|
||||
# Make a prediction
|
||||
INTERPRETER.set_tensor(INPUT_LAYER_INDEX, np.array(sample[0], dtype='float32'))
|
||||
INTERPRETER.set_tensor(MDATA_INPUT_INDEX, np.array(sample[1], dtype='float32'))
|
||||
INTERPRETER.invoke()
|
||||
prediction = INTERPRETER.get_tensor(OUTPUT_LAYER_INDEX)[0]
|
||||
|
||||
# Apply custom sigmoid
|
||||
p_sigmoid = custom_sigmoid(prediction, sensitivity)
|
||||
|
||||
# Get label and scores for pooled predictions
|
||||
p_labels = dict(zip(CLASSES, p_sigmoid))
|
||||
|
||||
# Sort by score
|
||||
p_sorted = sorted(p_labels.items(), key=operator.itemgetter(1), reverse=True)
|
||||
|
||||
# Remove species that are on blacklist
|
||||
for i in range(min(10, len(p_sorted))):
|
||||
if p_sorted[i][0] in ['Human_Human', 'Non-bird_Non-bird', 'Noise_Noise']:
|
||||
p_sorted[i] = (p_sorted[i][0], 0.0)
|
||||
|
||||
# Only return first the top ten results
|
||||
return p_sorted[:10]
|
||||
|
||||
def analyzeAudioData(chunks, lat, lon, week, sensitivity, overlap,):
|
||||
global INTERPRETER
|
||||
|
||||
detections = {}
|
||||
start = time.time()
|
||||
print('ANALYZING AUDIO...', end=' ', flush=True)
|
||||
|
||||
# Convert and prepare metadata
|
||||
mdata = convertMetadata(np.array([lat, lon, week]))
|
||||
mdata = np.expand_dims(mdata, 0)
|
||||
|
||||
# Parse every chunk
|
||||
pred_start = 0.0
|
||||
for c in chunks:
|
||||
|
||||
# Prepare as input signal
|
||||
sig = np.expand_dims(c, 0)
|
||||
|
||||
# Make prediction
|
||||
p = predict([sig, mdata], sensitivity)
|
||||
|
||||
# Save result and timestamp
|
||||
pred_end = pred_start + 3.0
|
||||
detections[str(pred_start) + ';' + str(pred_end)] = p
|
||||
pred_start = pred_end - overlap
|
||||
|
||||
print('DONE! Time', int((time.time() - start) * 10) / 10.0, 'SECONDS')
|
||||
|
||||
return detections
|
||||
|
||||
def writeResultsToFile(detections, min_conf, path):
|
||||
|
||||
print('WRITING RESULTS TO', path, '...', end=' ')
|
||||
rcnt = 0
|
||||
with open(path, 'w') as rfile:
|
||||
rfile.write('Start (s);End (s);Scientific name;Common name;Confidence\n')
|
||||
for d in detections:
|
||||
for entry in detections[d]:
|
||||
if entry[1] >= min_conf and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0) and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0) ):
|
||||
rfile.write(d + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) + '\n')
|
||||
rcnt += 1
|
||||
print('DONE! WROTE', rcnt, 'RESULTS.')
|
||||
return
|
||||
|
||||
def handle_client(conn, addr):
|
||||
global INCLUDE_LIST
|
||||
global EXCLUDE_LIST
|
||||
print(f"[NEW CONNECTION] {addr} connected.")
|
||||
|
||||
connected = True
|
||||
while connected:
|
||||
msg_length = conn.recv(HEADER).decode(FORMAT)
|
||||
if msg_length:
|
||||
msg_length = int(msg_length)
|
||||
msg = conn.recv(msg_length).decode(FORMAT)
|
||||
if msg == DISCONNECT_MESSAGE:
|
||||
connected = False
|
||||
else:
|
||||
#print(f"[{addr}] {msg}")
|
||||
|
||||
args = type('', (), {})()
|
||||
|
||||
args.i = '/home/pi/test.wav'
|
||||
args.o = '/home/pi/test.wav.csv'
|
||||
args.birdweather_id = '99999'
|
||||
args.include_list = 'null'
|
||||
args.exclude_list = 'null'
|
||||
args.overlap = 0.0
|
||||
args.week = -1
|
||||
args.sensitivity = 1.25
|
||||
args.min_conf = 0.70
|
||||
args.lat = -1
|
||||
args.lon = -1
|
||||
|
||||
|
||||
for line in msg.split('||'):
|
||||
inputvars = line.split('=')
|
||||
if inputvars[0] == 'i':
|
||||
args.i = inputvars[1]
|
||||
elif inputvars[0] == 'o':
|
||||
args.o = inputvars[1]
|
||||
elif inputvars[0] == 'birdweather_id':
|
||||
args.birdweather_id = inputvars[1]
|
||||
elif inputvars[0] == 'include_list':
|
||||
args.include_list = inputvars[1]
|
||||
elif inputvars[0] == 'exclude_list':
|
||||
args.exclude_list = inputvars[1]
|
||||
elif inputvars[0] == 'overlap':
|
||||
args.overlap = float(inputvars[1])
|
||||
elif inputvars[0] == 'week':
|
||||
args.week = int(inputvars[1])
|
||||
elif inputvars[0] == 'sensitivity':
|
||||
args.sensitivity = float(inputvars[1])
|
||||
elif inputvars[0] == 'min_conf':
|
||||
args.min_conf = float(inputvars[1])
|
||||
elif inputvars[0] == 'lat':
|
||||
args.lat = float(inputvars[1])
|
||||
elif inputvars[0] == 'lon':
|
||||
args.lon = float(inputvars[1])
|
||||
|
||||
|
||||
|
||||
# Load custom species lists - INCLUDED and EXCLUDED
|
||||
if not args.include_list == 'null':
|
||||
INCLUDE_LIST = loadCustomSpeciesList(args.include_list)
|
||||
else:
|
||||
INCLUDE_LIST = []
|
||||
|
||||
if not args.exclude_list == 'null':
|
||||
EXCLUDE_LIST = loadCustomSpeciesList(args.exclude_list)
|
||||
else:
|
||||
EXCLUDE_LIST = []
|
||||
|
||||
birdweather_id = args.birdweather_id
|
||||
|
||||
# Read audio data
|
||||
audioData = readAudioData(args.i, args.overlap)
|
||||
|
||||
# Get Date/Time from filename in case Pi gets behind
|
||||
#now = datetime.now()
|
||||
full_file_name = args.i
|
||||
print('FULL FILENAME: -' + full_file_name + '-')
|
||||
file_name = Path(full_file_name).stem
|
||||
file_date = file_name.split('-birdnet-')[0]
|
||||
file_time = file_name.split('-birdnet-')[1]
|
||||
date_time_str = file_date + ' ' + file_time
|
||||
date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
|
||||
#print('Date:', date_time_obj.date())
|
||||
#print('Time:', date_time_obj.time())
|
||||
print('Date-time:', date_time_obj)
|
||||
now = date_time_obj
|
||||
current_date = now.strftime("%Y/%m/%d")
|
||||
current_time = now.strftime("%H:%M:%S")
|
||||
current_iso8601 = now.astimezone(get_localzone()).isoformat()
|
||||
|
||||
week_number = int(now.strftime("%V"))
|
||||
week = max(1, min(week_number, 48))
|
||||
|
||||
sensitivity = max(0.5, min(1.0 - (args.sensitivity - 1.0), 1.5))
|
||||
|
||||
# Process audio data and get detections
|
||||
detections = analyzeAudioData(audioData, args.lat, args.lon, week, sensitivity, args.overlap)
|
||||
|
||||
# Write detections to output file
|
||||
min_conf = max(0.01, min(args.min_conf, 0.99))
|
||||
writeResultsToFile(detections, min_conf, args.o)
|
||||
|
||||
###############################################################################
|
||||
###############################################################################
|
||||
|
||||
soundscape_uploaded = False
|
||||
|
||||
# Write detections to Database
|
||||
myReturn = ''
|
||||
for i in detections:
|
||||
print("\n", detections[i][0],"\n")
|
||||
myReturn += str(detections[i][0]) + '||'
|
||||
|
||||
|
||||
|
||||
|
||||
with open('/home/pi/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
||||
for d in detections:
|
||||
for entry in detections[d]:
|
||||
if entry[1] >= min_conf and ((entry[0] in INCLUDE_LIST or len(INCLUDE_LIST) == 0) and (entry[0] not in EXCLUDE_LIST or len(EXCLUDE_LIST) == 0) ):
|
||||
rfile.write(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' \
|
||||
+ str(entry[1]) +";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' \
|
||||
+ str(sensitivity) +';' + str(args.overlap) + '\n')
|
||||
|
||||
def insert_variables_into_table(Date, Time, Sci_Name, Com_Name, Confidence, Lat, Lon, Cutoff, Week, Sens, Overlap):
|
||||
try:
|
||||
connection = mysql.connector.connect(host='localhost',
|
||||
database='birds',
|
||||
user='birder',
|
||||
password=db_pwd)
|
||||
cursor = connection.cursor()
|
||||
mySql_insert_query = """INSERT INTO detections (Date, Time, Sci_Name, Com_Name, Confidence, Lat, Lon, Cutoff, Week, Sens, Overlap)
|
||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) """
|
||||
|
||||
record = (Date, Time, Sci_Name, Com_Name, Confidence, Lat, Lon, Cutoff, Week, Sens, Overlap)
|
||||
|
||||
cursor.execute(mySql_insert_query, record)
|
||||
connection.commit()
|
||||
print("Record inserted successfully into detections table")
|
||||
|
||||
|
||||
except mysql.connector.Error as error:
|
||||
print("Failed to insert record into detections table {}".format(error))
|
||||
|
||||
finally:
|
||||
if connection.is_connected():
|
||||
connection.close()
|
||||
print("MySQL connection is closed")
|
||||
|
||||
species = entry[0]
|
||||
sci_name,com_name = species.split('_')
|
||||
insert_variables_into_table(str(current_date), str(current_time), sci_name, com_name, \
|
||||
str(entry[1]), str(args.lat), str(args.lon), str(min_conf), str(week), \
|
||||
str(args.sensitivity), str(args.overlap))
|
||||
|
||||
print(str(current_date) + ';' + str(current_time) + ';' + entry[0].replace('_', ';') + ';' + str(entry[1]) +";" + str(args.lat) + ';' + str(args.lon) + ';' + str(min_conf) + ';' + str(week) + ';' + str(args.sensitivity) +';' + str(args.overlap) + '\n')
|
||||
|
||||
if birdweather_id != "99999":
|
||||
|
||||
if soundscape_uploaded is False:
|
||||
# POST soundscape to server
|
||||
soundscape_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/soundscapes" + "?timestamp=" + current_iso8601
|
||||
|
||||
with open(args.i, 'rb') as f:
|
||||
wav_data = f.read()
|
||||
response = requests.post(url=soundscape_url, data=wav_data, headers={'Content-Type': 'application/octet-stream'})
|
||||
print("Soundscape POST Response Status - ", response.status_code)
|
||||
sdata = response.json()
|
||||
soundscape_id = sdata['soundscape']['id']
|
||||
soundscape_uploaded = True
|
||||
|
||||
# POST detection to server
|
||||
detection_url = "https://app.birdweather.com/api/v1/stations/" + birdweather_id + "/detections"
|
||||
start_time = d.split(';')[0]
|
||||
end_time = d.split(';')[1]
|
||||
post_begin = "{ "
|
||||
now_p_start = now + datetime.timedelta(seconds=float(start_time))
|
||||
current_iso8601 = now_p_start.astimezone(get_localzone()).isoformat()
|
||||
post_timestamp = "\"timestamp\": \"" + current_iso8601 + "\","
|
||||
post_lat = "\"lat\": " + str(args.lat) + ","
|
||||
post_lon = "\"lon\": " + str(args.lon) + ","
|
||||
post_soundscape_id = "\"soundscapeId\": " + str(soundscape_id) + ","
|
||||
post_soundscape_start_time = "\"soundscapeStartTime\": " + start_time + ","
|
||||
post_soundscape_end_time = "\"soundscapeEndTime\": " + end_time + ","
|
||||
post_commonName = "\"commonName\": \"" + entry[0].split('_')[1] + "\","
|
||||
post_scientificName = "\"scientificName\": \"" + entry[0].split('_')[0] + "\","
|
||||
post_algorithm = "\"algorithm\": " + "\"alpha\"" + ","
|
||||
post_confidence = "\"confidence\": " + str(entry[1])
|
||||
post_end = " }"
|
||||
|
||||
post_json = post_begin + post_timestamp + post_lat + post_lon + post_soundscape_id + post_soundscape_start_time + post_soundscape_end_time + post_commonName + post_scientificName + post_algorithm + post_confidence + post_end
|
||||
print(post_json)
|
||||
response = requests.post(detection_url, json=json.loads(post_json))
|
||||
print("Detection POST Response Status - ", response.status_code)
|
||||
|
||||
|
||||
conn.send("Msg received".encode(FORMAT))
|
||||
|
||||
#time.sleep(3)
|
||||
|
||||
conn.close()
|
||||
|
||||
def start():
|
||||
# Load model
|
||||
global INTERPRETER, INCLUDE_LIST, EXCLUDE_LIST
|
||||
INTERPRETER = loadModel()
|
||||
server.listen()
|
||||
print(f"[LISTENING] Server is listening on {SERVER}")
|
||||
while True:
|
||||
conn, addr = server.accept()
|
||||
thread = threading.Thread(target=handle_client, args=(conn, addr))
|
||||
thread.start()
|
||||
print(f"[ACTIVE CONNECTIONS] {threading.activeCount() - 1}")
|
||||
|
||||
|
||||
print("[STARTING] server is starting...")
|
||||
start()
|
||||
@@ -0,0 +1,82 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||
box-sizing: border-box;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Create two unequal columns that floats next to each other */
|
||||
.column {
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.first {
|
||||
width: calc(50% - 70px);
|
||||
}
|
||||
|
||||
.second {
|
||||
width: calc(50% - 30px);
|
||||
}
|
||||
|
||||
/* Clear floats after the columns */
|
||||
.row:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
body {
|
||||
background-color: rgb(119, 196, 135);
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
width:100%;
|
||||
border: none;
|
||||
background-color: #04AA6D;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
<form action="/scripts/stop_core_services.php" onclick="return confirm('Stop core services?')">
|
||||
<button type="submit" class="block">Stop Core Services</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_services.php" onclick="return confirm('Restart ALL services?')">
|
||||
<button type="submit" class="block">Restart ALL Services</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_birdnet_analysis.php">
|
||||
<button type="submit" class="block">Restart BirdNET Analysis</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_birdnet_recording.php">
|
||||
<button type="submit" class="block">Restart Recording</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_extraction.php">
|
||||
<button type="submit" class="block">Restart Extraction</button>
|
||||
</form>
|
||||
<form action="/scripts/restart_caddy.php" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')">
|
||||
<button type="submit" class="block">Restart Caddy</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@@ -1,5 +1,11 @@
|
||||
<?php
|
||||
header("refresh: 15;");
|
||||
echo "<body style='background-color:rgb(119, 196, 135)'>";
|
||||
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');
|
||||
}
|
||||
$refreshtime = $config['RECORDING_LENGTH'];
|
||||
header("refresh:$refreshtime");
|
||||
?>
|
||||
<body style='background-color:rgb(119, 196, 135)'>
|
||||
<img src='/spectrogram.png?nocache=<?php echo time();?>' style='display: block; height: 100%; width: 100%;'>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
services=(birdnet_recording.service
|
||||
birdnet_analysis.service
|
||||
birdnet_server.service
|
||||
chart_viewer.service
|
||||
extraction.timer
|
||||
spectrogram_viewer.service)
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
* {
|
||||
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
|
||||
' Calibri', 'Trebuchet MS', 'sans-serif';
|
||||
box-sizing: border-box;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Create two unequal columns that floats next to each other */
|
||||
.column {
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.first {
|
||||
width: calc(50% - 70px);
|
||||
}
|
||||
|
||||
.second {
|
||||
width: calc(50% - 30px);
|
||||
}
|
||||
|
||||
/* Clear floats after the columns */
|
||||
.row:after {
|
||||
content: "";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
body {
|
||||
background-color: rgb(119, 196, 135);
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.block {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
width:100%;
|
||||
border: none;
|
||||
background-color: #04AA6D;
|
||||
padding: 20px 20px;
|
||||
color: white;
|
||||
font-size: medium;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
@media screen and (max-width: 800px) {
|
||||
.column {
|
||||
float: none;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
<form action="/scripts/reboot_system.php" onclick="return confirm('Are you sure you want to reboot?')">
|
||||
<button type="submit" class="block">Reboot</button>
|
||||
</form>
|
||||
<form action="/scripts/update_birdnet.php" onclick="return confirm('BE SURE TO STASH ANY LOCAL CHANGES YOU HAVE MADE TO THE SYSTEM BEFORE UPDATING!!!')">
|
||||
<button style="color:blue;" type="submit" class="block">Update</button>
|
||||
</form>
|
||||
<form action="/scripts/shutdown_system.php" onclick="return confirm('Are you sure you want to shutdown?')">
|
||||
<button style="color: red;" type="submit" class="block">Shutdown</button>
|
||||
</form>
|
||||
<form action="/scripts/clear_all_data.php" onclick="return confirm('Clear ALL Data? This cannot be undone.')">
|
||||
<button style="color: red;" type="submit" class="block">Clear ALL data</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
@@ -26,9 +26,7 @@ remove_services() {
|
||||
}
|
||||
|
||||
remove_crons() {
|
||||
TMPFILE=$(mktemp)
|
||||
crontab -l | sed -e '/birdnet/,+1d' > "${TMPFILE}"
|
||||
crontab "${TMPFILE}"
|
||||
sudo sed -i '/birdnet/,+1d' /etc/crontab
|
||||
}
|
||||
|
||||
remove_icecast() {
|
||||
|
||||
@@ -28,8 +28,7 @@ remove_services() {
|
||||
}
|
||||
|
||||
remove_crons() {
|
||||
crontab -u${USER} -l | sed -e '/birdnet/,+1d' > "${tmpfile}"
|
||||
crontab -u${USER} "${tmpfile}"
|
||||
sudo sed -i '/birdnet/,+1d' /etc/crontab
|
||||
}
|
||||
|
||||
remove_icecast() {
|
||||
@@ -51,6 +50,8 @@ remove_scripts() {
|
||||
remove_services
|
||||
remove_scripts
|
||||
|
||||
# Backup labels.txt
|
||||
sudo -u${USER} cp -f ~/BirdNET-Pi/model/labels.txt{,.bak}
|
||||
# Stage 2 does a git pull to fetch new things
|
||||
sudo -u${USER} git -C ${HOME}/BirdNET-Pi checkout -f
|
||||
sudo -u${USER} git -C ${HOME}/BirdNET-Pi pull -f
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Second stage of update
|
||||
USER=pi
|
||||
birdnet_conf=/home/pi/BirdNET-Pi/birdnet.conf
|
||||
my_dir=${HOME}/BirdNET-Pi/scripts
|
||||
|
||||
@@ -7,20 +8,38 @@ my_dir=${HOME}/BirdNET-Pi/scripts
|
||||
sudo ${my_dir}/update_services.sh
|
||||
|
||||
# Stage 1.5: adding new birdnet.conf entries
|
||||
if ! grep FULL_DISK ${birdnet_conf};then
|
||||
if ! grep FULL_DISK ${birdnet_conf} &> /dev/null;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
|
||||
|
||||
sudo -u${USER} sed -i 's/EXTRACTIONLOG_URL/WEBTERMINAL_URL/g' ${birdnetconf}
|
||||
|
||||
# Replace Backup labels.txt
|
||||
sudo -u${USER} cp -f ~/BirdNET-Pi/model/labels.txt.bak ~/BirdNET-Pi/model/labels.txt
|
||||
|
||||
# Stage 2 restarts the services
|
||||
newservices=$(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort)
|
||||
for i in ${newservices[@]};do
|
||||
sudo systemctl restart ${i}
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl stop birdnet_recording.service
|
||||
sudo rm -rf ${RECS_DIR}/$(date +%B-%Y/%d-%A)/*
|
||||
services=(web_terminal.service
|
||||
spectrogram_viewer.service
|
||||
pushed_notifications.service
|
||||
livestream.service
|
||||
icecast2.service
|
||||
extraction.timer
|
||||
extraction.service
|
||||
chart_viewer.service
|
||||
birdnet_recording.service
|
||||
birdnet_log.service)
|
||||
|
||||
for i in "${services[@]}";do
|
||||
sudo systemctl restart "${i}"
|
||||
done
|
||||
sudo systemctl restart extraction.timer
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ source /etc/birdnet/birdnet.conf
|
||||
sudo mysql -e "
|
||||
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||
FLUSH PRIVILEGES";
|
||||
git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
||||
git -C /home/pi/BirdNET-Pi checkout -f scripts/analyze.py
|
||||
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/analyze.py
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
||||
|
||||
@@ -5,9 +5,9 @@ source /etc/birdnet/birdnet.conf
|
||||
mysql -e "
|
||||
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||
FLUSH PRIVILEGES";
|
||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/server.py
|
||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||
sudo -u ${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
||||
sudo -u ${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/server.py
|
||||
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Update database password
|
||||
source /etc/birdnet/birdnet.conf
|
||||
|
||||
sudo mysql -e "
|
||||
UPDATE mysql.user
|
||||
SET Password=PASSWORD('${DB_PWD}')
|
||||
WHERE USER='birder'
|
||||
AND Host='localhost';
|
||||
FLUSH PRIVILEGES";
|
||||
git -C /home/pi/BirdNET-Pi checkout -f analyze.py
|
||||
git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/analyze.py
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewdb.php
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/overview.php
|
||||
sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/viewday.php
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$timer=60;
|
||||
header( "refresh:$timer;url=/viewdb.php" );
|
||||
header( "refresh:$timer;url=/overview.php" );
|
||||
?>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
|
||||
+81
-56
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# This reinstalls the services
|
||||
#set -x # Uncomment to enable debugging
|
||||
set -x # Uncomment to enable debugging
|
||||
trap 'rm -f ${tmpfile}' EXIT
|
||||
trap 'exit 1' SIGINT SIGHUP
|
||||
USER=pi
|
||||
@@ -11,18 +11,12 @@ nomachine_url="https://download.nomachine.com/download/7.7/Arm/nomachine_7.7.4_1
|
||||
gotty_url="https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_arm.tar.gz"
|
||||
config_file="$(dirname ${my_dir})/birdnet.conf"
|
||||
|
||||
set_hostname() {
|
||||
if [ "$(hostname)" != "birdnetpi" ];then
|
||||
echo "Setting hostname to 'birdnetpi'"
|
||||
hostnamectl set-hostname birdnetpi
|
||||
sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts
|
||||
install_ftpd() {
|
||||
if ! [ -f /etc/ftpuseres ];then
|
||||
apt -y install ftpd
|
||||
fi
|
||||
}
|
||||
|
||||
update_system() {
|
||||
apt update && apt -y upgrade
|
||||
}
|
||||
|
||||
install_scripts() {
|
||||
echo "Installing BirdNET-Pi scripts to /usr/local/bin"
|
||||
ln -sf ${my_dir}/* /usr/local/bin/
|
||||
@@ -49,9 +43,10 @@ install_birdnet_analysis() {
|
||||
cat << EOF > /etc/systemd/system/birdnet_analysis.service
|
||||
[Unit]
|
||||
Description=BirdNET Analysis
|
||||
After=birdnet_server.service
|
||||
Requires=birdnet_server.service
|
||||
[Service]
|
||||
Restart=always
|
||||
RuntimeMaxSec=10800
|
||||
Type=simple
|
||||
RestartSec=2
|
||||
User=${USER}
|
||||
@@ -62,6 +57,25 @@ EOF
|
||||
systemctl enable birdnet_analysis.service
|
||||
}
|
||||
|
||||
install_birdnet_server() {
|
||||
echo "Installing the birdnet_server.service"
|
||||
cat << EOF > /etc/systemd/system/birdnet_server.service
|
||||
[Unit]
|
||||
Description=BirdNET Analysis Server
|
||||
Before=birdnet_analysis.service
|
||||
[Service]
|
||||
Restart=always
|
||||
Type=simple
|
||||
RestartSec=2
|
||||
User=${USER}
|
||||
ExecStart=/usr/local/bin/server.py
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable birdnet_server.service
|
||||
}
|
||||
|
||||
|
||||
install_extraction_service() {
|
||||
echo "Installing the extraction.service and extraction.timer"
|
||||
cat << EOF > /etc/systemd/system/extraction.service
|
||||
@@ -121,29 +135,36 @@ create_necessary_dirs() {
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED}
|
||||
if [ ! -z ${BIRDNETLOG_URL} ];then
|
||||
BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "birdnetpi.local:8080" ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/"${BIRDNETLOG_URL}"/g" ${i}
|
||||
done
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
if [ ! -z ${EXTRACTIONLOG_URL} ];then
|
||||
EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l "birdnetpi.local:8888" ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/"${EXTRACTIONLOG_URL}"/g" ${i}
|
||||
done
|
||||
if [ ! -z ${WEBTERMINAL_URL} ];then
|
||||
WEBTERMINAL_URL="$(echo ${WEBTERMINAL_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/model/labels.txt ${my_dir}/
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED}
|
||||
if [ ! -z ${BIRDNETPI_URL} ];then
|
||||
if [ -z ${BIRDNETPI_URL} ];then
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
else
|
||||
BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" $(dirname ${my_dir})/homepage/*.html
|
||||
phpfiles="$(grep -l birdnetpi.local ${my_dir}/*.php)"
|
||||
for i in "${phpfiles[@]}";do
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/"${BIRDNETPI_URL}"/g" ${i}
|
||||
done
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED}
|
||||
@@ -158,6 +179,8 @@ create_necessary_dirs() {
|
||||
|
||||
echo "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}""
|
||||
sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
|
||||
chmod -R g+rw $(dirname ${my_dir})
|
||||
chmod -R g+rw ${RECS_DIR}
|
||||
}
|
||||
|
||||
generate_BirdDB() {
|
||||
@@ -168,6 +191,8 @@ generate_BirdDB() {
|
||||
elif ! grep Date $(dirname ${my_dir})/BirdDB.txt;then
|
||||
sudo -u ${USER} sed -i '1 i\Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap' $(dirname ${my_dir})/BirdDB.txt
|
||||
fi
|
||||
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt &&
|
||||
chown pi:pi ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt
|
||||
}
|
||||
|
||||
install_alsa() {
|
||||
@@ -245,7 +270,7 @@ install_Caddyfile() {
|
||||
if ! [ -z ${CADDY_PWD} ];then
|
||||
HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD})
|
||||
cat << EOF > /etc/caddy/Caddyfile
|
||||
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
basicauth /Processed* {
|
||||
@@ -266,7 +291,7 @@ http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
EOF
|
||||
else
|
||||
cat << EOF > /etc/caddy/Caddyfile
|
||||
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
reverse_proxy /stream localhost:8000
|
||||
@@ -275,10 +300,18 @@ http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -z ${EXTRACTIONLOG_URL} ];then
|
||||
if [ ! -z ${WEBTERMINAL_URL} ] && [ ! -z ${HASHWORD} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
|
||||
${EXTRACTIONLOG_URL} {
|
||||
${WEBTERMINAL_URL} {
|
||||
basicauth {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
EOF
|
||||
elif [ ! -z ${WEBTERMINAL_URL} ] && [ -z ${HASHWORD} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
${WEBTERMINAL_URL} {
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
EOF
|
||||
@@ -295,10 +328,7 @@ EOF
|
||||
}
|
||||
|
||||
update_etc_hosts() {
|
||||
#BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
#EXTRACTIONLOG_URL="$(echo ${EXTRACTIONLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
#BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sed -ie s/'birdnetpi.local'/"birdnetpi.local ${BIRDNETPI_URL//https:\/\/} ${EXTRACTIONLOG_URL//https:\/\/} ${BIRDNETLOG_URL//https:\/\/}"/g /etc/hosts
|
||||
sed -ie s/'$(hostname).local'/"$(hostname).local ${BIRDNETPI_URL//https:\/\/} ${WEBTERMINAL_URL//https:\/\/} ${BIRDNETLOG_URL//https:\/\/}"/g /etc/hosts
|
||||
}
|
||||
|
||||
install_avahi_aliases() {
|
||||
@@ -323,7 +353,7 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' '
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable avahi-alias@birdnetpi.local.service
|
||||
systemctl enable avahi-alias@"$(hostname)".local.service
|
||||
}
|
||||
|
||||
install_spectrogram_service() {
|
||||
@@ -368,6 +398,8 @@ install_gotty_logs() {
|
||||
fi
|
||||
sudo -u ${USER} ln -sf $(dirname ${my_dir})/templates/gotty \
|
||||
${HOME}/.gotty
|
||||
sudo -u ${USER} ln -sf $(dirname ${my_dir})/templates/bashrc \
|
||||
${HOME}/.bashrc
|
||||
echo "Installing the birdnet_log.service"
|
||||
cat << EOF > /etc/systemd/system/birdnet_log.service
|
||||
[Unit]
|
||||
@@ -379,16 +411,16 @@ RestartSec=3
|
||||
Type=simple
|
||||
User=${USER}
|
||||
Environment=TERM=xterm-256color
|
||||
ExecStart=/usr/local/bin/gotty -p 8080 --title-format "BirdNET-Pi Log" journalctl -o cat -fu birdnet_analysis.service
|
||||
ExecStart=/usr/local/bin/gotty -p 8080 --title-format "BirdNET-Pi Log" journalctl -o cat -fu birdnet_server.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable birdnet_log.service
|
||||
echo "Installing the extraction_log.service"
|
||||
cat << EOF > /etc/systemd/system/extraction_log.service
|
||||
echo "Installing the Web Terminal"
|
||||
cat << EOF > /etc/systemd/system/web_terminal.service
|
||||
[Unit]
|
||||
Description=BirdNET Extraction Log
|
||||
Description=BirdNET-Pi Web Terminal
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
@@ -396,12 +428,12 @@ RestartSec=3
|
||||
Type=simple
|
||||
User=${USER}
|
||||
Environment=TERM=xterm-256color
|
||||
ExecStart=/usr/local/bin/gotty -p 8888 --title-format "Extractions Log" journalctl -o cat -fu extraction.service
|
||||
ExecStart=/usr/local/bin/gotty -w -p 8888 --title-format "BirdNET-Pi Terminal" bash
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable extraction_log.service
|
||||
systemctl enable web_terminal.service
|
||||
}
|
||||
|
||||
install_sox() {
|
||||
@@ -419,7 +451,7 @@ install_php() {
|
||||
if ! which php &> /dev/null || ! which php-fpm || ! apt list --installed | grep php-xml;then
|
||||
echo "Installing PHP modules"
|
||||
apt -qq update
|
||||
apt install -qqy php php-fpm php-mysql php-xml
|
||||
apt install -qqy php php-fpm php-mysql php-xml php-zip
|
||||
else
|
||||
echo "PHP and PHP-FPM installed"
|
||||
fi
|
||||
@@ -500,20 +532,13 @@ install_nomachine() {
|
||||
|
||||
install_cleanup_cron() {
|
||||
echo "Installing the cleanup.cron"
|
||||
if ! crontab -u ${USER} -l &> /dev/null;then
|
||||
crontab -u ${USER} $(dirname ${my_dir})/templates/cleanup.cron &> /dev/null
|
||||
else
|
||||
crontab -u ${USER} -l > ${tmpfile}
|
||||
cat $(dirname ${my_dir})/templates/cleanup.cron >> ${tmpfile}
|
||||
crontab -u ${USER} "${tmpfile}" &> /dev/null
|
||||
fi
|
||||
cat $(dirname ${my_dir})/templates/cleanup.cron >> /etc/crontab
|
||||
}
|
||||
|
||||
install_selected_services() {
|
||||
set_hostname
|
||||
update_system
|
||||
install_scripts
|
||||
install_birdnet_analysis
|
||||
install_birdnet_server
|
||||
|
||||
if [[ "${DO_EXTRACTIONS}" =~ [Yy] ]];then
|
||||
install_extraction_service
|
||||
@@ -548,7 +573,7 @@ install_selected_services() {
|
||||
create_necessary_dirs
|
||||
generate_BirdDB
|
||||
install_cleanup_cron
|
||||
systemctl restart php${php_version}-fpm
|
||||
install_ftpd
|
||||
}
|
||||
|
||||
if [ -f ${config_file} ];then
|
||||
|
||||
+25
-33
@@ -1,4 +1,8 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
header("refresh: 30;");
|
||||
$mysqli = mysqli_connect();
|
||||
$mysqli->select_db('birds');
|
||||
@@ -10,36 +14,36 @@ if ($mysqli->connect_error) {
|
||||
}
|
||||
|
||||
// SQL query to select data from database
|
||||
$sql = "SELECT * FROM detections
|
||||
$sql = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
ORDER BY Date DESC, Time DESC";
|
||||
$fulltable = $mysqli->query($sql);
|
||||
$totalcount=mysqli_num_rows($fulltable);
|
||||
$totalcount = $mysqli->query($sql);
|
||||
|
||||
$sql1 = "SELECT * FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
ORDER BY Date DESC, Time DESC";
|
||||
$sql1 = "SELECT Date, Time, Sci_Name, Com_Name, MAX(Confidence)
|
||||
FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
GROUP BY Date, Time, Sci_Name, Com_Name
|
||||
ORDER BY Time DESC";
|
||||
$mosttable = $mysqli->query($sql1);
|
||||
|
||||
$sql2 = "SELECT * FROM detections
|
||||
$sql2 = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
WHERE Date = CURDATE()";
|
||||
$todaystable = $mysqli->query($sql2);
|
||||
$todayscount=mysqli_num_rows($todaystable);
|
||||
$todayscount = $mysqli->query($sql2);
|
||||
|
||||
$sql3 = "SELECT * FROM detections
|
||||
$sql3 = "SELECT COUNT(*) AS 'Total' FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
AND Time >= DATE_SUB(NOW(),INTERVAL 1 HOUR)";
|
||||
$lasthourtable = $mysqli->query($sql3);
|
||||
$lasthourcount=mysqli_num_rows($lasthourtable);
|
||||
$lasthourcount = $mysqli->query($sql3);
|
||||
|
||||
$sql4 = "SELECT Com_Name, Date, Time, MAX(Confidence)
|
||||
FROM detections
|
||||
GROUP BY Com_Name
|
||||
$sql4 = "SELECT Com_Name, Date, Time, MAX(Confidence)
|
||||
FROM detections
|
||||
WHERE Date = CURDATE()
|
||||
GROUP BY Com_Name
|
||||
ORDER BY MAX(Confidence) DESC";
|
||||
$specieslist = $mysqli->query($sql4);
|
||||
$speciescount=mysqli_num_rows($specieslist);
|
||||
$speciescount = mysqli_num_rows($specieslist);
|
||||
|
||||
$sql5 = "SELECT Com_Name,COUNT(*)
|
||||
AS Total
|
||||
AS 'Total'
|
||||
FROM detections
|
||||
GROUP BY Com_Name
|
||||
ORDER BY Total DESC";
|
||||
@@ -71,9 +75,9 @@ $mysqli->close();
|
||||
<th>Number of Unique Species</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $totalcount;?></td>
|
||||
<td><?php echo $todayscount;?></td>
|
||||
<td><?php echo $lasthourcount;?></td>
|
||||
<td><?php while ($row = $totalcount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php while ($row = $todayscount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php while ($row = $lasthourcount->fetch_assoc()) { echo $row['Total']; };?></td>
|
||||
<td><?php echo $speciescount;?></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -87,18 +91,12 @@ $mysqli->close();
|
||||
<th>Scientific Name</th>
|
||||
<th>Common Name</th>
|
||||
<th>Confidence</th>
|
||||
<th>Lat</th>
|
||||
<th>Lon</th>
|
||||
<th>Cutoff</th>
|
||||
<th>Week</th>
|
||||
<th>Sens</th>
|
||||
<th>Overlap</th>
|
||||
</tr>
|
||||
<!-- PHP CODE TO FETCH DATA FROM ROWS-->
|
||||
<?php // LOOP TILL END OF DATA
|
||||
while($rows=$mosttable ->fetch_assoc())
|
||||
{
|
||||
$Confidence = sprintf("%.1f%%", $rows['Confidence'] * 100);
|
||||
$Confidence = sprintf("%.1f%%", $rows['MAX(Confidence)'] * 100);
|
||||
?>
|
||||
<tr>
|
||||
<!--FETCHING DATA FROM EACH
|
||||
@@ -107,12 +105,6 @@ while($rows=$mosttable ->fetch_assoc())
|
||||
<td><?php echo $rows['Sci_Name'];?></td>
|
||||
<td><?php echo $rows['Com_Name'];?></td>
|
||||
<td><?php echo $Confidence;?></td>
|
||||
<td><?php echo $rows['Lat'];?></td>
|
||||
<td><?php echo $rows['Lon'];?></td>
|
||||
<td><?php echo $rows['Cutoff'];?></td>
|
||||
<td><?php echo $rows['Week'];?></td>
|
||||
<td><?php echo $rows['Sens'];?></td>
|
||||
<td><?php echo $rows['Overlap'];?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ $caddy_pwd = $_POST["caddy_pwd"];
|
||||
$db_pwd = $_POST["db_pwd"];
|
||||
$ice_pwd = $_POST["ice_pwd"];
|
||||
$birdnetpi_url = $_POST["birdnetpi_url"];
|
||||
$extractionlog_url = $_POST["extractionlog_url"];
|
||||
$webterminal_url = $_POST["webterminal_url"];
|
||||
$birdnetlog_url = $_POST["birdnetlog_url"];
|
||||
$overlap = $_POST["overlap"];
|
||||
$confidence = $_POST["confidence"];
|
||||
@@ -19,7 +19,7 @@ $contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
|
||||
$contents = preg_replace("/DB_PWD=.*/", "DB_PWD=$db_pwd", $contents);
|
||||
$contents = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents);
|
||||
$contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents);
|
||||
$contents = preg_replace("/EXTRACTIONLOG_URL=.*/", "EXTRACTIONLOG_URL=$extractionlog_url", $contents);
|
||||
$contents = preg_replace("/WEBTERMINAL_URL=.*/", "WEBTERMINAL_URL=$webterminal_url", $contents);
|
||||
$contents = preg_replace("/BIRDNETLOG_URL=.*/", "BIRDNETLOG_URL=$birdnetlog_url", $contents);
|
||||
$contents = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents);
|
||||
$contents = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents);
|
||||
@@ -35,7 +35,7 @@ $contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
|
||||
$contents2 = preg_replace("/DB_PWD=.*/", "DB_PWD=$db_pwd", $contents2);
|
||||
$contents2 = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents2);
|
||||
$contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2);
|
||||
$contents2 = preg_replace("/EXTRACTIONLOG_URL=.*/", "EXTRACTIONLOG_URL=$extractionlog_url", $contents2);
|
||||
$contents2 = preg_replace("/WEBTERMINAL_URL=.*/", "WEBTERMINAL_URL=$webterminal_url", $contents2);
|
||||
$contents2 = preg_replace("/BIRDNETLOG_URL=.*/", "BIRDNETLOG_URL=$birdnetlog_url", $contents2);
|
||||
$contents2 = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents2);
|
||||
$contents2 = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents2);
|
||||
|
||||
+17
-13
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
$latitude = $_POST["latitude"];
|
||||
$longitude = $_POST["longitude"];
|
||||
$birdweather_id = $_POST["birdweather_id"];
|
||||
@@ -23,24 +26,25 @@ $fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
@session_start();
|
||||
|
||||
if(true){
|
||||
$_SESSION['success'] = 1;
|
||||
header("Location:config.php");
|
||||
session_start();
|
||||
$_SESSION['success'] = 1;
|
||||
if(isset($_POST["normal"])){
|
||||
header('Location:config.php');
|
||||
}else{
|
||||
header('Location:../../');
|
||||
}
|
||||
|
||||
$language = $_POST["language"];
|
||||
if ($language != "none"){
|
||||
$command = "sudo -upi set -x; sudo -upi mv /home/pi/BirdNET-Pi/model/labels.txt /home/pi/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/pi/BirdNET-Pi/model/labels_l18n.zip $language -d /home/pi/BirdNET-Pi/model && sudo -upi mv /home/pi/BirdNET-Pi/model/$language /home/pi/BirdNET-Pi/model/labels.txt";
|
||||
$command = "sudo -upi mv /home/pi/BirdNET-Pi/model/labels.txt /home/pi/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/pi/BirdNET-Pi/model/labels_l18n.zip $language -d /home/pi/BirdNET-Pi/model && sudo -upi mv /home/pi/BirdNET-Pi/model/$language /home/pi/BirdNET-Pi/model/labels.txt";
|
||||
$command_output = `$command`;
|
||||
echo $command_output;
|
||||
@session_start();
|
||||
|
||||
if(true){
|
||||
$_SESSION['success'] = 1;
|
||||
header("Location:config.php");
|
||||
}
|
||||
session_start();
|
||||
$_SESSION['success'] = 1;
|
||||
if(isset($_POST["normal"])){
|
||||
header('Location:config.php');
|
||||
}else{
|
||||
header('Location:../../');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
@@ -9,5 +9,5 @@ sed -i s/'^ICE_PWD=$'/"ICE_PWD=${ice_pwd}"/g ${birders_conf}
|
||||
sed -i s/'^DB_PWD=$'/"DB_PWD=${db_pwd}"/g ${birders_conf}
|
||||
sed -i s/'^BIRDWEATHER_ID=$'/"BIRDWEATHER_ID=${birdweather_id}"/g ${birders_conf}
|
||||
sed -i s/'^BIRDNETPI_URL=$'/"BIRDNETPI_URL=${birdnetpi_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||
sed -i s/'^EXTRACTIONLOG_URL=$'/"EXTRACTIONLOG_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||
sed -i s/'^WEBTERMINAL_URL=$'/"WEBTERMINAL_URL=${extractionlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||
sed -i s/'^BIRDNETLOG_URL=$'/"BIRDNETLOG_URL=${birdnetlog_url/\/\//\\\/\\\/}"/g ${birders_conf}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
# ~/.bashrc: executed by bash(1) for non-login shells.
|
||||
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
|
||||
# for examples
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
*) return;;
|
||||
esac
|
||||
|
||||
# don't put duplicate lines or lines starting with space in the history.
|
||||
# See bash(1) for more options
|
||||
HISTCONTROL=ignoreboth
|
||||
|
||||
# append to the history file, don't overwrite it
|
||||
shopt -s histappend
|
||||
|
||||
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
|
||||
HISTSIZE=1000
|
||||
HISTFILESIZE=2000
|
||||
|
||||
# check the window size after each command and, if necessary,
|
||||
# update the values of LINES and COLUMNS.
|
||||
shopt -s checkwinsize
|
||||
|
||||
# If set, the pattern "**" used in a pathname expansion context will
|
||||
# match all files and zero or more directories and subdirectories.
|
||||
#shopt -s globstar
|
||||
|
||||
# make less more friendly for non-text input files, see lesspipe(1)
|
||||
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
||||
|
||||
# set variable identifying the chroot you work in (used in the prompt below)
|
||||
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
|
||||
debian_chroot=$(cat /etc/debian_chroot)
|
||||
fi
|
||||
|
||||
# set a fancy prompt (non-color, unless we know we "want" color)
|
||||
case "$TERM" in
|
||||
xterm-color|*-256color) color_prompt=yes;;
|
||||
esac
|
||||
|
||||
# uncomment for a colored prompt, if the terminal has the capability; turned
|
||||
# off by default to not distract the user: the focus in a terminal window
|
||||
# should be on the output of commands, not on the prompt
|
||||
#force_color_prompt=yes
|
||||
|
||||
if [ -n "$force_color_prompt" ]; then
|
||||
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
|
||||
# We have color support; assume it's compliant with Ecma-48
|
||||
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
|
||||
# a case would tend to support setf rather than setaf.)
|
||||
color_prompt=yes
|
||||
else
|
||||
color_prompt=
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$color_prompt" = yes ]; then
|
||||
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;37m\]\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\$ '
|
||||
else
|
||||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
|
||||
fi
|
||||
unset color_prompt force_color_prompt
|
||||
|
||||
# If this is an xterm set the title to user@host:dir
|
||||
case "$TERM" in
|
||||
xterm*|rxvt*)
|
||||
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# enable color support of ls and also add handy aliases
|
||||
if [ -x /usr/bin/dircolors ]; then
|
||||
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
||||
alias ls='ls --color=auto'
|
||||
#alias dir='dir --color=auto'
|
||||
#alias vdir='vdir --color=auto'
|
||||
|
||||
#alias grep='grep --color=auto'
|
||||
#alias fgrep='fgrep --color=auto'
|
||||
#alias egrep='egrep --color=auto'
|
||||
fi
|
||||
|
||||
# colored GCC warnings and errors
|
||||
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||
|
||||
# some more ls aliases
|
||||
#alias ll='ls -l'
|
||||
#alias la='ls -A'
|
||||
#alias l='ls -CF'
|
||||
|
||||
# Alias definitions.
|
||||
# You may want to put all your additions into a separate file like
|
||||
# ~/.bash_aliases, instead of adding them here directly.
|
||||
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
|
||||
|
||||
if [ -f ~/.bash_aliases ]; then
|
||||
. ~/.bash_aliases
|
||||
fi
|
||||
|
||||
# enable programmable completion features (you don't need to enable
|
||||
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
|
||||
# sources /etc/bash.bashrc).
|
||||
if ! shopt -oq posix; then
|
||||
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
||||
. /usr/share/bash-completion/bash_completion
|
||||
elif [ -f /etc/bash_completion ]; then
|
||||
. /etc/bash_completion
|
||||
fi
|
||||
fi
|
||||
cd ~/BirdNET-Pi
|
||||
@@ -1,6 +1,6 @@
|
||||
#birdnet
|
||||
*/5 * * * * /usr/local/bin/disk_check.sh &> /dev/null
|
||||
*/5 * * * * pi /usr/local/bin/disk_check.sh &> /dev/null
|
||||
#birdnet
|
||||
*/3 * * * * /usr/local/bin/cleanup.sh &> /dev/null
|
||||
*/3 * * * * pi /usr/local/bin/cleanup.sh &> /dev/null
|
||||
#birdnet
|
||||
@reboot /usr/local/bin/cleanup.sh &> /dev/null
|
||||
@reboot pi /usr/local/bin/cleanup.sh &> /dev/null
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
preferences {
|
||||
font_size = 16
|
||||
font_size = 18
|
||||
foreground_color = "rgb(0, 0, 0)"
|
||||
background_color = "rgb(119, 196, 135)"
|
||||
}
|
||||
|
||||
@@ -928,12 +928,12 @@ ACCESS="command"
|
||||
; - "systeminfo" systeminfo command is run everytime the block gets refreshed or build (WinNT)
|
||||
;
|
||||
|
||||
COMMAND="curl"
|
||||
COMMAND="network_info.sh"
|
||||
#COMMAND="cat"
|
||||
|
||||
; define COMMAND parameters (for command access)
|
||||
;
|
||||
PARAMS="-s4 ifconfig.co"
|
||||
PARAMS=""
|
||||
#PARAMS="/home/pi/BirdNET-Pi/thisrun.txt"
|
||||
|
||||
[pingtest]
|
||||
|
||||
Binary file not shown.
+15
@@ -1,3 +1,18 @@
|
||||
# main v.11.1
|
||||
- `server.py` socket
|
||||
- Removed DB password from scripts
|
||||
- FTP included
|
||||
- WebGUI tools:
|
||||
- Settings > Advanced Settings
|
||||
- Include/Exclude Species List Editor
|
||||
- Web Terminal
|
||||
- Removed Extraction Logging
|
||||
- Lowered minimum recording length
|
||||
- No longer requires CADDY_PWD
|
||||
- Auto-set random DB_PWD
|
||||
- New (but still changing) charts
|
||||
- Crontabs now in `/etc/crontab` instead of `pi` user
|
||||
|
||||
# main v.11
|
||||
- New "Reconfigure System" GUI
|
||||
- labels.txt language support for 20+ languages
|
||||
|
||||
Reference in New Issue
Block a user