saving changes
This commit is contained in:
@@ -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/stats.php ${EXTRACTED}
|
||||||
sudo -u ${USER} ln -fs $(dirname ${my_dir})/scripts/viewdb.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/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 $(dirname ${my_dir})/homepage/images/favicon.ico ${EXTRACTED}
|
||||||
sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
|
sudo -u ${USER} ln -fs ${HOME}/phpsysinfo ${EXTRACTED}
|
||||||
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
|
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phpsysinfo/
|
||||||
|
|||||||
+5
-9
@@ -12,7 +12,7 @@ ini_set('display_errors',1);
|
|||||||
<body>
|
<body>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="column first">
|
<div class="column first">
|
||||||
<form action="write_config.php" method="POST" name="normal">
|
<form action="" method="POST">
|
||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
||||||
@@ -66,20 +66,16 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
|||||||
<option value="labels_uk.txt">Ukrainian</option>
|
<option value="labels_uk.txt">Ukrainian</option>
|
||||||
</select>
|
</select>
|
||||||
<br><br>
|
<br><br>
|
||||||
<button type="submit" name="normal" class="block"><?php
|
<button type="submit" name="view" value="Settings"><?php
|
||||||
if(isset($_SESSION['success'])){
|
if(isset($_POST['status'])){
|
||||||
echo "Success!";
|
echo "Success!";
|
||||||
unset($_SESSION['success']);
|
|
||||||
} else {
|
} else {
|
||||||
echo "Update Settings";
|
echo "Update Settings";
|
||||||
}
|
}
|
||||||
?></button>
|
?></button>
|
||||||
</form>
|
</form>
|
||||||
<form action="advanced.php" class="form2">
|
<form action="" method="POST">
|
||||||
<button type="submit" class="block">Advanced Settings</button>
|
<button type="submit" name="view" value="Advanced">Advanced Settings</button>
|
||||||
</form>
|
|
||||||
<form action="index.html" class="form2">
|
|
||||||
<button type="submit" class="block">Tools</button>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+15
-7
@@ -28,7 +28,7 @@ if($statement2 == False) {
|
|||||||
$result2 = $statement2->execute();
|
$result2 = $statement2->execute();
|
||||||
$todaycount = $result2->fetchArray(SQLITE3_ASSOC);
|
$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) {
|
if($statement3 == False) {
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
@@ -78,9 +78,13 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
||||||
<td><a href="/By_Date/<?php echo date('Y-m-d');?>"/><?php echo $todaycount['COUNT(*)'];?></a></td>
|
<form action="" method="POST">
|
||||||
|
<td><input type="hidden" name="view" value="Extractions"><button type="submit" name="date" value="<?php echo date('Y-m-d');?>"><?php echo $todaycount['COUNT(*)'];?></button></td>
|
||||||
|
</form>
|
||||||
<td><?php echo $hourcount['COUNT(*)'];?></td>
|
<td><?php echo $hourcount['COUNT(*)'];?></td>
|
||||||
<td><a href="/stats.php"/><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></a></td>
|
<form action="" method="POST">
|
||||||
|
<td><button type="submit" name="view" value="Species Stats"><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></button></td>
|
||||||
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -88,18 +92,22 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
|||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th</th>
|
<th>Most Recent Detection</th>
|
||||||
<th>Scientific Name</th>
|
<th>Scientific Name</th>
|
||||||
<th>Common Name</th>
|
<th>Common Name</th>
|
||||||
<th>Listen</th>
|
<th>Listen</th>
|
||||||
<th>Confidence</th>
|
<th>Confidence</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Most Recent Detection</th>
|
<td><?php echo $mostrecent['Date']."<br>".$mostrecent['Time'];?></td>
|
||||||
<td><a href="https://wikipedia.org/wiki/<?php echo $scilink;?>" target="top"/><?php echo $mostrecent['Sci_Name'];?></a></td>
|
<td><a href="https://wikipedia.org/wiki/<?php echo $scilink;?>" target="top"/><?php echo $mostrecent['Sci_Name'];?></a></td>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<td><input type="hidden" name="view" value="Species Stats"><button type="submit" name="species" value="<?php echo $mostrecent['Com_Name'];?>"><?php echo $mostrecent['Com_Name'];?></button></td></form>
|
<td>
|
||||||
<td><?php echo $mostrecent['Date']." ".$mostrecent['Time'];?><br><audio controls><source src="<?php echo $filename;?>"></audio></td>
|
<input type="hidden" name="view" value="Species Stats">
|
||||||
|
<button type="submit" name="species" value="<?php echo $mostrecent['Com_Name'];?>"><?php echo $mostrecent['Com_Name'];?></button>
|
||||||
|
</td>
|
||||||
|
</form>
|
||||||
|
<td><audio controls><source src="<?php echo $filename;?>"></audio></td>
|
||||||
<td><?php echo $mostrecent['Confidence'];?></td>
|
<td><?php echo $mostrecent['Confidence'];?></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
+27
-27
@@ -10,24 +10,16 @@ if($db == False){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_POST['bydate'])){
|
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){
|
if($statement == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
}
|
}
|
||||||
$result = $statement->execute();
|
$result = $statement->execute();
|
||||||
$view = "bydate";
|
$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'])) {
|
} elseif(isset($_POST['date'])) {
|
||||||
$date = $_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){
|
if($statement == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
@@ -36,8 +28,8 @@ if(isset($_POST['bydate'])){
|
|||||||
$view = "date";
|
$view = "date";
|
||||||
} elseif(isset($_POST['species'])) {
|
} elseif(isset($_POST['species'])) {
|
||||||
$species = $_POST['species'];
|
$species = $_POST['species'];
|
||||||
$statement = $db->prepare("SELECT * 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");
|
$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){
|
if($statement == False || $statement3 == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
@@ -45,8 +37,15 @@ if(isset($_POST['bydate'])){
|
|||||||
$result = $statement->execute();
|
$result = $statement->execute();
|
||||||
$result3 = $statement3->execute();
|
$result3 = $statement3->execute();
|
||||||
$view = "species";
|
$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";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
@@ -57,7 +56,6 @@ if(isset($_POST['bydate'])){
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="column left">
|
|
||||||
<table>
|
<table>
|
||||||
<?php
|
<?php
|
||||||
if(!isset($_POST['species'])){
|
if(!isset($_POST['species'])){
|
||||||
@@ -67,6 +65,7 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))
|
|||||||
<tr>
|
<tr>
|
||||||
<form action="" method="POST">
|
<form action="" method="POST">
|
||||||
<td>
|
<td>
|
||||||
|
<input type="hidden" name="view" value="Extractions">
|
||||||
<?php
|
<?php
|
||||||
if($view == "bydate"){
|
if($view == "bydate"){
|
||||||
$date = $results['Date'];
|
$date = $results['Date'];
|
||||||
@@ -82,23 +81,25 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))
|
|||||||
$maxconf = $results['MAX(Confidence)'];
|
$maxconf = $results['MAX(Confidence)'];
|
||||||
$date = $results['Date'];
|
$date = $results['Date'];
|
||||||
$time = $results['Time'];
|
$time = $results['Time'];
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
$name = $results['Com_Name'];
|
||||||
|
$comname = preg_replace('/ /', '_', $name);
|
||||||
|
$comname = preg_replace('/\'/', '', $comname);
|
||||||
$file = $results['File_Name'];
|
$file = $results['File_Name'];
|
||||||
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
||||||
echo "<table>
|
echo "<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>$name</th>
|
||||||
<th>Max Confidence: $maxconf</th>
|
<th>Max Confidence: $maxconf</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Most confident recording: <a href=\"$filename\" target=\"footer\">$file</a></td>
|
<th>Most confident recording: </th>
|
||||||
|
<td><audio controls><source src=\"$filename\"></audio></td>
|
||||||
</tr></table>";
|
</tr></table>";
|
||||||
};};?>
|
};};?>
|
||||||
</td>
|
</td>
|
||||||
</form>
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<div class="column right">
|
|
||||||
<?php
|
<?php
|
||||||
if(isset($_POST['species'])){
|
if(isset($_POST['species'])){
|
||||||
$name = $_POST['species'];
|
$name = $_POST['species'];
|
||||||
@@ -110,8 +111,8 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))
|
|||||||
$result2 = $statement2->execute();
|
$result2 = $statement2->execute();
|
||||||
echo "<table>
|
echo "<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Date</th>
|
<th>When</th>
|
||||||
<th>Time</th>
|
<th>Listen</th>
|
||||||
<th>Scientific Name</th>
|
<th>Scientific Name</th>
|
||||||
<th>Common Name</th>
|
<th>Common Name</th>
|
||||||
<th>Confidence</th>
|
<th>Confidence</th>
|
||||||
@@ -119,24 +120,23 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))
|
|||||||
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
while($results=$result2->fetchArray(SQLITE3_ASSOC))
|
||||||
{
|
{
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
|
$comname = preg_replace('/\'/', '', $comname);
|
||||||
$date = $results['Date'];
|
$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']);
|
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
|
||||||
$sci_name = $results['Sci_Name'];
|
$sci_name = $results['Sci_Name'];
|
||||||
$time = $results['Time'];
|
$time = $results['Time'];
|
||||||
$confidence = $results['Confidence'];
|
$confidence = $results['Confidence'];
|
||||||
echo "<tr>
|
echo "<tr>
|
||||||
<td>$date</td>
|
<td>$date $time</td>
|
||||||
<td><a href=\"$comlink\" target=\"footer\"/>$time</a></td>
|
<td><audio controls><source src=\"$filename\"></audio></td>
|
||||||
<td><a href=\"https://wikipedia.org/wiki/$sciname\" target=\"top\">$sci_name</a></td>
|
<td><a href=\"https://wikipedia.org/wiki/$sciname\" target=\"top\">$sci_name</a></td>
|
||||||
<form action=\"/stats.php\" method=\"POST\">
|
<form action=\"\" method=\"POST\">
|
||||||
<td><button type=\"submit\" name=\"species\" value=\"$name\">$name</button>
|
<td><input type=\"hidden\" name=\"view\" value=\"Species Stats\"><button type=\"submit\" name=\"species\" value=\"$name\">$name</button>
|
||||||
</form></td>
|
</form></td>
|
||||||
<td>$confidence</td>
|
<td>$confidence</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
}echo "</table>";}?>
|
}echo "</table>";}?>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -23,6 +23,6 @@ sudo systemctl restart "${i}"
|
|||||||
done
|
done
|
||||||
until grep 5050 <(netstat -tulpn 2>&1);do
|
until grep 5050 <(netstat -tulpn 2>&1);do
|
||||||
sudo systemctl restart birdnet_server.service
|
sudo systemctl restart birdnet_server.service
|
||||||
sleep 30
|
sleep 45
|
||||||
done
|
done
|
||||||
sudo systemctl restart birdnet_analysis.service
|
sudo systemctl restart birdnet_analysis.service
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ def handle_client(conn, addr):
|
|||||||
Week = str(args.week)
|
Week = str(args.week)
|
||||||
Sens = str(args.sensitivity)
|
Sens = str(args.sensitivity)
|
||||||
Overlap = str(args.overlap)
|
Overlap = str(args.overlap)
|
||||||
|
Com_Name = Com_Name.replate("'", "")
|
||||||
File_Name = Com_Name.replace(" ", "_") + '-' + Confidence + '-' + \
|
File_Name = Com_Name.replace(" ", "_") + '-' + Confidence + '-' + \
|
||||||
Date.replace("/", "-") + '-birdnet-' + Time + audiofmt
|
Date.replace("/", "-") + '-birdnet-' + Time + audiofmt
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
$time = time();
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
echo "<img src=\"/spectrogram.png?nocache=$time\">";
|
||||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
|
||||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
|
||||||
}
|
|
||||||
$refreshtime = $config['RECORDING_LENGTH'];
|
|
||||||
header("refresh:$refreshtime");
|
|
||||||
?>
|
?>
|
||||||
<body>
|
|
||||||
<img src='/spectrogram.png?nocache=<?php echo time();?>'>
|
|
||||||
|
|||||||
+7
-6
@@ -76,7 +76,6 @@ $filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
|
|||||||
$species = $_POST['species'];
|
$species = $_POST['species'];
|
||||||
$str = "<div class=\"column second\">
|
$str = "<div class=\"column second\">
|
||||||
<h3>$species</h3>
|
<h3>$species</h3>
|
||||||
<h3>Species Stats</h3>
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Scientific Name</th>
|
<th>Scientific Name</th>
|
||||||
@@ -96,27 +95,29 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){
|
|||||||
$time = $results['Time'];
|
$time = $results['Time'];
|
||||||
$name = $results['Com_Name'];
|
$name = $results['Com_Name'];
|
||||||
$sciname = $results['Sci_Name'];
|
$sciname = $results['Sci_Name'];
|
||||||
|
$dbsciname = preg_replace('/ /', '_', $sciname);
|
||||||
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
$comname = preg_replace('/ /', '_', $results['Com_Name']);
|
||||||
$comname = preg_replace('/\'/', '', $comname);
|
$comname = preg_replace('/\'/', '', $comname);
|
||||||
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
|
||||||
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbsciname");
|
$imagelink = shell_exec("/home/pi/BirdNET-Pi/scripts/get_image.sh $dbsciname");
|
||||||
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbsciname");
|
$imagecitation = shell_exec("/home/pi/BirdNET-Pi/scripts/get_citation.sh $dbsciname");
|
||||||
$str= "<tr>
|
echo str_pad("<tr>
|
||||||
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>$sciname</a></td>
|
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>$sciname</a></td>
|
||||||
<td>$count</td>
|
<td>$count</td>
|
||||||
<td>$maxconf</td>
|
<td>$maxconf</td>
|
||||||
<td>$date $time <audio controls><source src=\"$filename\"></audio></td>
|
<td>$date $time <audio controls><source src=\"$filename\"></audio></td>
|
||||||
<td><a href=\"https://allaboutbirds.org/guide/$comname\" target=\"top\"/>All About Birds</a></td>
|
<td><a href=\"https://allaboutbirds.org/guide/$comname\" target=\"top\"/>All About Birds</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>";
|
</table>", '4096');
|
||||||
echo str_pad($str, 4096);
|
|
||||||
ob_flush();
|
ob_flush();
|
||||||
flush();
|
flush();
|
||||||
echo "<img class=\"center\" src=\"$imagelink\">
|
echo str_pad("<img class=\"center\" src=\"$imagelink\">
|
||||||
<pre>$imagecitation</pre></td>
|
<pre>$imagecitation</pre></td>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>";
|
</div>", '4096');
|
||||||
|
ob_flush();
|
||||||
|
flush();
|
||||||
}}
|
}}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
+12
-7
@@ -3,8 +3,6 @@ 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);
|
||||||
|
|
||||||
header("refresh: 30;");
|
|
||||||
|
|
||||||
$db = new SQLite3('/home/pi/BirdNET-Pi/scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3('/home/pi/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";
|
||||||
@@ -34,7 +32,7 @@ if($statement2 == False){
|
|||||||
$result2 = $statement2->execute();
|
$result2 = $statement2->execute();
|
||||||
$todaycount = $result2->fetchArray(SQLITE3_ASSOC);
|
$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){
|
if($statement3 == False){
|
||||||
echo "Database is busy";
|
echo "Database is busy";
|
||||||
header("refresh: 0;");
|
header("refresh: 0;");
|
||||||
@@ -83,15 +81,20 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
<td><?php echo $totalcount['COUNT(*)'];?></td>
|
||||||
<td><a href="/By_Date/<?php echo date('Y-m-d');?>"/><?php echo $todaycount['COUNT(*)'];?></a></td>
|
<form action="" method="POST">
|
||||||
|
<td><input type="hidden" name="view" value="Extractions"><button type="submit" name="date" value="<?php echo date('Y-m-d');?>"><?php echo $todaycount['COUNT(*)'];?></button></td>
|
||||||
|
</form>
|
||||||
<td><?php echo $hourcount['COUNT(*)'];?></td>
|
<td><?php echo $hourcount['COUNT(*)'];?></td>
|
||||||
<td><a href="/stats.php"/><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></a></td>
|
<form action="" method="POST">
|
||||||
|
<td><button type="submit" name="view" value="Species Stats"><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></button></td>
|
||||||
|
</form>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h2>Today's Detections</h2>
|
<h2>Today's Detections</h2>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Time</th>
|
<th>Time</th>
|
||||||
|
<th>Listen</th>
|
||||||
<th>Scientific Name</th>
|
<th>Scientific Name</th>
|
||||||
<th>Common Name</th>
|
<th>Common Name</th>
|
||||||
<th>Confidence</th>
|
<th>Confidence</th>
|
||||||
@@ -100,11 +103,13 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
|
|||||||
while($todaytable=$result0->fetchArray(SQLITE3_ASSOC))
|
while($todaytable=$result0->fetchArray(SQLITE3_ASSOC))
|
||||||
{
|
{
|
||||||
$comname = preg_replace('/ /', '_', $todaytable['Com_Name']);
|
$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']);
|
$sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']);
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="<?php echo $comlink;?>" target="footer"/><?php echo $todaytable['Time'];?></a></td>
|
<td><?php echo $todaytable['Time'];?></td>
|
||||||
|
<td><audio controls><source src="<?php echo $filename;?>"></audio></td>
|
||||||
<td><a class="a2" href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="top"><?php echo $todaytable['Sci_Name'];?></a></td>
|
<td><a class="a2" href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="top"><?php echo $todaytable['Sci_Name'];?></a></td>
|
||||||
<td><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $comname;?>" target="top"><?php echo $todaytable['Com_Name'];?></a></td>
|
<td><a class="a2" href="https://allaboutbirds.org/guide/<?php echo $comname;?>" target="top"><?php echo $todaytable['Com_Name'];?></a></td>
|
||||||
<td><?php echo $todaytable['Confidence'];?></td>
|
<td><?php echo $todaytable['Confidence'];?></td>
|
||||||
|
|||||||
@@ -26,25 +26,11 @@ $fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
|||||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||||
fwrite($fh, $contents);
|
fwrite($fh, $contents);
|
||||||
fwrite($fh2, $contents2);
|
fwrite($fh2, $contents2);
|
||||||
session_start();
|
|
||||||
$_SESSION['success'] = 1;
|
|
||||||
if(isset($_POST["normal"])){
|
|
||||||
header('Location:config.php');
|
|
||||||
}else{
|
|
||||||
header('Location:../../');
|
|
||||||
}
|
|
||||||
|
|
||||||
$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/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`;
|
$command_output = `$command`;
|
||||||
session_start();
|
|
||||||
$_SESSION['success'] = 1;
|
|
||||||
if(isset($_POST["normal"])){
|
|
||||||
header('Location:config.php');
|
|
||||||
}else{
|
|
||||||
header('Location:../../');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user