making changes to accomodate removing the pi user
This commit is contained in:
@@ -69,7 +69,7 @@ PUSHED_APP_SECRET=
|
|||||||
## it needs to analyze. Be sure this directory is readable and writable for
|
## it needs to analyze. Be sure this directory is readable and writable for
|
||||||
## the BIRDNET_USER.
|
## the BIRDNET_USER.
|
||||||
|
|
||||||
RECS_DIR=/home/pi/BirdSongs
|
RECS_DIR=$HOME/BirdSongs
|
||||||
|
|
||||||
## REC_CARD is the sound card you would want the birdnet_recording.service to
|
## REC_CARD is the sound card you would want the birdnet_recording.service to
|
||||||
## use. Leave this as "default" to use PulseAudio (recommended), or use
|
## use. Leave this as "default" to use PulseAudio (recommended), or use
|
||||||
@@ -141,12 +141,7 @@ EXTRACTION_LENGTH=
|
|||||||
|
|
||||||
AUDIOFMT=mp3
|
AUDIOFMT=mp3
|
||||||
|
|
||||||
## BIRDNET_USER should be the non-root user systemd should use to execute each
|
|
||||||
## service.
|
|
||||||
|
|
||||||
BIRDNET_USER=pi
|
|
||||||
|
|
||||||
## These are just for debugging
|
## These are just for debugging
|
||||||
LAST_RUN=
|
LAST_RUN=
|
||||||
THIS_RUN=
|
THIS_RUN=
|
||||||
IDFILE=/home/pi/BirdNET-Pi/IdentifiedSoFar.txt
|
IDFILE=$HOME/BirdNET-Pi/IdentifiedSoFar.txt
|
||||||
|
|||||||
+5
-5
@@ -18,10 +18,10 @@ echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\
|
|||||||
<div class="stream">
|
<div class="stream">
|
||||||
<?php
|
<?php
|
||||||
if(isset($_GET['stream'])){
|
if(isset($_GET['stream'])){
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
@@ -55,7 +55,7 @@ if(isset($_GET['stream'])){
|
|||||||
</div>";
|
</div>";
|
||||||
}
|
}
|
||||||
if(isset($_GET['log'])) {
|
if(isset($_GET['log'])) {
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
header("Location: /log");}
|
header("Location: /log");}
|
||||||
} elseif(isset($_GET['spectrogram'])){
|
} elseif(isset($_GET['spectrogram'])){
|
||||||
header("Location: /spectrogram.php");
|
header("Location: /spectrogram.php");
|
||||||
|
|||||||
+20
-20
@@ -45,10 +45,10 @@ if(isset($_POST['view'])){
|
|||||||
if($_POST['view'] == "Streamlit"){header('location:/stats');}
|
if($_POST['view'] == "Streamlit"){header('location:/stats');}
|
||||||
if($_POST['view'] == "Daily Charts"){include('history.php');}
|
if($_POST['view'] == "Daily Charts"){include('history.php');}
|
||||||
if($_POST['view'] == "Tools"){
|
if($_POST['view'] == "Tools"){
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
@@ -87,25 +87,25 @@ if(isset($_POST['view'])){
|
|||||||
if($_POST['view'] == "Advanced"){include('scripts/advanced.php');}
|
if($_POST['view'] == "Advanced"){include('scripts/advanced.php');}
|
||||||
if($_POST['view'] == "Included"){
|
if($_POST['view'] == "Included"){
|
||||||
if(isset($_POST['species']) && isset($_POST['add'])){
|
if(isset($_POST['species']) && isset($_POST['add'])){
|
||||||
$file = '/home/pi/BirdNET-Pi/include_species_list.txt';
|
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||||
$str = file_get_contents("$file");
|
$str = file_get_contents("$file");
|
||||||
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
||||||
file_put_contents("$file", "$str");
|
file_put_contents("$file", "$str");
|
||||||
if(isset($_POST['species'])){
|
if(isset($_POST['species'])){
|
||||||
foreach ($_POST['species'] as $selectedOption)
|
foreach ($_POST['species'] as $selectedOption)
|
||||||
file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
file_put_contents("/home/*/BirdNET-Pi/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
} elseif(isset($_POST['species']) && isset($_POST['del'])){
|
} elseif(isset($_POST['species']) && isset($_POST['del'])){
|
||||||
$file = '/home/pi/BirdNET-Pi/include_species_list.txt';
|
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||||
$str = file_get_contents("$file");
|
$str = file_get_contents("$file");
|
||||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||||
file_put_contents("$file", "$str");
|
file_put_contents("$file", "$str");
|
||||||
foreach($_POST['species'] as $selectedOption) {
|
foreach($_POST['species'] as $selectedOption) {
|
||||||
$content = file_get_contents("/home/pi/BirdNET-Pi/include_species_list.txt");
|
$content = file_get_contents("/home/*/BirdNET-Pi/include_species_list.txt");
|
||||||
$newcontent = str_replace($selectedOption, "", "$content");
|
$newcontent = str_replace($selectedOption, "", "$content");
|
||||||
file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", "$newcontent");
|
file_put_contents("/home/*/BirdNET-Pi/include_species_list.txt", "$newcontent");
|
||||||
}
|
}
|
||||||
$file = '/home/pi/BirdNET-Pi/include_species_list.txt';
|
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||||
$str = file_get_contents("$file");
|
$str = file_get_contents("$file");
|
||||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||||
file_put_contents("$file", "$str");
|
file_put_contents("$file", "$str");
|
||||||
@@ -114,23 +114,23 @@ if(isset($_POST['view'])){
|
|||||||
}
|
}
|
||||||
if($_POST['view'] == "Excluded"){
|
if($_POST['view'] == "Excluded"){
|
||||||
if(isset($_POST['species']) && isset($_POST['add'])){
|
if(isset($_POST['species']) && isset($_POST['add'])){
|
||||||
$file = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||||
$str = file_get_contents("$file");
|
$str = file_get_contents("$file");
|
||||||
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
|
||||||
file_put_contents("$file", "$str");
|
file_put_contents("$file", "$str");
|
||||||
foreach ($_POST['species'] as $selectedOption)
|
foreach ($_POST['species'] as $selectedOption)
|
||||||
file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
file_put_contents("/home/*/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||||
} elseif (isset($_POST['species']) && isset($_POST['del'])){
|
} elseif (isset($_POST['species']) && isset($_POST['del'])){
|
||||||
$file = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||||
$str = file_get_contents("$file");
|
$str = file_get_contents("$file");
|
||||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||||
file_put_contents("$file", "$str");
|
file_put_contents("$file", "$str");
|
||||||
foreach($_POST['species'] as $selectedOption) {
|
foreach($_POST['species'] as $selectedOption) {
|
||||||
$content = file_get_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt");
|
$content = file_get_contents("/home/*/BirdNET-Pi/exclude_species_list.txt");
|
||||||
$newcontent = str_replace($selectedOption, "", "$content");
|
$newcontent = str_replace($selectedOption, "", "$content");
|
||||||
file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", "$newcontent");
|
file_put_contents("/home/*/BirdNET-Pi/exclude_species_list.txt", "$newcontent");
|
||||||
}
|
}
|
||||||
$file = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||||
$str = file_get_contents("$file");
|
$str = file_get_contents("$file");
|
||||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||||
file_put_contents("$file", "$str");
|
file_put_contents("$file", "$str");
|
||||||
@@ -141,10 +141,10 @@ if(isset($_POST['view'])){
|
|||||||
header('Location: scripts/filemanager/filemanager.php');
|
header('Location: scripts/filemanager/filemanager.php');
|
||||||
}
|
}
|
||||||
if($_POST['view'] == "Webterm"){
|
if($_POST['view'] == "Webterm"){
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Simple new installer
|
# Simple new installer
|
||||||
|
|
||||||
HOME=/home/pi
|
|
||||||
USER=pi
|
|
||||||
branch=main
|
branch=main
|
||||||
if ! which git &> /dev/null;then
|
if ! which git &> /dev/null;then
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
|||||||
+18
-18
@@ -3,10 +3,10 @@ ini_set('display_errors', 1);
|
|||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
|
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
@@ -27,16 +27,16 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['submit'])) {
|
if(isset($_POST['submit'])) {
|
||||||
$contents = file_get_contents("/home/pi/BirdNET-Pi/birdnet.conf");
|
$contents = file_get_contents("/home/*/BirdNET-Pi/birdnet.conf");
|
||||||
$contents2 = file_get_contents("/home/pi/BirdNET-Pi/thisrun.txt");
|
$contents2 = file_get_contents("/home/*/BirdNET-Pi/thisrun.txt");
|
||||||
|
|
||||||
if(isset($_POST["caddy_pwd"])) {
|
if(isset($_POST["caddy_pwd"])) {
|
||||||
$caddy_pwd = $_POST["caddy_pwd"];
|
$caddy_pwd = $_POST["caddy_pwd"];
|
||||||
if(strcmp($caddy_pwd,$config['CADDY_PWD']) !== 0) {
|
if(strcmp($caddy_pwd,$config['CADDY_PWD']) !== 0) {
|
||||||
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
|
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
|
||||||
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
|
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
|
||||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||||
fwrite($fh, $contents);
|
fwrite($fh, $contents);
|
||||||
fwrite($fh2, $contents2);
|
fwrite($fh2, $contents2);
|
||||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||||
@@ -56,8 +56,8 @@ if(isset($_POST['submit'])) {
|
|||||||
if(strcmp($birdnetpi_url,$config['BIRDNETPI_URL']) !== 0) {
|
if(strcmp($birdnetpi_url,$config['BIRDNETPI_URL']) !== 0) {
|
||||||
$contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents);
|
$contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents);
|
||||||
$contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2);
|
$contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2);
|
||||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||||
fwrite($fh, $contents);
|
fwrite($fh, $contents);
|
||||||
fwrite($fh2, $contents2);
|
fwrite($fh2, $contents2);
|
||||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||||
@@ -102,11 +102,11 @@ if(isset($_POST['submit'])) {
|
|||||||
$contents = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents);
|
$contents = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents);
|
||||||
$contents2 = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents2);
|
$contents2 = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents2);
|
||||||
if(strcmp($privacy_mode,"on") == 0) {
|
if(strcmp($privacy_mode,"on") == 0) {
|
||||||
exec('sudo sed -i \'s/server.py/privacy_server.py/g\' /home/pi/BirdNET-Pi/templates/birdnet_server.service');
|
exec('sudo sed -i \'s/server.py/privacy_server.py/g\' /home/*/BirdNET-Pi/templates/birdnet_server.service');
|
||||||
exec('sudo systemctl daemon-reload');
|
exec('sudo systemctl daemon-reload');
|
||||||
exec('restart_services.sh');
|
exec('restart_services.sh');
|
||||||
} elseif(strcmp($privacy_mode,"off") == 0) {
|
} elseif(strcmp($privacy_mode,"off") == 0) {
|
||||||
exec('sudo sed -i \'s/privacy_server.py/server.py/g\' /home/pi/BirdNET-Pi/templates/birdnet_server.service');
|
exec('sudo sed -i \'s/privacy_server.py/server.py/g\' /home/*/BirdNET-Pi/templates/birdnet_server.service');
|
||||||
exec('sudo systemctl daemon-reload');
|
exec('sudo systemctl daemon-reload');
|
||||||
exec('restart_services.sh');
|
exec('restart_services.sh');
|
||||||
}
|
}
|
||||||
@@ -153,8 +153,8 @@ if(isset($_POST['submit'])) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||||
fwrite($fh, $contents);
|
fwrite($fh, $contents);
|
||||||
fwrite($fh2, $contents2);
|
fwrite($fh2, $contents2);
|
||||||
}
|
}
|
||||||
@@ -167,10 +167,10 @@ if(isset($_POST['submit'])) {
|
|||||||
<iframe src="https://github.com/sponsors/mcguirepr89/button" title="Sponsor mcguirepr89" style="height:35px;width:116px;border:0;"></iframe>
|
<iframe src="https://github.com/sponsors/mcguirepr89/button" title="Sponsor mcguirepr89" style="height:35px;width:116px;border:0;"></iframe>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$newconfig = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$newconfig = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$newconfig = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$newconfig = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<h2>Advanced Settings</h2>
|
<h2>Advanced Settings</h2>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
|
||||||
import argparse
|
import argparse
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ source /etc/birdnet/birdnet.conf
|
|||||||
# Make a temporary file to compare the current birdnet.conf with
|
# Make a temporary file to compare the current birdnet.conf with
|
||||||
# the birdnet.conf as it was the last time this script was called
|
# the birdnet.conf as it was the last time this script was called
|
||||||
my_dir=$(realpath $(dirname $0))
|
my_dir=$(realpath $(dirname $0))
|
||||||
if [ -z ${THIS_RUN} ];then THIS_RUN=/home/pi/BirdNET-Pi/thisrun.txt;fi
|
if [ -z ${THIS_RUN} ];then THIS_RUN=/home/*/BirdNET-Pi/thisrun.txt;fi
|
||||||
[ -f ${THIS_RUN} ] || touch ${THIS_RUN} && chmod g+w ${THIS_RUN}
|
[ -f ${THIS_RUN} ] || touch ${THIS_RUN} && chmod g+w ${THIS_RUN}
|
||||||
if [ -z ${LAST_RUN} ];then LAST_RUN=/home/pi/BirdNET-Pi/lastrun.txt;fi
|
if [ -z ${LAST_RUN} ];then LAST_RUN=/home/*/BirdNET-Pi/lastrun.txt;fi
|
||||||
[ -z ${LATITUDE} ] && echo "LATITUDE not set, exiting 1" && exit 1
|
[ -z ${LATITUDE} ] && echo "LATITUDE not set, exiting 1" && exit 1
|
||||||
[ -z ${LONGITUDE} ] && echo "LONGITUDE not set, exiting 1" && exit 1
|
[ -z ${LONGITUDE} ] && echo "LONGITUDE not set, exiting 1" && exit 1
|
||||||
make_thisrun() {
|
make_thisrun() {
|
||||||
@@ -27,8 +27,8 @@ if ! diff ${LAST_RUN} ${THIS_RUN};then
|
|||||||
sudo systemctl start birdnet_recording.service
|
sudo systemctl start birdnet_recording.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INCLUDE_LIST="/home/pi/BirdNET-Pi/include_species_list.txt"
|
INCLUDE_LIST="/home/*/BirdNET-Pi/include_species_list.txt"
|
||||||
EXCLUDE_LIST="/home/pi/BirdNET-Pi/exclude_species_list.txt"
|
EXCLUDE_LIST="/home/*/BirdNET-Pi/exclude_species_list.txt"
|
||||||
if [ ! -f ${INCLUDE_LIST} ];then
|
if [ ! -f ${INCLUDE_LIST} ];then
|
||||||
touch ${INCLUDE_LIST} &&
|
touch ${INCLUDE_LIST} &&
|
||||||
chmod g+rw ${INCLUDE_LIST}
|
chmod g+rw ${INCLUDE_LIST}
|
||||||
@@ -96,7 +96,7 @@ run_analysis() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
for i in "${files[@]}";do
|
for i in "${files[@]}";do
|
||||||
echo "${1}/${i}" > /home/pi/BirdNET-Pi/analyzing_now.txt
|
echo "${1}/${i}" > /home/*/BirdNET-Pi/analyzing_now.txt
|
||||||
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
[ -z ${RECORDING_LENGTH} ] && RECORDING_LENGTH=15
|
||||||
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
[ ${RECORDING_LENGTH} == "60" ] && RECORDING_LENGTH=01:00
|
||||||
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
FILE_LENGTH="$(ffmpeg -i ${1}/${i} 2>&1 | awk -F. '/Duration/ {print $1}' | cut -d':' -f3-4)"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$template = file_get_contents("scripts/email_template2");
|
$template = file_get_contents("scripts/email_template2");
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$template = file_get_contents("scripts/email_template");
|
$template = file_get_contents("scripts/email_template");
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
# you are okay will losing all the data that you've collected and processed
|
# you are okay will losing all the data that you've collected and processed
|
||||||
# so far.
|
# so far.
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
HOME=/home/pi
|
|
||||||
USER=pi
|
|
||||||
my_dir=${HOME}/BirdNET-Pi/scripts
|
my_dir=${HOME}/BirdNET-Pi/scripts
|
||||||
echo "Stopping services"
|
echo "Stopping services"
|
||||||
sudo systemctl stop birdnet_recording.service
|
sudo systemctl stop birdnet_recording.service
|
||||||
@@ -45,6 +43,6 @@ echo "Generating BirdDB.txt"
|
|||||||
touch $(dirname ${my_dir})/BirdDB.txt
|
touch $(dirname ${my_dir})/BirdDB.txt
|
||||||
echo "Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap" > $(dirname ${my_dir})/BirdDB.txt
|
echo "Date;Time;Sci_Name;Com_Name;Confidence;Lat;Lon;Cutoff;Week;Sens;Overlap" > $(dirname ${my_dir})/BirdDB.txt
|
||||||
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt
|
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
|
chown $USER:$USER ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt
|
||||||
echo "Restarting services"
|
echo "Restarting services"
|
||||||
restart_services.sh
|
restart_services.sh
|
||||||
|
|||||||
+9
-9
@@ -10,28 +10,28 @@ $birdweather_id = $_POST["birdweather_id"];
|
|||||||
$pushed_app_key = $_POST["pushed_app_key"];
|
$pushed_app_key = $_POST["pushed_app_key"];
|
||||||
$pushed_app_secret = $_POST["pushed_app_secret"];
|
$pushed_app_secret = $_POST["pushed_app_secret"];
|
||||||
|
|
||||||
$contents = file_get_contents("/home/pi/BirdNET-Pi/birdnet.conf");
|
$contents = file_get_contents("/home/*/BirdNET-Pi/birdnet.conf");
|
||||||
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
|
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
|
||||||
$contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents);
|
$contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents);
|
||||||
$contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents);
|
$contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents);
|
||||||
$contents = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents);
|
$contents = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents);
|
||||||
$contents = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents);
|
$contents = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents);
|
||||||
|
|
||||||
$contents2 = file_get_contents("/home/pi/BirdNET-Pi/thisrun.txt");
|
$contents2 = file_get_contents("/home/*/BirdNET-Pi/thisrun.txt");
|
||||||
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
|
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
|
||||||
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
|
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
|
||||||
$contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2);
|
$contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2);
|
||||||
$contents2 = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents2);
|
$contents2 = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents2);
|
||||||
$contents2 = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents2);
|
$contents2 = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents2);
|
||||||
|
|
||||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||||
fwrite($fh, $contents);
|
fwrite($fh, $contents);
|
||||||
fwrite($fh2, $contents2);
|
fwrite($fh2, $contents2);
|
||||||
|
|
||||||
$language = $_POST["language"];
|
$language = $_POST["language"];
|
||||||
if ($language != "none"){
|
if ($language != "none"){
|
||||||
$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 = "sudo -upi mv /home/*/BirdNET-Pi/model/labels.txt /home/*/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/*/BirdNET-Pi/model/labels_l18n.zip $language -d /home/*/BirdNET-Pi/model && sudo -upi mv /home/*/BirdNET-Pi/model/$language /home/*/BirdNET-Pi/model/labels.txt";
|
||||||
$command_output = `$command`;
|
$command_output = `$command`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,10 +46,10 @@ if ($language != "none"){
|
|||||||
<h2>Basic Settings</h2>
|
<h2>Basic Settings</h2>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$caddypwd = $config['CADDY_PWD'];
|
$caddypwd = $config['CADDY_PWD'];
|
||||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||||
|
|||||||
+3
-3
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
sqlite3 /home/pi/BirdNET-Pi/scripts/birds.db << EOF
|
sqlite3 $HOME/BirdNET-Pi/scripts/birds.db << EOF
|
||||||
DROP TABLE IF EXISTS detections;
|
DROP TABLE IF EXISTS detections;
|
||||||
CREATE TABLE IF NOT EXISTS detections (
|
CREATE TABLE IF NOT EXISTS detections (
|
||||||
Date DATE,
|
Date DATE,
|
||||||
@@ -16,5 +16,5 @@ CREATE TABLE IF NOT EXISTS detections (
|
|||||||
Overlap FLOAT,
|
Overlap FLOAT,
|
||||||
File_Name VARCHAR(100) NOT NULL);
|
File_Name VARCHAR(100) NOT NULL);
|
||||||
EOF
|
EOF
|
||||||
sudo chown pi:pi /home/pi/BirdNET-Pi/scripts/birds.db
|
sudo chown $USER:$USER $HOME/BirdNET-Pi/scripts/birds.db
|
||||||
sudo chmod g+w /home/pi/BirdNET-Pi/scripts/birds.db
|
sudo chmod g+w $HOME/BirdNET-Pi/scripts/birds.db
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
|
||||||
|
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import os
|
import os
|
||||||
import configparser
|
import configparser
|
||||||
@@ -10,7 +8,7 @@ from matplotlib.colors import LogNorm
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
conn = sqlite3.connect('/home/pi/BirdNET-Pi/scripts/birds.db')
|
conn = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
|
||||||
df = pd.read_sql_query("SELECT * from detections", conn)
|
df = pd.read_sql_query("SELECT * from detections", conn)
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute('SELECT * FROM detections')
|
cursor.execute('SELECT * FROM detections')
|
||||||
@@ -99,7 +97,7 @@ f.subplots_adjust(top=0.9)
|
|||||||
plt.suptitle("Top 10 Last Updated: "+ str(now.strftime("%Y-%m-%d %H:%M")))
|
plt.suptitle("Top 10 Last Updated: "+ str(now.strftime("%Y-%m-%d %H:%M")))
|
||||||
|
|
||||||
#Save combined plot
|
#Save combined plot
|
||||||
savename='/home/pi/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
savename='/home/*/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
||||||
plt.savefig(savename)
|
plt.savefig(savename)
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.close()
|
plt.close()
|
||||||
@@ -167,7 +165,7 @@ f.subplots_adjust(top=0.9)
|
|||||||
plt.suptitle("Bottom 10 Last Updated: "+ str(now.strftime("%Y-%m-%d %H:%M")))
|
plt.suptitle("Bottom 10 Last Updated: "+ str(now.strftime("%Y-%m-%d %H:%M")))
|
||||||
|
|
||||||
#Save combined plot
|
#Save combined plot
|
||||||
savename='/home/pi/BirdSongs/Extracted/Charts/Combo2-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
savename='/home/*/BirdSongs/Extracted/Charts/Combo2-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
||||||
plt.savefig(savename)
|
plt.savefig(savename)
|
||||||
plt.show()
|
plt.show()
|
||||||
plt.close()
|
plt.close()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# set -x # Uncomment to debug
|
# set -x # Uncomment to debug
|
||||||
source /etc/birdnet/birdnet.conf &> /dev/null
|
source /etc/birdnet/birdnet.conf &> /dev/null
|
||||||
LOG_DIR="${HOME}/BirdNET-Pi/logs"
|
LOG_DIR="${HOME}/BirdNET-Pi/logs"
|
||||||
my_dir=/home/pi/BirdNET-Pi/scripts
|
my_dir=$HOME/BirdNET-Pi/scripts
|
||||||
services=$(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort)
|
services=$(awk '/service/ && /systemctl/ && !/php/ {print $3}' ${my_dir}/install_services.sh | sort)
|
||||||
|
|
||||||
# Create logs directory
|
# Create logs directory
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<h3>Excluded Species List</h3>
|
<h3>Excluded Species List</h3>
|
||||||
<select name="species[]" id="value2" multiple size="auto">
|
<select name="species[]" id="value2" multiple size="auto">
|
||||||
<?php
|
<?php
|
||||||
$filename = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
|
$filename = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||||
$eachline = file($filename, FILE_IGNORE_NEW_LINES);
|
$eachline = file($filename, FILE_IGNORE_NEW_LINES);
|
||||||
foreach($eachline as $lines){
|
foreach($eachline as $lines){
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ echo "........................................IPs...............................
|
|||||||
echo "LAN IP: $(hostname -I|cut -d' ' -f1)"
|
echo "LAN IP: $(hostname -I|cut -d' ' -f1)"
|
||||||
echo "Public IP: $(curl -s4 ifconfig.co)"
|
echo "Public IP: $(curl -s4 ifconfig.co)"
|
||||||
echo "..................................\`vcgencmd stats\`.............................."
|
echo "..................................\`vcgencmd stats\`.............................."
|
||||||
sudo -upi vcgencmd get_throttled
|
sudo -u$USER vcgencmd get_throttled
|
||||||
hex=$(sudo -upi vcgencmd get_throttled|cut -d'x' -f2)
|
hex=$(sudo -u$USER vcgencmd get_throttled|cut -d'x' -f2)
|
||||||
binary=$(echo "ibase=16;obase=2;$hex"|bc)
|
binary=$(echo "ibase=16;obase=2;$hex"|bc)
|
||||||
echo "Binary: $binary";
|
echo "Binary: $binary";
|
||||||
revbinary=$(echo $binary|rev)
|
revbinary=$(echo $binary|rev)
|
||||||
@@ -55,11 +55,11 @@ if echo $binary | grep 1 ;then
|
|||||||
fi
|
fi
|
||||||
echo "....................................Clock Speeds................................"
|
echo "....................................Clock Speeds................................"
|
||||||
for i in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi;do
|
for i in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi;do
|
||||||
echo -e "${i}:\t$(sudo -upi vcgencmd measure_clock ${i})"
|
echo -e "${i}:\t$(sudo -u$USER vcgencmd measure_clock ${i})"
|
||||||
done
|
done
|
||||||
echo "........................................Volts..................................."
|
echo "........................................Volts..................................."
|
||||||
for i in core sdram_c sdram_i sdram_p;do
|
for i in core sdram_c sdram_i sdram_p;do
|
||||||
echo -e "${i}:\t$(sudo -upi vcgencmd measure_volts ${i})"
|
echo -e "${i}:\t$(sudo -u$USER vcgencmd measure_volts ${i})"
|
||||||
done
|
done
|
||||||
echo ".....................................Caddyfile.................................."
|
echo ".....................................Caddyfile.................................."
|
||||||
cat /etc/caddy/Caddyfile
|
cat /etc/caddy/Caddyfile
|
||||||
|
|||||||
+3
-3
@@ -11,7 +11,7 @@ $theDate = date('Y-m-d');
|
|||||||
$chart = "Combo-$theDate.png";
|
$chart = "Combo-$theDate.png";
|
||||||
$chart2 = "Combo2-$theDate.png";
|
$chart2 = "Combo2-$theDate.png";
|
||||||
|
|
||||||
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
|
|
||||||
$statement1 = $db->prepare("SELECT COUNT(*) FROM detections
|
$statement1 = $db->prepare("SELECT COUNT(*) FROM detections
|
||||||
WHERE Date == \"$theDate\"");
|
WHERE Date == \"$theDate\"");
|
||||||
@@ -38,13 +38,13 @@ $totalcount = $result1->fetchArray(SQLITE3_ASSOC);
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
|
if (file_exists('/home/*/BirdSongs/Extracted/Charts/'.$chart)) {
|
||||||
echo "<img src=\"/Charts/$chart?nocache=time()\" >";
|
echo "<img src=\"/Charts/$chart?nocache=time()\" >";
|
||||||
} else {
|
} else {
|
||||||
echo "<p>No Charts for $theDate</p>";
|
echo "<p>No Charts for $theDate</p>";
|
||||||
}
|
}
|
||||||
echo "<hr>";
|
echo "<hr>";
|
||||||
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart2)) {
|
if (file_exists('/home/*/BirdSongs/Extracted/Charts/'.$chart2)) {
|
||||||
echo "<img src=\"/Charts/$chart2?nocache=time()\">";
|
echo "<img src=\"/Charts/$chart2?nocache=time()\">";
|
||||||
} else {
|
} else {
|
||||||
echo "<p>No Charts For $theDate</p>";
|
echo "<p>No Charts For $theDate</p>";
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ $eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
|||||||
<select name="species[]" id="value2" multiple size="30">
|
<select name="species[]" id="value2" multiple size="30">
|
||||||
<option selected value="base">Please Select</option>
|
<option selected value="base">Please Select</option>
|
||||||
<?php
|
<?php
|
||||||
$filename = '/home/pi/BirdNET-Pi/include_species_list.txt';
|
$filename = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||||
foreach($eachlines as $lines){echo
|
foreach($eachlines as $lines){echo
|
||||||
"<option value='".$lines."'>$lines</option>";}
|
"<option value='".$lines."'>$lines</option>";}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ install_birdnet() {
|
|||||||
echo "Establishing a python virtual environment"
|
echo "Establishing a python virtual environment"
|
||||||
python3 -m venv birdnet
|
python3 -m venv birdnet
|
||||||
source ./birdnet/bin/activate
|
source ./birdnet/bin/activate
|
||||||
pip3 install -U -r /home/pi/BirdNET-Pi/requirements.txt
|
pip3 install -U -r $HOME/BirdNET-Pi/requirements.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
[ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} &> /dev/null
|
[ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} &> /dev/null
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ PUSHED_APP_SECRET=
|
|||||||
## it needs to analyze. Be sure this directory is readable and writable for
|
## it needs to analyze. Be sure this directory is readable and writable for
|
||||||
## the BIRDNET_USER.
|
## the BIRDNET_USER.
|
||||||
|
|
||||||
RECS_DIR=/home/pi/BirdSongs
|
RECS_DIR=$HOME/BirdSongs
|
||||||
|
|
||||||
## REC_CARD is the sound card you would want the birdnet_recording.service to
|
## REC_CARD is the sound card you would want the birdnet_recording.service to
|
||||||
## use. Leave this as "default" to use PulseAudio (recommended), or use
|
## use. Leave this as "default" to use PulseAudio (recommended), or use
|
||||||
@@ -95,11 +95,11 @@ REC_CARD=default
|
|||||||
## after extractions have been made from them. This includes both WAVE and
|
## after extractions have been made from them. This includes both WAVE and
|
||||||
## BirdNET.selection.txt files.
|
## BirdNET.selection.txt files.
|
||||||
|
|
||||||
PROCESSED=/home/pi/BirdSongs/Processed
|
PROCESSED=$HOME/BirdSongs/Processed
|
||||||
|
|
||||||
## EXTRACTED is the directory where the extracted audio selections are moved.
|
## EXTRACTED is the directory where the extracted audio selections are moved.
|
||||||
|
|
||||||
EXTRACTED=/home/pi/BirdSongs/Extracted
|
EXTRACTED=$HOME/BirdSongs/Extracted
|
||||||
|
|
||||||
## OVERLAP is the value in seconds which BirdNET should use when analyzing
|
## OVERLAP is the value in seconds which BirdNET should use when analyzing
|
||||||
## the data. The values must be between 0.0-2.9.
|
## the data. The values must be between 0.0-2.9.
|
||||||
@@ -155,15 +155,11 @@ EXTRACTION_LENGTH=
|
|||||||
|
|
||||||
AUDIOFMT=mp3
|
AUDIOFMT=mp3
|
||||||
|
|
||||||
## BIRDNET_USER should be the non-root user systemd should use to execute each
|
|
||||||
## service.
|
|
||||||
|
|
||||||
BIRDNET_USER=pi
|
|
||||||
|
|
||||||
## These are just for debugging
|
## These are just for debugging
|
||||||
LAST_RUN=
|
LAST_RUN=
|
||||||
THIS_RUN=
|
THIS_RUN=
|
||||||
IDFILE=/home/pi/BirdNET-Pi/IdentifiedSoFar.txt
|
IDFILE=$HOME/BirdNET-Pi/IdentifiedSoFar.txt
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+32
-34
@@ -3,9 +3,7 @@
|
|||||||
set -x # Uncomment to enable debugging
|
set -x # Uncomment to enable debugging
|
||||||
trap 'rm -f ${tmpfile}' EXIT
|
trap 'rm -f ${tmpfile}' EXIT
|
||||||
trap 'exit 1' SIGINT SIGHUP
|
trap 'exit 1' SIGINT SIGHUP
|
||||||
USER=pi
|
my_dir=$HOME/BirdNET-Pi/scripts
|
||||||
HOME=/home/pi
|
|
||||||
my_dir=${HOME}/BirdNET-Pi/scripts
|
|
||||||
tmpfile=$(mktemp)
|
tmpfile=$(mktemp)
|
||||||
config_file="$(dirname ${my_dir})/birdnet.conf"
|
config_file="$(dirname ${my_dir})/birdnet.conf"
|
||||||
|
|
||||||
@@ -38,7 +36,7 @@ install_scripts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_birdnet_analysis() {
|
install_birdnet_analysis() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/birdnet_analysis.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_analysis.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Analysis
|
Description=BirdNET Analysis
|
||||||
After=birdnet_server.service
|
After=birdnet_server.service
|
||||||
@@ -52,12 +50,12 @@ ExecStart=/usr/local/bin/birdnet_analysis.sh
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/birdnet_analysis.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/birdnet_analysis.service /usr/lib/systemd/system
|
||||||
systemctl enable birdnet_analysis.service
|
systemctl enable birdnet_analysis.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_birdnet_server() {
|
install_birdnet_server() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/birdnet_server.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_server.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Analysis Server
|
Description=BirdNET Analysis Server
|
||||||
Before=birdnet_analysis.service
|
Before=birdnet_analysis.service
|
||||||
@@ -70,12 +68,12 @@ ExecStart=/usr/local/bin/server.py
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/birdnet_server.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/birdnet_server.service /usr/lib/systemd/system
|
||||||
systemctl enable birdnet_server.service
|
systemctl enable birdnet_server.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_extraction_service() {
|
install_extraction_service() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/extraction.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/extraction.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET BirdSound Extraction
|
Description=BirdNET BirdSound Extraction
|
||||||
[Service]
|
[Service]
|
||||||
@@ -87,24 +85,24 @@ ExecStart=/usr/bin/env bash -c 'while true;do extract_new_birdsounds.sh;sleep 3;
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/extraction.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/extraction.service /usr/lib/systemd/system
|
||||||
systemctl enable extraction.service
|
systemctl enable extraction.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_pushed_notifications() {
|
install_pushed_notifications() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/pushed_notifications.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/pushed_notifications.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET-Pi Pushed.co Notifications
|
Description=BirdNET-Pi Pushed.co Notifications
|
||||||
[Service]
|
[Service]
|
||||||
Restart=on-success
|
Restart=on-success
|
||||||
RestartSec=3
|
RestartSec=3
|
||||||
Type=simple
|
Type=simple
|
||||||
User=pi
|
User=$USER
|
||||||
ExecStart=/usr/local/bin/species_notifier.sh
|
ExecStart=/usr/local/bin/species_notifier.sh
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/pushed_notifications.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/pushed_notifications.service /usr/lib/systemd/system
|
||||||
systemctl enable pushed_notifications.service
|
systemctl enable pushed_notifications.service
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +140,7 @@ generate_BirdDB() {
|
|||||||
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
|
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
|
fi
|
||||||
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt &&
|
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
|
chown $USER:$USER ${my_dir}/BirdDB.txt && chmod g+rw ${my_dir}/BirdDB.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
set_login() {
|
set_login() {
|
||||||
@@ -159,7 +157,7 @@ EOF
|
|||||||
|
|
||||||
install_recording_service() {
|
install_recording_service() {
|
||||||
echo "Installing birdnet_recording.service"
|
echo "Installing birdnet_recording.service"
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/birdnet_recording.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_recording.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Recording
|
Description=BirdNET Recording
|
||||||
[Service]
|
[Service]
|
||||||
@@ -172,13 +170,13 @@ ExecStart=/usr/local/bin/birdnet_recording.sh
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/birdnet_recording.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/birdnet_recording.service /usr/lib/systemd/system
|
||||||
systemctl enable birdnet_recording.service
|
systemctl enable birdnet_recording.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_custom_recording_service() {
|
install_custom_recording_service() {
|
||||||
echo "Installing custom_recording.service"
|
echo "Installing custom_recording.service"
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/custom_recording.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/custom_recording.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Custom Recording
|
Description=BirdNET Custom Recording
|
||||||
[Service]
|
[Service]
|
||||||
@@ -191,7 +189,7 @@ ExecStart=/usr/local/bin/custom_recording.sh
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/custom_recording.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/custom_recording.service /usr/lib/systemd/system
|
||||||
}
|
}
|
||||||
|
|
||||||
install_Caddyfile() {
|
install_Caddyfile() {
|
||||||
@@ -254,11 +252,11 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
systemctl enable caddy
|
systemctl enable caddy
|
||||||
usermod -aG pi caddy
|
usermod -aG $USER caddy
|
||||||
}
|
}
|
||||||
|
|
||||||
install_avahi_aliases() {
|
install_avahi_aliases() {
|
||||||
cat << 'EOF' > /home/pi/BirdNET-Pi/templates/avahi-alias@.service
|
cat << 'EOF' > $HOME/BirdNET-Pi/templates/avahi-alias@.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Publish %I as alias for %H.local via mdns
|
Description=Publish %I as alias for %H.local via mdns
|
||||||
After=network.target network-online.target
|
After=network.target network-online.target
|
||||||
@@ -271,12 +269,12 @@ ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' '
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/avahi-alias@.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/avahi-alias@.service /usr/lib/systemd/system
|
||||||
systemctl enable avahi-alias@"$(hostname)".local.service
|
systemctl enable avahi-alias@"$(hostname)".local.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_birdnet_stats_service() {
|
install_birdnet_stats_service() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/birdnet_stats.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_stats.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Stats
|
Description=BirdNET Stats
|
||||||
[Service]
|
[Service]
|
||||||
@@ -284,17 +282,17 @@ Restart=on-failure
|
|||||||
RestartSec=5
|
RestartSec=5
|
||||||
Type=simple
|
Type=simple
|
||||||
User=${USER}
|
User=${USER}
|
||||||
ExecStart=/home/pi/BirdNET-Pi/birdnet/bin/streamlit run /home/pi/BirdNET-Pi/scripts/plotly_streamlit.py --server.address localhost --server.baseUrlPath "/stats"
|
ExecStart=$HOME/BirdNET-Pi/birdnet/bin/streamlit run $HOME/BirdNET-Pi/scripts/plotly_streamlit.py --server.address localhost --server.baseUrlPath "/stats"
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/birdnet_stats.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/birdnet_stats.service /usr/lib/systemd/system
|
||||||
systemctl enable birdnet_stats.service
|
systemctl enable birdnet_stats.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_spectrogram_service() {
|
install_spectrogram_service() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/spectrogram_viewer.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/spectrogram_viewer.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET-Pi Spectrogram Viewer
|
Description=BirdNET-Pi Spectrogram Viewer
|
||||||
[Service]
|
[Service]
|
||||||
@@ -306,25 +304,25 @@ ExecStart=/usr/local/bin/spectrogram.sh
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/spectrogram_viewer.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/spectrogram_viewer.service /usr/lib/systemd/system
|
||||||
systemctl enable spectrogram_viewer.service
|
systemctl enable spectrogram_viewer.service
|
||||||
}
|
}
|
||||||
|
|
||||||
install_chart_viewer_service() {
|
install_chart_viewer_service() {
|
||||||
echo "Installing the chart_viewer.service"
|
echo "Installing the chart_viewer.service"
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/chart_viewer.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/chart_viewer.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET-Pi Chart Viewer Service
|
Description=BirdNET-Pi Chart Viewer Service
|
||||||
[Service]
|
[Service]
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=300
|
RestartSec=300
|
||||||
Type=simple
|
Type=simple
|
||||||
User=pi
|
User=$USER
|
||||||
ExecStart=/usr/local/bin/daily_plot.py
|
ExecStart=/usr/local/bin/daily_plot.py
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/chart_viewer.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/chart_viewer.service /usr/lib/systemd/system
|
||||||
systemctl enable chart_viewer.service
|
systemctl enable chart_viewer.service
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -333,7 +331,7 @@ install_gotty_logs() {
|
|||||||
${HOME}/.gotty
|
${HOME}/.gotty
|
||||||
sudo -u ${USER} ln -sf $(dirname ${my_dir})/templates/bashrc \
|
sudo -u ${USER} ln -sf $(dirname ${my_dir})/templates/bashrc \
|
||||||
${HOME}/.bashrc
|
${HOME}/.bashrc
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/birdnet_log.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/birdnet_log.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET Analysis Log
|
Description=BirdNET Analysis Log
|
||||||
[Service]
|
[Service]
|
||||||
@@ -346,9 +344,9 @@ ExecStart=/usr/local/bin/gotty --address localhost -p 8080 -P log --title-format
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/birdnet_log.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/birdnet_log.service /usr/lib/systemd/system
|
||||||
systemctl enable birdnet_log.service
|
systemctl enable birdnet_log.service
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/web_terminal.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/web_terminal.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET-Pi Web Terminal
|
Description=BirdNET-Pi Web Terminal
|
||||||
[Service]
|
[Service]
|
||||||
@@ -361,7 +359,7 @@ ExecStart=/usr/local/bin/gotty --address localhost -w -p 8888 -P terminal --titl
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/web_terminal.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/web_terminal.service /usr/lib/systemd/system
|
||||||
systemctl enable web_terminal.service
|
systemctl enable web_terminal.service
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +392,7 @@ config_icecast() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_livestream_service() {
|
install_livestream_service() {
|
||||||
cat << EOF > /home/pi/BirdNET-Pi/templates/livestream.service
|
cat << EOF > $HOME/BirdNET-Pi/templates/livestream.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=BirdNET-Pi Live Stream
|
Description=BirdNET-Pi Live Stream
|
||||||
After=network-online.target
|
After=network-online.target
|
||||||
@@ -409,7 +407,7 @@ ExecStart=/usr/local/bin/livestream.sh
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
ln -sf /home/pi/BirdNET-Pi/templates/livestream.service /usr/lib/systemd/system
|
ln -sf $HOME/BirdNET-Pi/templates/livestream.service /usr/lib/systemd/system
|
||||||
systemctl enable livestream.service
|
systemctl enable livestream.service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ header("refresh: 300;");
|
|||||||
$myDate = date('Y-m-d');
|
$myDate = date('Y-m-d');
|
||||||
$chart = "Combo-$myDate.png";
|
$chart = "Combo-$myDate.png";
|
||||||
|
|
||||||
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
if($db == False) {
|
if($db == False) {
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
@@ -109,7 +109,7 @@ body::-webkit-scrollbar {
|
|||||||
<div class="right-column">
|
<div class="right-column">
|
||||||
<div class="chart">
|
<div class="chart">
|
||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
|
if (file_exists('/home/*/BirdSongs/Extracted/Charts/'.$chart)) {
|
||||||
echo "<img src=\"/Charts/$chart?nocache=time()\">";
|
echo "<img src=\"/Charts/$chart?nocache=time()\">";
|
||||||
} else {
|
} else {
|
||||||
echo "<p>No Detections For Today</p>";
|
echo "<p>No Detections For Today</p>";
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ ini_set('display_errors', 1);
|
|||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
if($db == False){
|
if($db == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
|
||||||
import streamlit as st
|
import streamlit as st
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -9,7 +8,7 @@ from pathlib import Path
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from sqlite3 import Connection
|
from sqlite3 import Connection
|
||||||
|
|
||||||
URI_SQLITE_DB = "/home/pi/BirdNET-Pi/scripts/birds.db"
|
URI_SQLITE_DB = "/home/*/BirdNET-Pi/scripts/birds.db"
|
||||||
|
|
||||||
st.set_page_config(layout='wide')
|
st.set_page_config(layout='wide')
|
||||||
|
|
||||||
@@ -34,7 +33,7 @@ st.markdown("""
|
|||||||
col1,col2,col3 = st.columns([20,20,20])
|
col1,col2,col3 = st.columns([20,20,20])
|
||||||
|
|
||||||
col1.title('BirdNET-Pi', anchor=None)
|
col1.title('BirdNET-Pi', anchor=None)
|
||||||
col2.image('/home/pi/BirdNET-Pi/homepage/images/bird.png')
|
col2.image('/home/*/BirdNET-Pi/homepage/images/bird.png')
|
||||||
col3.text('')
|
col3.text('')
|
||||||
|
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ def get_connection(path:str):
|
|||||||
|
|
||||||
|
|
||||||
# def load_data():
|
# def load_data():
|
||||||
# df1 = pd.read_csv('/home/pi/BirdNET-Pi/BirdDB.txt', sep=';')
|
# df1 = pd.read_csv('/home/*/BirdNET-Pi/BirdDB.txt', sep=';')
|
||||||
# return df1
|
# return df1
|
||||||
|
|
||||||
def get_data(conn: Connection):
|
def get_data(conn: Connection):
|
||||||
@@ -179,6 +178,6 @@ st.plotly_chart(fig, use_container_width=True) #, config=config)
|
|||||||
#
|
#
|
||||||
# extract_date=Date_Slider
|
# extract_date=Date_Slider
|
||||||
#
|
#
|
||||||
# audio_file = open('/home/pi/BirdSongs/Extracted/By_Date/2022-03-22/Yellow-streaked_Greenbul/Yellow-streaked_Greenbul-77-2022-03-22-birdnet-15:04:28.mp3', 'rb')
|
# audio_file = open('/home/*/BirdSongs/Extracted/By_Date/2022-03-22/Yellow-streaked_Greenbul/Yellow-streaked_Greenbul-77-2022-03-22-birdnet-15:04:28.mp3', 'rb')
|
||||||
# audio_bytes = audio_file.read()
|
# audio_bytes = audio_file.read()
|
||||||
# cols4.audio(audio_bytes, format='audio/mp3')
|
# cols4.audio(audio_bytes, format='audio/mp3')
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
@@ -44,7 +43,7 @@ except:
|
|||||||
|
|
||||||
|
|
||||||
# Open most recent Configuration and grab DB_PWD as a python variable
|
# Open most recent Configuration and grab DB_PWD as a python variable
|
||||||
with open('/home/pi/BirdNET-Pi/thisrun.txt', 'r') as f:
|
with open('/home/*/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||||
this_run = f.readlines()
|
this_run = f.readlines()
|
||||||
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
|
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ def loadModel():
|
|||||||
print('LOADING TF LITE MODEL...', end=' ')
|
print('LOADING TF LITE MODEL...', end=' ')
|
||||||
|
|
||||||
# Load TFLite model and allocate tensors.
|
# 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 = tflite.Interpreter(model_path='/home/*/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||||
myinterpreter.allocate_tensors()
|
myinterpreter.allocate_tensors()
|
||||||
|
|
||||||
# Get input and output tensors.
|
# Get input and output tensors.
|
||||||
@@ -73,7 +72,7 @@ def loadModel():
|
|||||||
|
|
||||||
# Load labels
|
# Load labels
|
||||||
CLASSES = []
|
CLASSES = []
|
||||||
with open('/home/pi/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
with open('/home/*/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
||||||
for line in lfile.readlines():
|
for line in lfile.readlines():
|
||||||
CLASSES.append(line.replace('\n', ''))
|
CLASSES.append(line.replace('\n', ''))
|
||||||
|
|
||||||
@@ -170,11 +169,11 @@ def predict(sample, sensitivity):
|
|||||||
if p_sorted[i][0]=='Human_Human':
|
if p_sorted[i][0]=='Human_Human':
|
||||||
print("HUMAN SCORE:",str(p_sorted[i]))
|
print("HUMAN SCORE:",str(p_sorted[i]))
|
||||||
HUMAN_FLAG=True
|
HUMAN_FLAG=True
|
||||||
with open('/home/pi/BirdNET-Pi/HUMAN.txt', 'a') as rfile:
|
with open('/home/*/BirdNET-Pi/HUMAN.txt', 'a') as rfile:
|
||||||
rfile.write(str(datetime.datetime.now())+str(p_sorted[i])+ '\n')
|
rfile.write(str(datetime.datetime.now())+str(p_sorted[i])+ '\n')
|
||||||
# date_stamp=datetime.datetime.now().strftime("%d_%m_%y_%H:%M:%S")
|
# date_stamp=datetime.datetime.now().strftime("%d_%m_%y_%H:%M:%S")
|
||||||
#
|
#
|
||||||
# sf.write('./home/pi/human_sample.wav',np.random.randn(10,2) , 44100) #sample[0]
|
# sf.write('./home/*/human_sample.wav',np.random.randn(10,2) , 44100) #sample[0]
|
||||||
|
|
||||||
# Only return first the top ten results
|
# Only return first the top ten results
|
||||||
#INCREASE THIS TO SEE IF HUMAN IS DETECTED MORE RELIABLY
|
#INCREASE THIS TO SEE IF HUMAN IS DETECTED MORE RELIABLY
|
||||||
@@ -259,8 +258,8 @@ def handle_client(conn, addr):
|
|||||||
|
|
||||||
args = type('', (), {})()
|
args = type('', (), {})()
|
||||||
|
|
||||||
args.i = '/home/pi/test.wav'
|
args.i = '/home/*/test.wav'
|
||||||
args.o = '/home/pi/test.wav.csv'
|
args.o = '/home/*/test.wav.csv'
|
||||||
args.birdweather_id = '99999'
|
args.birdweather_id = '99999'
|
||||||
args.include_list = 'null'
|
args.include_list = 'null'
|
||||||
args.exclude_list = 'null'
|
args.exclude_list = 'null'
|
||||||
@@ -355,7 +354,7 @@ def handle_client(conn, addr):
|
|||||||
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
|
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
|
||||||
|
|
||||||
|
|
||||||
with open('/home/pi/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
with open('/home/*/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
||||||
for d in detections:
|
for d in detections:
|
||||||
for entry in detections[d]:
|
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) ):
|
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) ):
|
||||||
@@ -381,7 +380,7 @@ def handle_client(conn, addr):
|
|||||||
|
|
||||||
#Connect to SQLite Database
|
#Connect to SQLite Database
|
||||||
try:
|
try:
|
||||||
con = sqlite3.connect('/home/pi/BirdNET-Pi/scripts/birds.db')
|
con = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
cur.execute("INSERT INTO detections VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (Date, Time, Sci_Name, Com_Name, str(score), Lat, Lon, Cutoff, Week, Sens, Overlap, File_Name))
|
cur.execute("INSERT INTO detections VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (Date, Time, Sci_Name, Com_Name, str(score), Lat, Lon, Cutoff, Week, Sens, Overlap, File_Name))
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Restarts ALL services and removes ALL unprocessed audio
|
# Restarts ALL services and removes ALL unprocessed audio
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
set -x
|
set -x
|
||||||
my_dir=/home/pi/BirdNET-Pi/scripts
|
my_dir=$HOME/BirdNET-Pi/scripts
|
||||||
|
|
||||||
sudo systemctl stop birdnet_server.service
|
sudo systemctl stop birdnet_server.service
|
||||||
sudo pkill server.py
|
sudo pkill server.py
|
||||||
|
|||||||
+7
-8
@@ -1,4 +1,3 @@
|
|||||||
#!/home/pi/BirdNET-Pi/birdnet/bin/python3
|
|
||||||
import socket
|
import socket
|
||||||
import threading
|
import threading
|
||||||
import os
|
import os
|
||||||
@@ -44,7 +43,7 @@ except:
|
|||||||
|
|
||||||
|
|
||||||
# Open most recent Configuration and grab DB_PWD as a python variable
|
# Open most recent Configuration and grab DB_PWD as a python variable
|
||||||
with open('/home/pi/BirdNET-Pi/thisrun.txt', 'r') as f:
|
with open('/home/*/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||||
this_run = f.readlines()
|
this_run = f.readlines()
|
||||||
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
|
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ def loadModel():
|
|||||||
print('LOADING TF LITE MODEL...', end=' ')
|
print('LOADING TF LITE MODEL...', end=' ')
|
||||||
|
|
||||||
# Load TFLite model and allocate tensors.
|
# 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 = tflite.Interpreter(model_path='/home/*/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||||
myinterpreter.allocate_tensors()
|
myinterpreter.allocate_tensors()
|
||||||
|
|
||||||
# Get input and output tensors.
|
# Get input and output tensors.
|
||||||
@@ -73,7 +72,7 @@ def loadModel():
|
|||||||
|
|
||||||
# Load labels
|
# Load labels
|
||||||
CLASSES = []
|
CLASSES = []
|
||||||
with open('/home/pi/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
with open('/home/*/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
||||||
for line in lfile.readlines():
|
for line in lfile.readlines():
|
||||||
CLASSES.append(line.replace('\n', ''))
|
CLASSES.append(line.replace('\n', ''))
|
||||||
|
|
||||||
@@ -233,8 +232,8 @@ def handle_client(conn, addr):
|
|||||||
|
|
||||||
args = type('', (), {})()
|
args = type('', (), {})()
|
||||||
|
|
||||||
args.i = '/home/pi/test.wav'
|
args.i = '/home/*/test.wav'
|
||||||
args.o = '/home/pi/test.wav.csv'
|
args.o = '/home/*/test.wav.csv'
|
||||||
args.birdweather_id = '99999'
|
args.birdweather_id = '99999'
|
||||||
args.include_list = 'null'
|
args.include_list = 'null'
|
||||||
args.exclude_list = 'null'
|
args.exclude_list = 'null'
|
||||||
@@ -329,7 +328,7 @@ def handle_client(conn, addr):
|
|||||||
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
|
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
|
||||||
|
|
||||||
|
|
||||||
with open('/home/pi/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
with open('/home/*/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
||||||
for d in detections:
|
for d in detections:
|
||||||
for entry in detections[d]:
|
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) ):
|
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) ):
|
||||||
@@ -355,7 +354,7 @@ def handle_client(conn, addr):
|
|||||||
|
|
||||||
#Connect to SQLite Database
|
#Connect to SQLite Database
|
||||||
try:
|
try:
|
||||||
con = sqlite3.connect('/home/pi/BirdNET-Pi/scripts/birds.db')
|
con = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
cur.execute("INSERT INTO detections VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (Date, Time, Sci_Name, Com_Name, str(score), Lat, Lon, Cutoff, Week, Sens, Overlap, File_Name))
|
cur.execute("INSERT INTO detections VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (Date, Time, Sci_Name, Com_Name, str(score), Lat, Lon, Cutoff, Week, Sens, Overlap, File_Name))
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ lastcheck="$(mktemp)"
|
|||||||
|
|
||||||
cp ${IDFILE} ${lastcheck}
|
cp ${IDFILE} ${lastcheck}
|
||||||
|
|
||||||
/home/pi/BirdNET-Pi/scripts/update_species.sh
|
$HOME/BirdNET-Pi/scripts/update_species.sh
|
||||||
|
|
||||||
if ! diff ${IDFILE} ${lastcheck} &> /dev/null;then
|
if ! diff ${IDFILE} ${lastcheck} &> /dev/null;then
|
||||||
SPECIES=$(diff ${IDFILE} ${lastcheck} \
|
SPECIES=$(diff ${IDFILE} ${lastcheck} \
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||||
}
|
}
|
||||||
$refresh = $config['RECORDING_LENGTH'];
|
$refresh = $config['RECORDING_LENGTH'];
|
||||||
$time = time();
|
$time = time();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Make sox spectrogram
|
# Make sox spectrogram
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
analyzing_now="$(cat /home/pi/BirdNET-Pi/analyzing_now.txt)"
|
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||||
sudo -u pi sox "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now}" -o "${spectrogram_png}"
|
sudo -u $USER sox "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now}" -o "${spectrogram_png}"
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ ini_set('display_errors', 1);
|
|||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
if($db == False) {
|
if($db == False) {
|
||||||
echo "Database busy";
|
echo "Database busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ ini_set('display_errors', 1);
|
|||||||
ini_set('display_startup_errors', 1);
|
ini_set('display_startup_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
if($db == False){
|
if($db == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Uninstall script to remove everything
|
# Uninstall script to remove everything
|
||||||
#set -x # Uncomment to debug
|
#set -x # Uncomment to debug
|
||||||
trap 'rm -f ${TMPFILE}' EXIT
|
trap 'rm -f ${TMPFILE}' EXIT
|
||||||
my_dir=/home/pi/BirdNET-Pi/scripts
|
my_dir=$HOME/BirdNET-Pi/scripts
|
||||||
source /etc/birdnet/birdnet.conf &> /dev/null
|
source /etc/birdnet/birdnet.conf &> /dev/null
|
||||||
SCRIPTS=($(ls -1 ${my_dir}) ${HOME}/.gotty)
|
SCRIPTS=($(ls -1 ${my_dir}) ${HOME}/.gotty)
|
||||||
set -x
|
set -x
|
||||||
|
|||||||
@@ -2,14 +2,12 @@
|
|||||||
# Update BirdNET-Pi
|
# Update BirdNET-Pi
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
trap 'exit 1' SIGINT SIGHUP
|
trap 'exit 1' SIGINT SIGHUP
|
||||||
USER=pi
|
|
||||||
HOME=/home/pi
|
|
||||||
my_dir=${HOME}/BirdNET-Pi/scripts
|
my_dir=${HOME}/BirdNET-Pi/scripts
|
||||||
|
|
||||||
sudo -u${USER} git -C /home/pi/BirdNET-Pi stash
|
sudo -u${USER} git -C $my_dir/BirdNET-Pi stash
|
||||||
sudo -u${USER} git -C /home/pi/BirdNET-Pi pull -f
|
sudo -u${USER} git -C $my_dir/BirdNET-Pi pull -f
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo -u${USER} git -C /home/pi/BirdNET-Pi stash pop
|
sudo -u${USER} git -C $my_dir/BirdNET-Pi stash pop
|
||||||
sudo ln -sf $my_dir/* /usr/local/bin/
|
sudo ln -sf $my_dir/* /usr/local/bin/
|
||||||
if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf;then
|
if ! grep PRIVACY_MODE /etc/birdnet/birdnet.conf;then
|
||||||
sudo -u${USER} echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf
|
sudo -u${USER} echo "PRIVACY_MODE=off" >> /etc/birdnet/birdnet.conf
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
USER=pi
|
my_dir=$HOME/BirdNET-Pi/scripts
|
||||||
HOME=/home/pi
|
|
||||||
my_dir=/home/pi/BirdNET-Pi/scripts
|
|
||||||
set -x
|
set -x
|
||||||
[ -d /etc/caddy ] || mkdir /etc/caddy
|
[ -d /etc/caddy ] || mkdir /etc/caddy
|
||||||
if [ -f /etc/caddy/Caddyfile ];then
|
if [ -f /etc/caddy/Caddyfile ];then
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
# Update the species list
|
# Update the species list
|
||||||
#set -x
|
#set -x
|
||||||
source /etc/birdnet/birdnet.conf
|
source /etc/birdnet/birdnet.conf
|
||||||
sqlite3 /home/pi/BirdNET-Pi/scripts/birds.db "SELECT DISTINCT(Com_Name) FROM detections" | sort > ${IDFILE}
|
sqlite3 $HOME/BirdNET-Pi/scripts/birds.db "SELECT DISTINCT(Com_Name) FROM detections" | sort > ${IDFILE}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
# Writes variables to config file
|
# Writes variables to config file
|
||||||
birdnetpi_dir=/home/pi/BirdNET-Pi
|
birdnetpi_dir=$HOME/BirdNET-Pi
|
||||||
birders_conf=${birdnetpi_dir}/Birders_Guide_Installer_Configuration.txt
|
birders_conf=${birdnetpi_dir}/Birders_Guide_Installer_Configuration.txt
|
||||||
sed -i s/'^LATITUDE=$'/"LATITUDE=${new_lat}"/g ${birders_conf}
|
sed -i s/'^LATITUDE=$'/"LATITUDE=${new_lat}"/g ${birders_conf}
|
||||||
sed -i s/'^LONGITUDE=$'/"LONGITUDE=${new_lon}"/g ${birders_conf}
|
sed -i s/'^LONGITUDE=$'/"LONGITUDE=${new_lon}"/g ${birders_conf}
|
||||||
|
|||||||
+2
-1
@@ -113,7 +113,8 @@ if ! shopt -oq posix; then
|
|||||||
fi
|
fi
|
||||||
cd ~/BirdNET-Pi
|
cd ~/BirdNET-Pi
|
||||||
function remove() {
|
function remove() {
|
||||||
find /home/pi/BirdSongs -iname *${1}* -exec rm -drfv {} +
|
source /etc/birdnet/birdnet.conf
|
||||||
|
find $RECS_DIR -iname *${1}* -exec rm -drfv {} +
|
||||||
}
|
}
|
||||||
alias rerc="source ~/.bashrc"
|
alias rerc="source ~/.bashrc"
|
||||||
alias vimrc="vim ~/.bashrc"
|
alias vimrc="vim ~/.bashrc"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#birdnet
|
#birdnet
|
||||||
*/5 * * * * pi /usr/local/bin/disk_check.sh &> /dev/null
|
*/5 * * * * $USER /usr/local/bin/disk_check.sh &> /dev/null
|
||||||
#birdnet
|
#birdnet
|
||||||
*/3 * * * * pi /usr/local/bin/cleanup.sh &> /dev/null
|
*/3 * * * * $USER /usr/local/bin/cleanup.sh &> /dev/null
|
||||||
#birdnet
|
#birdnet
|
||||||
@reboot pi /usr/local/bin/cleanup.sh &> /dev/null
|
@reboot $USER /usr/local/bin/cleanup.sh &> /dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user