changes that remove the default pi user
This commit is contained in:
+5
-5
@@ -18,10 +18,10 @@ echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\
|
||||
<div class="stream">
|
||||
<?php
|
||||
if(isset($_GET['stream'])){
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
$caddypwd = $config['CADDY_PWD'];
|
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
@@ -55,7 +55,7 @@ if(isset($_GET['stream'])){
|
||||
</div>";
|
||||
}
|
||||
if(isset($_GET['log'])) {
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
header("Location: /log");}
|
||||
} elseif(isset($_GET['spectrogram'])){
|
||||
header("Location: /spectrogram.php");
|
||||
|
||||
+22
-22
@@ -45,10 +45,10 @@ if(isset($_POST['view'])){
|
||||
if($_POST['view'] == "Streamlit"){header('location:/stats');}
|
||||
if($_POST['view'] == "Daily Charts"){include('history.php');}
|
||||
if($_POST['view'] == "Tools"){
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
$caddypwd = $config['CADDY_PWD'];
|
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
@@ -87,64 +87,64 @@ if(isset($_POST['view'])){
|
||||
if($_POST['view'] == "Advanced"){include('scripts/advanced.php');}
|
||||
if($_POST['view'] == "Included"){
|
||||
if(isset($_POST['species']) && isset($_POST['add'])){
|
||||
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||
$file = './scripts/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/*/BirdNET-Pi/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||
file_put_contents("./scripts/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||
}
|
||||
} elseif(isset($_POST['species']) && isset($_POST['del'])){
|
||||
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||
$file = './scripts/include_species_list.txt';
|
||||
$str = file_get_contents("$file");
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
foreach($_POST['species'] as $selectedOption) {
|
||||
$content = file_get_contents("/home/*/BirdNET-Pi/include_species_list.txt");
|
||||
$content = file_get_contents("../BirdNET-Pi/include_species_list.txt");
|
||||
$newcontent = str_replace($selectedOption, "", "$content");
|
||||
file_put_contents("/home/*/BirdNET-Pi/include_species_list.txt", "$newcontent");
|
||||
file_put_contents("./scripts/include_species_list.txt", "$newcontent");
|
||||
}
|
||||
$file = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||
$file = './scripts/include_species_list.txt';
|
||||
$str = file_get_contents("$file");
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
}
|
||||
include('scripts/include_list.php');
|
||||
include('./scripts/include_list.php');
|
||||
}
|
||||
if($_POST['view'] == "Excluded"){
|
||||
if(isset($_POST['species']) && isset($_POST['add'])){
|
||||
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||
$file = './scripts/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");
|
||||
foreach ($_POST['species'] as $selectedOption)
|
||||
file_put_contents("/home/*/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||
file_put_contents("./scripts/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
|
||||
} elseif (isset($_POST['species']) && isset($_POST['del'])){
|
||||
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||
$file = './scripts/exclude_species_list.txt';
|
||||
$str = file_get_contents("$file");
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
foreach($_POST['species'] as $selectedOption) {
|
||||
$content = file_get_contents("/home/*/BirdNET-Pi/exclude_species_list.txt");
|
||||
$content = file_get_contents("./scripts/exclude_species_list.txt");
|
||||
$newcontent = str_replace($selectedOption, "", "$content");
|
||||
file_put_contents("/home/*/BirdNET-Pi/exclude_species_list.txt", "$newcontent");
|
||||
file_put_contents("./scripts/exclude_species_list.txt", "$newcontent");
|
||||
}
|
||||
$file = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||
$file = './scripts/exclude_species_list.txt';
|
||||
$str = file_get_contents("$file");
|
||||
$str = preg_replace('/^\h*\v+/m', '', $str);
|
||||
file_put_contents("$file", "$str");
|
||||
}
|
||||
include('scripts/exclude_list.php');
|
||||
include('./scripts/exclude_list.php');
|
||||
}
|
||||
if($_POST['view'] == "File"){
|
||||
header('Location: scripts/filemanager/filemanager.php');
|
||||
}
|
||||
if($_POST['view'] == "Webterm"){
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
$caddypwd = $config['CADDY_PWD'];
|
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
|
||||
+26
-19
@@ -3,10 +3,10 @@ ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('firstrun.ini')) {
|
||||
$config = parse_ini_file('firstrun.ini');
|
||||
}
|
||||
|
||||
$caddypwd = $config['CADDY_PWD'];
|
||||
@@ -27,16 +27,16 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
}
|
||||
|
||||
if(isset($_POST['submit'])) {
|
||||
$contents = file_get_contents("/home/*/BirdNET-Pi/birdnet.conf");
|
||||
$contents2 = file_get_contents("/home/*/BirdNET-Pi/thisrun.txt");
|
||||
$contents = file_get_contents('/etc/birdnet/birdnet.conf');
|
||||
$contents2 = file_get_contents('./scripts/thisrun.txt');
|
||||
|
||||
if(isset($_POST["caddy_pwd"])) {
|
||||
$caddy_pwd = $_POST["caddy_pwd"];
|
||||
if(strcmp($caddy_pwd,$config['CADDY_PWD']) !== 0) {
|
||||
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
|
||||
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
|
||||
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||
$fh = fopen('/etc/birdnet/birdnet.conf', "w");
|
||||
$fh2 = fopen("./scripts/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
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) {
|
||||
$contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents);
|
||||
$contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2);
|
||||
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||
$fh = fopen('/etc/birdnet/birdnet.conf', "w");
|
||||
$fh2 = fopen("./scripts/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||
@@ -98,17 +98,24 @@ if(isset($_POST['submit'])) {
|
||||
|
||||
if(isset($_POST["privacy_mode"])) {
|
||||
$privacy_mode = $_POST["privacy_mode"];
|
||||
if(strcmp($privacy_mode,$config['PRIVACY_MODE']) !== 0) {
|
||||
if(strcmp($config['PRIVACY_MODE'], "1") == 0 ) {
|
||||
$pmode = "on";
|
||||
}elseif(strcmp($config['PRIVACY_MODE'], "") == 0) {
|
||||
$pmode = "off";
|
||||
}
|
||||
if(strcmp($privacy_mode,$pmode) !== 0) {
|
||||
$contents = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents);
|
||||
$contents2 = preg_replace("/PRIVACY_MODE=.*/", "PRIVACY_MODE=$privacy_mode", $contents2);
|
||||
if(strcmp($privacy_mode,"on") == 0) {
|
||||
exec('sudo sed -i \'s/server.py/privacy_server.py/g\' /home/*/BirdNET-Pi/templates/birdnet_server.service');
|
||||
exec('sudo sed -i \'s/\/usr\/local\/bin\/server.py/\/usr\/local\/bin\/privacy_server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service');
|
||||
exec('sudo systemctl daemon-reload');
|
||||
exec('restart_services.sh');
|
||||
header('Location: /log');
|
||||
} elseif(strcmp($privacy_mode,"off") == 0) {
|
||||
exec('sudo sed -i \'s/privacy_server.py/server.py/g\' /home/*/BirdNET-Pi/templates/birdnet_server.service');
|
||||
exec('sudo sed -i \'s/\/usr\/local\/bin\/privacy_server.py/\/usr\/local\/bin\/server.py/g\' ../../BirdNET-Pi/templates/birdnet_server.service');
|
||||
exec('sudo systemctl daemon-reload');
|
||||
exec('restart_services.sh');
|
||||
header('Location: /log');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,8 +160,8 @@ if(isset($_POST['submit'])) {
|
||||
}
|
||||
}
|
||||
|
||||
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||
$fh = fopen('/etc/birdnet/birdnet.conf', "w");
|
||||
$fh2 = fopen("./scripts/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
}
|
||||
@@ -167,10 +174,10 @@ if(isset($_POST['submit'])) {
|
||||
<iframe src="https://github.com/sponsors/mcguirepr89/button" title="Sponsor mcguirepr89" style="height:35px;width:116px;border:0;"></iframe>
|
||||
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$newconfig = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$newconfig = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$newconfig = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
$newconfig = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
?>
|
||||
<h2>Advanced Settings</h2>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/home/patrick/BirdNET-Pi/birdnet/bin/python3
|
||||
import argparse
|
||||
import socket
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ source /etc/birdnet/birdnet.conf
|
||||
# Document this run's birdnet.conf settings
|
||||
# Make a temporary file to compare the current birdnet.conf with
|
||||
# the birdnet.conf as it was the last time this script was called
|
||||
my_dir=$(realpath $(dirname $0))
|
||||
if [ -z ${THIS_RUN} ];then THIS_RUN=/home/*/BirdNET-Pi/thisrun.txt;fi
|
||||
my_dir=$HOME/BirdNET-Pi/scripts
|
||||
if [ -z ${THIS_RUN} ];then THIS_RUN=$my_dir/thisrun.txt;fi
|
||||
[ -f ${THIS_RUN} ] || touch ${THIS_RUN} && chmod g+w ${THIS_RUN}
|
||||
if [ -z ${LAST_RUN} ];then LAST_RUN=/home/*/BirdNET-Pi/lastrun.txt;fi
|
||||
if [ -z ${LAST_RUN} ];then LAST_RUN=$my_dir/lastrun.txt;fi
|
||||
[ -z ${LATITUDE} ] && echo "LATITUDE not set, exiting 1" && exit 1
|
||||
[ -z ${LONGITUDE} ] && echo "LONGITUDE not set, exiting 1" && exit 1
|
||||
make_thisrun() {
|
||||
@@ -27,8 +27,8 @@ if ! diff ${LAST_RUN} ${THIS_RUN};then
|
||||
sudo systemctl start birdnet_recording.service
|
||||
fi
|
||||
|
||||
INCLUDE_LIST="/home/*/BirdNET-Pi/include_species_list.txt"
|
||||
EXCLUDE_LIST="/home/*/BirdNET-Pi/exclude_species_list.txt"
|
||||
INCLUDE_LIST="$HOME/BirdNET-Pi/include_species_list.txt"
|
||||
EXCLUDE_LIST="$HOME/BirdNET-Pi/exclude_species_list.txt"
|
||||
if [ ! -f ${INCLUDE_LIST} ];then
|
||||
touch ${INCLUDE_LIST} &&
|
||||
chmod g+rw ${INCLUDE_LIST}
|
||||
@@ -96,7 +96,7 @@ run_analysis() {
|
||||
fi
|
||||
|
||||
for i in "${files[@]}";do
|
||||
echo "${1}/${i}" > /home/*/BirdNET-Pi/analyzing_now.txt
|
||||
echo "${1}/${i}" > $HOME/BirdNET-Pi/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)"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('thisrun.txt')) {
|
||||
$config = parse_ini_file('thisrun.txt');
|
||||
} elseif (file_exists('firstrun.ini')) {
|
||||
$config = parse_ini_file('firstrun.ini');
|
||||
}
|
||||
$template = file_get_contents("scripts/email_template2");
|
||||
$template = file_get_contents("email_template2");
|
||||
|
||||
foreach($config as $key => $value)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('thisrun.txt')) {
|
||||
$config = parse_ini_file('thisrun.txt');
|
||||
} elseif (file_exists('firstrun.ini')) {
|
||||
$config = parse_ini_file('firstrun.ini');
|
||||
}
|
||||
$template = file_get_contents("scripts/email_template");
|
||||
$template = file_get_contents("email_template");
|
||||
|
||||
foreach($config as $key => $value)
|
||||
{
|
||||
|
||||
+28
-22
@@ -3,7 +3,10 @@
|
||||
# starting all data-collection from scratch. Only run this if you are sure
|
||||
# you are okay will losing all the data that you've collected and processed
|
||||
# so far.
|
||||
set -x
|
||||
source /etc/birdnet/birdnet.conf
|
||||
USER=$(awk -F: '/1000/ {print $1}' /etc/passwd)
|
||||
HOME=$(awk -F: '/1000/ {print $6}' /etc/passwd)
|
||||
my_dir=${HOME}/BirdNET-Pi/scripts
|
||||
echo "Stopping services"
|
||||
sudo systemctl stop birdnet_recording.service
|
||||
@@ -14,32 +17,35 @@ sudo rm -drf "${RECS_DIR}"
|
||||
sudo rm -f "${IDFILE}"
|
||||
sudo rm -f $(dirname ${my_dir})/BirdDB.txt
|
||||
|
||||
echo "Creating necessary directories"
|
||||
[ -d ${EXTRACTED} ] || mkdir -p ${EXTRACTED}
|
||||
[ -d ${EXTRACTED}/By_Date ] || mkdir -p ${EXTRACTED}/By_Date
|
||||
[ -d ${EXTRACTED}/Charts ] || mkdir -p ${EXTRACTED}/Charts
|
||||
[ -d ${PROCESSED} ] || mkdir -p ${PROCESSED}
|
||||
echo "Re-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}/Charts ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/Charts
|
||||
[ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED}
|
||||
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/exclude_species_list.txt $my_dir
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/include_species_list.txt $my_dir
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/homepage/* ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/model/labels.txt ${my_dir}
|
||||
sudo -u ${USER} ln -fs $my_dir ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/play.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/spectrogram.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/overview.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/stats.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/todays_detections.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/history.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/homepage/images/favicon.ico ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
|
||||
sudo -u ${USER} ln -fs $(dirname $my_dir)/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
|
||||
chmod -R g+rw $my_dir
|
||||
chmod -R g+rw ${RECS_DIR}
|
||||
|
||||
ln -fs $(dirname ${my_dir})/homepage/* ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/model/labels.txt ${my_dir}/
|
||||
ln -fs $(dirname ${my_dir})/scripts ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/scripts/play.php ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/scripts/spectrogram.php ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/scripts/overview.php ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/scripts/stats.php ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/scripts/todays_detections.php ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/scripts/history.php ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/homepage/images/favicon.ico ${EXTRACTED}
|
||||
ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
|
||||
ln -fs $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
|
||||
ln -fs $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
|
||||
ln -fs $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
|
||||
sudo chmod -R g+rw $(dirname ${my_dir})
|
||||
sudo chmod -R g+rw ${EXTRACTED}
|
||||
|
||||
echo "Dropping and re-creating database"
|
||||
createdb.sh
|
||||
echo "Generating BirdDB.txt"
|
||||
echo "Re-generating 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
|
||||
ln -sf $(dirname ${my_dir})/BirdDB.txt ${my_dir}/BirdDB.txt
|
||||
|
||||
+8
-8
@@ -10,22 +10,22 @@ $birdweather_id = $_POST["birdweather_id"];
|
||||
$pushed_app_key = $_POST["pushed_app_key"];
|
||||
$pushed_app_secret = $_POST["pushed_app_secret"];
|
||||
|
||||
$contents = file_get_contents("/home/*/BirdNET-Pi/birdnet.conf");
|
||||
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
|
||||
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
|
||||
$contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents);
|
||||
$contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents);
|
||||
$contents = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents);
|
||||
$contents = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents);
|
||||
|
||||
$contents2 = file_get_contents("/home/*/BirdNET-Pi/thisrun.txt");
|
||||
$contents2 = file_get_contents("./scripts/thisrun.txt");
|
||||
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
|
||||
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
|
||||
$contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2);
|
||||
$contents2 = preg_replace("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents2);
|
||||
$contents2 = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents2);
|
||||
|
||||
$fh = fopen("/home/*/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/*/BirdNET-Pi/thisrun.txt", "w");
|
||||
$fh = fopen("/etc/birdnet/birdnet.conf", "w");
|
||||
$fh2 = fopen("./scripts/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
|
||||
@@ -46,10 +46,10 @@ if ($language != "none"){
|
||||
<h2>Basic Settings</h2>
|
||||
<form action="" method="POST">
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
$caddypwd = $config['CADDY_PWD'];
|
||||
if (!isset($_SERVER['PHP_AUTH_USER'])) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/home/patrick/BirdNET-Pi/birdnet/bin/python3
|
||||
import sqlite3
|
||||
import os
|
||||
import configparser
|
||||
@@ -8,7 +9,8 @@ from matplotlib.colors import LogNorm
|
||||
from datetime import datetime
|
||||
import textwrap
|
||||
|
||||
conn = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
|
||||
userDir = os.path.expanduser('~')
|
||||
conn = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db')
|
||||
df = pd.read_sql_query("SELECT * from detections", conn)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT * FROM detections')
|
||||
@@ -97,7 +99,8 @@ f.subplots_adjust(top=0.9)
|
||||
plt.suptitle("Top 10 Last Updated: "+ str(now.strftime("%Y-%m-%d %H:%M")))
|
||||
|
||||
#Save combined plot
|
||||
savename='/home/*/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
||||
userDir = os.path.expanduser('~')
|
||||
savename=userDir + '/BirdSongs/Extracted/Charts/Combo-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
||||
plt.savefig(savename)
|
||||
plt.show()
|
||||
plt.close()
|
||||
@@ -165,7 +168,7 @@ f.subplots_adjust(top=0.9)
|
||||
plt.suptitle("Bottom 10 Last Updated: "+ str(now.strftime("%Y-%m-%d %H:%M")))
|
||||
|
||||
#Save combined plot
|
||||
savename='/home/*/BirdSongs/Extracted/Charts/Combo2-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
||||
savename=userDir + '/BirdSongs/Extracted/Charts/Combo2-'+str(now.strftime("%Y-%m-%d"))+'.png'
|
||||
plt.savefig(savename)
|
||||
plt.show()
|
||||
plt.close()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
$filename = 'scripts/labels.txt';
|
||||
$filename = './scripts/labels.txt';
|
||||
$eachline = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
|
||||
foreach($eachline as $lines){echo
|
||||
@@ -39,7 +39,7 @@
|
||||
<h3>Excluded Species List</h3>
|
||||
<select name="species[]" id="value2" multiple size="auto">
|
||||
<?php
|
||||
$filename = '/home/*/BirdNET-Pi/exclude_species_list.txt';
|
||||
$filename = './scripts/exclude_species_list.txt';
|
||||
$eachline = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
foreach($eachline as $lines){
|
||||
echo
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@ $theDate = date('Y-m-d');
|
||||
$chart = "Combo-$theDate.png";
|
||||
$chart2 = "Combo2-$theDate.png";
|
||||
|
||||
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
|
||||
$statement1 = $db->prepare("SELECT COUNT(*) FROM detections
|
||||
WHERE Date == \"$theDate\"");
|
||||
@@ -38,13 +38,13 @@ $totalcount = $result1->fetchArray(SQLITE3_ASSOC);
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdSongs/Extracted/Charts/'.$chart)) {
|
||||
if (file_exists('./Charts/'.$chart)) {
|
||||
echo "<img src=\"/Charts/$chart?nocache=time()\" >";
|
||||
} else {
|
||||
echo "<p>No Charts for $theDate</p>";
|
||||
}
|
||||
echo "<hr>";
|
||||
if (file_exists('/home/*/BirdSongs/Extracted/Charts/'.$chart2)) {
|
||||
if (file_exists('./Charts/'.$chart2)) {
|
||||
echo "<img src=\"/Charts/$chart2?nocache=time()\">";
|
||||
} else {
|
||||
echo "<p>No Charts For $theDate</p>";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors',1);
|
||||
|
||||
$filename = 'scripts/labels.txt';
|
||||
$filename = './scripts/labels.txt';
|
||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
|
||||
?>
|
||||
@@ -47,7 +47,7 @@ $eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
<select name="species[]" id="value2" multiple size="30">
|
||||
<option selected value="base">Please Select</option>
|
||||
<?php
|
||||
$filename = '/home/*/BirdNET-Pi/include_species_list.txt';
|
||||
$filename = './scripts/include_species_list.txt';
|
||||
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
|
||||
foreach($eachlines as $lines){echo
|
||||
"<option value='".$lines."'>$lines</option>";}
|
||||
|
||||
@@ -115,8 +115,10 @@ create_necessary_dirs() {
|
||||
[ -d ${EXTRACTED}/Charts ] || sudo -u ${USER} mkdir -p ${EXTRACTED}/Charts
|
||||
[ -d ${PROCESSED} ] || sudo -u ${USER} mkdir -p ${PROCESSED}
|
||||
|
||||
sudo -u ${USER} ln -fs $my_dir/exclude_species_list.txt $my_dir/scripts
|
||||
sudo -u ${USER} ln -fs $my_dir/include_species_list.txt $my_dir/scripts
|
||||
sudo -u ${USER} ln -fs $my_dir/homepage/* ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/model/labels.txt ${my_dir}
|
||||
sudo -u ${USER} ln -fs $my_dir/model/labels.txt ${my_dir}/scripts
|
||||
sudo -u ${USER} ln -fs $my_dir/scripts ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/scripts/play.php ${EXTRACTED}
|
||||
sudo -u ${USER} ln -fs $my_dir/scripts/spectrogram.php ${EXTRACTED}
|
||||
@@ -255,6 +257,7 @@ EOF
|
||||
|
||||
systemctl enable caddy
|
||||
usermod -aG $USER caddy
|
||||
usermod -aG video caddy
|
||||
}
|
||||
|
||||
install_avahi_aliases() {
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
header("refresh: 300;");
|
||||
$myDate = date('Y-m-d');
|
||||
$chart = "Combo-$myDate.png";
|
||||
|
||||
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
if($db == False) {
|
||||
echo "Database is busy";
|
||||
header("refresh: 0;");
|
||||
@@ -109,7 +106,7 @@ body::-webkit-scrollbar {
|
||||
<div class="right-column">
|
||||
<div class="chart">
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdSongs/Extracted/Charts/'.$chart)) {
|
||||
if (file_exists('./Charts/'.$chart)) {
|
||||
echo "<img src=\"/Charts/$chart?nocache=time()\">";
|
||||
} else {
|
||||
echo "<p>No Detections For Today</p>";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
if($db == False){
|
||||
echo "Database is busy";
|
||||
header("refresh: 0;");
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#!/home/patrick/BirdNET-Pi/birdnet/bin/python3
|
||||
import os
|
||||
import streamlit as st
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
@@ -8,7 +10,8 @@ from pathlib import Path
|
||||
import sqlite3
|
||||
from sqlite3 import Connection
|
||||
|
||||
URI_SQLITE_DB = "/home/*/BirdNET-Pi/scripts/birds.db"
|
||||
userDir = os.path.expanduser('~')
|
||||
URI_SQLITE_DB = userDir + '/BirdNET-Pi/scripts/birds.db'
|
||||
|
||||
st.set_page_config(layout='wide')
|
||||
|
||||
@@ -30,24 +33,12 @@ st.markdown("""
|
||||
</style>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
col1,col2,col3 = st.columns([20,20,20])
|
||||
|
||||
col1.title('BirdNET-Pi', anchor=None)
|
||||
col2.image('/home/*/BirdNET-Pi/homepage/images/bird.png')
|
||||
col3.text('')
|
||||
|
||||
|
||||
@st.cache(hash_funcs={Connection: id})
|
||||
def get_connection(path:str):
|
||||
return sqlite3.connect(path,check_same_thread=False)
|
||||
|
||||
|
||||
|
||||
|
||||
# def load_data():
|
||||
# df1 = pd.read_csv('/home/*/BirdNET-Pi/BirdDB.txt', sep=';')
|
||||
# return df1
|
||||
|
||||
def get_data(conn: Connection):
|
||||
df1=pd.read_sql("SELECT * FROM detections", con=conn)
|
||||
return df1
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/home/patrick/BirdNET-Pi/birdnet/bin/python3
|
||||
import socket
|
||||
import threading
|
||||
import os
|
||||
@@ -43,7 +44,8 @@ except:
|
||||
|
||||
|
||||
# Open most recent Configuration and grab DB_PWD as a python variable
|
||||
with open('/home/*/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||
userDir = os.path.expanduser('~')
|
||||
with open(userDir + '/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||
this_run = f.readlines()
|
||||
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
|
||||
|
||||
@@ -58,7 +60,8 @@ def loadModel():
|
||||
print('LOADING TF LITE MODEL...', end=' ')
|
||||
|
||||
# Load TFLite model and allocate tensors.
|
||||
myinterpreter = tflite.Interpreter(model_path='/home/*/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||
modelpath = userDir + '/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite'
|
||||
myinterpreter = tflite.Interpreter(model_path=modelpath,num_threads=2)
|
||||
myinterpreter.allocate_tensors()
|
||||
|
||||
# Get input and output tensors.
|
||||
@@ -72,7 +75,7 @@ def loadModel():
|
||||
|
||||
# Load labels
|
||||
CLASSES = []
|
||||
with open('/home/*/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
||||
with open(userDir + '/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
||||
for line in lfile.readlines():
|
||||
CLASSES.append(line.replace('\n', ''))
|
||||
|
||||
@@ -169,7 +172,7 @@ def predict(sample, sensitivity):
|
||||
if p_sorted[i][0]=='Human_Human':
|
||||
print("HUMAN SCORE:",str(p_sorted[i]))
|
||||
HUMAN_FLAG=True
|
||||
with open('/home/*/BirdNET-Pi/HUMAN.txt', 'a') as rfile:
|
||||
with open(userDir + '/BirdNET-Pi/HUMAN.txt', 'a') as rfile:
|
||||
rfile.write(str(datetime.datetime.now())+str(p_sorted[i])+ '\n')
|
||||
# date_stamp=datetime.datetime.now().strftime("%d_%m_%y_%H:%M:%S")
|
||||
#
|
||||
@@ -258,8 +261,8 @@ def handle_client(conn, addr):
|
||||
|
||||
args = type('', (), {})()
|
||||
|
||||
args.i = '/home/*/test.wav'
|
||||
args.o = '/home/*/test.wav.csv'
|
||||
args.i = ''
|
||||
args.o = ''
|
||||
args.birdweather_id = '99999'
|
||||
args.include_list = 'null'
|
||||
args.exclude_list = 'null'
|
||||
@@ -354,7 +357,7 @@ def handle_client(conn, addr):
|
||||
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
|
||||
|
||||
|
||||
with open('/home/*/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
||||
with open(userDir + '/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) ):
|
||||
@@ -380,7 +383,7 @@ def handle_client(conn, addr):
|
||||
|
||||
#Connect to SQLite Database
|
||||
try:
|
||||
con = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
|
||||
con = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db')
|
||||
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))
|
||||
|
||||
|
||||
+16
-11
@@ -1,3 +1,4 @@
|
||||
#!/home/patrick/BirdNET-Pi/birdnet/bin/python3
|
||||
import socket
|
||||
import threading
|
||||
import os
|
||||
@@ -43,7 +44,8 @@ except:
|
||||
|
||||
|
||||
# Open most recent Configuration and grab DB_PWD as a python variable
|
||||
with open('/home/*/BirdNET-Pi/thisrun.txt', 'r') as f:
|
||||
userDir = os.path.expanduser('~')
|
||||
with open(userDir + '/BirdNET-Pi/scripts/thisrun.txt', 'r') as f:
|
||||
this_run = f.readlines()
|
||||
audiofmt = "." + str(str(str([i for i in this_run if i.startswith('AUDIOFMT')]).split('=')[1]).split('\\')[0])
|
||||
|
||||
@@ -58,7 +60,8 @@ def loadModel():
|
||||
print('LOADING TF LITE MODEL...', end=' ')
|
||||
|
||||
# Load TFLite model and allocate tensors.
|
||||
myinterpreter = tflite.Interpreter(model_path='/home/*/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite',num_threads=2)
|
||||
modelpath = userDir + '/BirdNET-Pi/model/BirdNET_6K_GLOBAL_MODEL.tflite'
|
||||
myinterpreter = tflite.Interpreter(model_path=modelpath,num_threads=1)
|
||||
myinterpreter.allocate_tensors()
|
||||
|
||||
# Get input and output tensors.
|
||||
@@ -72,7 +75,8 @@ def loadModel():
|
||||
|
||||
# Load labels
|
||||
CLASSES = []
|
||||
with open('/home/*/BirdNET-Pi/model/labels.txt', 'r') as lfile:
|
||||
labelspath = userDir + '/BirdNET-Pi/model/labels.txt'
|
||||
with open(labelspath, 'r') as lfile:
|
||||
for line in lfile.readlines():
|
||||
CLASSES.append(line.replace('\n', ''))
|
||||
|
||||
@@ -232,8 +236,8 @@ def handle_client(conn, addr):
|
||||
|
||||
args = type('', (), {})()
|
||||
|
||||
args.i = '/home/*/test.wav'
|
||||
args.o = '/home/*/test.wav.csv'
|
||||
args.i = ''
|
||||
args.o = ''
|
||||
args.birdweather_id = '99999'
|
||||
args.include_list = 'null'
|
||||
args.exclude_list = 'null'
|
||||
@@ -328,7 +332,7 @@ def handle_client(conn, addr):
|
||||
myReturn += str(i) + '-' + str(detections[i][0]) + '\n'
|
||||
|
||||
|
||||
with open('/home/*/BirdNET-Pi/BirdDB.txt', 'a') as rfile:
|
||||
with open(userDir + '/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) ):
|
||||
@@ -353,16 +357,17 @@ def handle_client(conn, addr):
|
||||
Date.replace("/", "-") + '-birdnet-' + Time + audiofmt
|
||||
|
||||
#Connect to SQLite Database
|
||||
try:
|
||||
con = sqlite3.connect('/home/*/BirdNET-Pi/scripts/birds.db')
|
||||
#try:
|
||||
con = sqlite3.connect(userDir + '/BirdNET-Pi/scripts/birds.db')
|
||||
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))
|
||||
|
||||
con.commit()
|
||||
con.close()
|
||||
except:
|
||||
print("Database busy")
|
||||
time.sleep(2)
|
||||
#except:
|
||||
# print("Database busy")
|
||||
# time.sleep(2)
|
||||
|
||||
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) + Com_Name.replace(" ", "_") + '-' + str(score) + '-' + str(current_date) + '-birdnet-' + str(current_time) + audiofmt + '\n')
|
||||
|
||||
if birdweather_id != "99999":
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
if (file_exists('/home/*/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/*/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/*/BirdNET-Pi/firstrun.ini');
|
||||
if (file_exists('thisrun.txt')) {
|
||||
$config = parse_ini_file('thisrun.txt');
|
||||
} elseif (file_exists('firstrun.ini')) {
|
||||
$config = parse_ini_file('firstrun.ini');
|
||||
}
|
||||
$refresh = $config['RECORDING_LENGTH'];
|
||||
$time = time();
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
source /etc/birdnet/birdnet.conf
|
||||
analyzing_now="$(cat $HOME/BirdNET-Pi/analyzing_now.txt)"
|
||||
spectrogram_png=${EXTRACTED}/spectrogram.png
|
||||
sudo -u $USER sox "${analyzing_now}" -n remix 1 rate 24k spectrogram -c "${analyzing_now}" -o "${spectrogram_png}"
|
||||
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);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
if($db == False) {
|
||||
echo "Database busy";
|
||||
header("refresh: 0;");
|
||||
|
||||
@@ -13,6 +13,6 @@
|
||||
<button type="submit" name="submit" value="sudo shutdown now" onclick="return confirm('Are you sure you want to shutdown?')">Shutdown</button>
|
||||
</form>
|
||||
<form action="" method="POST">
|
||||
<button type="submit" name="submit" value="sudo -upi clear_all_data.sh" onclick="return confirm('Clear ALL Data? This cannot be undone.')">Clear ALL data</button>
|
||||
<button type="submit" name="submit" value="sudo clear_all_data.sh" onclick="return confirm('Clear ALL Data? This cannot be undone.')">Clear ALL data</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$db = new SQLite3('/home/*/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||
if($db == False){
|
||||
echo "Database is busy";
|
||||
header("refresh: 0;");
|
||||
|
||||
Reference in New Issue
Block a user