diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh
index dbf0e81..acc0a47 100755
--- a/scripts/birdnet_analysis.sh
+++ b/scripts/birdnet_analysis.sh
@@ -166,9 +166,9 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
- --include_list "${INCLUDE_LIST}"
+ --include_list "${INCLUDE_LIST}"
elif [ -f ${1}/${i} ] && [ ! -f ${INCLUDE_LIST} ] && [ -f ${EXCLUDE_LIST} ] && [ -z $BIRDWEATHER_ID ];then
echo "analyze.py \
--i "${1}/${i}" \
@@ -187,9 +187,9 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
- --exclude_list "${EXCLUDE_LIST}"
+ --exclude_list "${EXCLUDE_LIST}"
elif [ -f ${1}/${i} ] && [ -f ${INCLUDE_LIST} ] && [ -f ${EXCLUDE_LIST} ] && [ -z $BIRDWEATHER_ID ];then
echo "analyze.py \
--i "${1}/${i}" \
@@ -209,7 +209,7 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
--include_list "${INCLUDE_LIST}" \
--exclude_list "${EXCLUDE_LIST}"
@@ -231,7 +231,7 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
--birdweather_id "${BIRDWEATHER_ID}"
elif [ -f ${1}/${i} ] && [ -f ${INCLUDE_LIST} ] && [ ! -f ${EXCLUDE_LIST} ] && [ ! -z $BIRDWEATHER_ID ];then
@@ -253,7 +253,7 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
--include_list "${INCLUDE_LIST}" \
--birdweather_id "${BIRDWEATHER_ID}"
@@ -276,7 +276,7 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
--exclude_list "${EXCLUDE_LIST}" \
--birdweather_id "${BIRDWEATHER_ID}"
@@ -300,7 +300,7 @@ run_analysis() {
--lon "${LONGITUDE}" \
--week "${WEEK}" \
--overlap "${OVERLAP}" \
- --sensitivity "${SENSITIVITY}" \
+ --sensitivity "${SENSITIVITY}" \
--min_conf "${CONFIDENCE}" \
--include_list "${INCLUDE_LIST}" \
--exclude_list "${EXCLUDE_LIST}" \
diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.sh
index 7c8498c..1eba83b 100755
--- a/scripts/clear_all_data.sh
+++ b/scripts/clear_all_data.sh
@@ -60,6 +60,7 @@ sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/overview.php ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/stats.php ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewdb.php ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/history.php ${EXTRACTED}
+sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/play.php ${EXTRACTED}
sudo -u ${USER} ln -fs $(dirname ${my_dir})/homepage/images/favicon.ico ${EXTRACTED}
sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
diff --git a/scripts/config.php b/scripts/config.php
index 8bc9a39..4b950fe 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -12,7 +12,7 @@ ini_set('display_errors',1);
diff --git a/scripts/overview.php b/scripts/overview.php
index d95a8a8..e67161b 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -28,7 +28,7 @@ if($statement2 == False) {
$result2 = $statement2->execute();
$todaycount = $result2->fetchArray(SQLITE3_ASSOC);
-$statement3 = $db->prepare('SELECT COUNT(*) FROM detections WHERE TIME >= TIME(\'now\', \'localtime\', \'-1 hour\')');
+$statement3 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == Date(\'now\', \'localtime\') AND TIME >= TIME(\'now\', \'localtime\', \'-1 hour\')');
if($statement3 == False) {
echo "Database is busy";
header("refresh: 0;");
@@ -78,9 +78,13 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
- |
+
|
- |
+
@@ -88,19 +92,23 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
- |
- | Scientific Name |
- Common Name |
- Listen |
- Confidence |
+ Most Recent Detection |
+ Scientific Name |
+ Common Name |
+ Listen |
+ Confidence |
- | Most Recent Detection |
- |
+ ".$mostrecent['Time'];?> |
+ |
-
|
- |
+
+
+
+ |
+
+ |
+ |
@@ -108,7 +116,7 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
echo "
";
} else {
- echo "No Detections For Today
";
+ echo "No Detections For Today
";
}
?>
Currently Analyzing
diff --git a/scripts/play.php b/scripts/play.php
index 4f50b30..10239b9 100644
--- a/scripts/play.php
+++ b/scripts/play.php
@@ -10,24 +10,16 @@ if($db == False){
}
if(isset($_POST['bydate'])){
- $statement = $db->prepare('SELECT DISTINCT(Date), Com_Name from detections GROUP BY Date');
+ $statement = $db->prepare('SELECT DISTINCT(Date), Com_Name FROM detections GROUP BY Date');
if($statement == False){
echo "Database is busy";
header("refresh: 0;");
}
$result = $statement->execute();
$view = "bydate";
-} elseif(isset($_POST['byspecies'])) {
- $statement = $db->prepare('SELECT DISTINCT(Com_Name) from detections ORDER BY Com_Name');
- if($statement == False){
- echo "Database is busy";
- header("refresh: 0;");
- }
- $result = $statement->execute();
- $view = "byspecies";
} elseif(isset($_POST['date'])) {
$date = $_POST['date'];
- $statement = $db->prepare("SELECT DISTINCT(Com_Name) from detections WHERE Date == \"$date\" ORDER BY Com_Name");
+ $statement = $db->prepare("SELECT DISTINCT(Com_Name) FROM detections WHERE Date == \"$date\" ORDER BY Com_Name");
if($statement == False){
echo "Database is busy";
header("refresh: 0;");
@@ -36,8 +28,8 @@ if(isset($_POST['bydate'])){
$view = "date";
} elseif(isset($_POST['species'])) {
$species = $_POST['species'];
- $statement = $db->prepare("SELECT * from detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
- $statement3 = $db->prepare("SELECT Date, Time, Com_Name, MAX(Confidence), File_Name from detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
+ $statement = $db->prepare("SELECT * FROM detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
+ $statement3 = $db->prepare("SELECT Date, Time, Com_Name, MAX(Confidence), File_Name FROM detections WHERE Com_Name == \"$species\" ORDER BY Com_Name");
if($statement == False || $statement3 == False){
echo "Database is busy";
header("refresh: 0;");
@@ -45,8 +37,15 @@ if(isset($_POST['bydate'])){
$result = $statement->execute();
$result3 = $statement3->execute();
$view = "species";
+} else {
+ $statement = $db->prepare('SELECT DISTINCT(Com_Name) FROM detections ORDER BY Com_Name');
+ if($statement == False){
+ echo "Database is busy";
+ header("refresh: 0;");
+ }
+ $result = $statement->execute();
+ $view = "byspecies";
}
-
?>
@@ -57,7 +56,6 @@ if(isset($_POST['bydate'])){
-
fetchArray(SQLITE3_ASSOC))
-
-
fetchArray(SQLITE3_ASSOC))
$result2 = $statement2->execute();
echo "
- | Date |
- Time |
+ When |
+ Listen |
Scientific Name |
Common Name |
Confidence |
@@ -119,24 +120,23 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))
while($results=$result2->fetchArray(SQLITE3_ASSOC))
{
$comname = preg_replace('/ /', '_', $results['Com_Name']);
+ $comname = preg_replace('/\'/', '', $comname);
$date = $results['Date'];
- $comlink = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
+ $filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
$sci_name = $results['Sci_Name'];
$time = $results['Time'];
$confidence = $results['Confidence'];
echo "
- | $date |
- $time |
+ $date $time |
+ |
$sci_name |
-
";
}echo "
";}?>
-
-
diff --git a/scripts/restart_services.sh b/scripts/restart_services.sh
index 4752661..cb5384b 100755
--- a/scripts/restart_services.sh
+++ b/scripts/restart_services.sh
@@ -23,6 +23,6 @@ sudo systemctl restart "${i}"
done
until grep 5050 <(netstat -tulpn 2>&1);do
sudo systemctl restart birdnet_server.service
-sleep 30
+sleep 45
done
sudo systemctl restart birdnet_analysis.service
diff --git a/scripts/server.py b/scripts/server.py
index 3916582..5ca5064 100755
--- a/scripts/server.py
+++ b/scripts/server.py
@@ -349,6 +349,7 @@ def handle_client(conn, addr):
Week = str(args.week)
Sens = str(args.sensitivity)
Overlap = str(args.overlap)
+ Com_Name = Com_Name.replate("'", "")
File_Name = Com_Name.replace(" ", "_") + '-' + Confidence + '-' + \
Date.replace("/", "-") + '-birdnet-' + Time + audiofmt
diff --git a/scripts/spectrogram.php b/scripts/spectrogram.php
index 248b9f9..cc324bf 100644
--- a/scripts/spectrogram.php
+++ b/scripts/spectrogram.php
@@ -1,11 +1,4 @@
";
?>
-
-
diff --git a/scripts/stats.php b/scripts/stats.php
index c534daf..98989b6 100644
--- a/scripts/stats.php
+++ b/scripts/stats.php
@@ -76,7 +76,6 @@ $filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
$species = $_POST['species'];
$str = "
$species
-
Species Stats
| Scientific Name |
@@ -96,27 +95,29 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){
$time = $results['Time'];
$name = $results['Com_Name'];
$sciname = $results['Sci_Name'];
+ $dbsciname = preg_replace('/ /', '_', $sciname);
$comname = preg_replace('/ /', '_', $results['Com_Name']);
$comname = preg_replace('/\'/', '', $comname);
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbsciname");
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbsciname");
- $str= "
+ echo str_pad("
| $sciname |
$count |
$maxconf |
$date $time |
All About Birds |
-
";
- echo str_pad($str, 4096);
+ ", '4096');
ob_flush();
flush();
- echo "

+ echo str_pad("
$imagecitation
-";
+", '4096');
+ ob_flush();
+ flush();
}}
?>
diff --git a/scripts/viewdb.php b/scripts/viewdb.php
index 567acc9..05e5126 100644
--- a/scripts/viewdb.php
+++ b/scripts/viewdb.php
@@ -3,8 +3,6 @@ ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
-header("refresh: 30;");
-
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
if($db == False){
echo "Database is busy";
@@ -34,7 +32,7 @@ if($statement2 == False){
$result2 = $statement2->execute();
$todaycount = $result2->fetchArray(SQLITE3_ASSOC);
-$statement3 = $db->prepare('SELECT COUNT(*) FROM detections WHERE TIME >= TIME(\'now\', \'localtime\', \'-1 hour\')');
+$statement3 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == Date(\'now\', \'localtime\') AND TIME >= TIME(\'now\', \'localtime\', \'-1 hour\')');
if($statement3 == False){
echo "Database is busy";
header("refresh: 0;");
@@ -83,15 +81,20 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
- |
+
|
- |
+
Today's Detections
| Time |
+ Listen |
Scientific Name |
Common Name |
Confidence |
@@ -100,11 +103,13 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
while($todaytable=$result0->fetchArray(SQLITE3_ASSOC))
{
$comname = preg_replace('/ /', '_', $todaytable['Com_Name']);
-$comlink = "/By_Date/".date('Y-m-d')."/".$comname."/".$todaytable['File_Name'];
+$comname = preg_replace('/\'/', '_', $comname);
+$filename = "/By_Date/".date('Y-m-d')."/".$comname."/".$todaytable['File_Name'];
$sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']);
?>
- |
+ |
+ |
|
|
|
diff --git a/scripts/write_config.php b/scripts/write_config.php
index f423cd5..ed5aa19 100644
--- a/scripts/write_config.php
+++ b/scripts/write_config.php
@@ -26,25 +26,11 @@ $fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
fwrite($fh, $contents);
fwrite($fh2, $contents2);
-session_start();
-$_SESSION['success'] = 1;
-if(isset($_POST["normal"])){
- header('Location:config.php');
-}else{
- header('Location:../../');
-}
$language = $_POST["language"];
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_output = `$command`;
-session_start();
-$_SESSION['success'] = 1;
-if(isset($_POST["normal"])){
- header('Location:config.php');
-}else{
- header('Location:../../');
-}
}
?>