Skip to content

A live bird collage card for your Home Assistant dashboard.

new ui

mcguirepr89cf0a3436f770
diff --git a/scripts/advanced.php b/scripts/advanced.php
index 8252746c..892fead7 100644
--- a/scripts/advanced.php
+++ b/scripts/advanced.php
@@ -155,93 +155,6 @@ if(isset($_POST['submit'])) {
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
-/* Chrome, Safari, Edge, Opera */
-input::-webkit-outer-spin-button,
-input::-webkit-inner-spin-button {
- -webkit-appearance: none;
- margin: 0;
-}
-
-/* Firefox */
-input[type=number] {
- -moz-appearance: textfield;
-}
-* {
- font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
- ' Calibri', 'Trebuchet MS', 'sans-serif';
- box-sizing: border-box;
-}
-/* Create two unequal columns that floats next to each other */
-.column {
- float: left;
- padding: 10px;
-}
-.first {
- width: calc(50% - 70px);
-}
-.second {
- width: calc(50% - 70px);
-}
-.
-/* Clear floats after the columns */
-.row:after {
- content: "";
- display: table;
- clear: both;
-}
-body {
- background-color: rgb(119, 196, 135);
-}
-a {
- font-size:large;
- text-decoration: none;
-}
-.block {
- display: block;
- width:50%;
- border: none;
- padding: 10px 10px;
- font-size: medium;
- cursor: pointer;
- text-align: center;
-}
-
-form {
- text-align:left;
- margin-left:20px;
-}
-h2 {
- margin-bottom:0px;
-}
-h3 {
- margin-left: -10px;
- text-align:left;
-}
-label {
- float:left;
- width: 40%;
- font-weight:bold;
-}
-input,select {
- width: 60%;
- text-align:center;
- font-size:large;
-}
-@media screen and (max-width: 1000px) {
- h2,h3 {
- text-align:center;
- }
- form {
- margin:0;
- }
- .column {
- float: none;
- width: 100%;
- }
- input, label {
- width: 100%;
- {
-}
</style>
</head>
<?php
@@ -252,20 +165,20 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
}
?>
<h2>Advanced Settings</h2>
- <body style="background-color: rgb(119, 196, 135);">
+ <body>
<div class="row">
<div class="column first">
<form action="advanced.php" method="POST">
<h3>Defaults</h3>
<label>Full Disk Behavior: </label>
- <label style="width:30%;" for="purge">
- <input style="width:15%;" name="full_disk" type="radio" id="purge" value="purge"
+ <label for="purge">
+ <input name="full_disk" type="radio" id="purge" value="purge"
<?php
if (strcmp($newconfig['FULL_DISK'], "purge") == 0) {
echo "checked";
}?>>Purge</label>
- <label style="width:30%;" for="keep">
- <input style="width:15%" name="full_disk" type="radio" id="keep" value="keep"
+ <label for="keep">
+ <input name="full_disk" type="radio" id="keep" value="keep"
<?php
if (strcmp($newconfig['FULL_DISK'], "keep") == 0) {
echo "checked";
@@ -334,11 +247,11 @@ if(isset($_SESSION['success'])){
?></button>
<br>
</form>
- <form action="config.php" style="margin:0;">
+ <form action="config.php">
<button type="submit" class="block">Basic Settings</button>
</form>
<br>
- <form action="index.html" style="margin:0;">
+ <form action="index.html">
<button type="submit" class="block">Tools</button>
</form>
</div>
diff --git a/scripts/config.php b/scripts/config.php
index 421b5c99..8bc9a39d 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -6,111 +6,10 @@ ini_set('display_errors',1);
?>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
-/* Chrome, Safari, Edge, Opera */
-input::-webkit-outer-spin-button,
-input::-webkit-inner-spin-button {
- -webkit-appearance: none;
- margin: 0;
-}
-
-/* Firefox */
-input[type=number] {
- -moz-appearance: textfield;
-}
-* {
- font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
- ' Calibri', 'Trebuchet MS', 'sans-serif';
- box-sizing: border-box;
-}
-/* Create two unequal columns that floats next to each other */
-.column {
- float: left;
- padding: 10px;
-}
-.first {
- width: calc(50% - 70px);
-}
-.second {
- width: calc(50% - 30px);
-}
-.
-/* Clear floats after the columns */
-.row:after {
- content: "";
- display: table;
- clear: both;
-}
-body {
- background-color: rgb(119, 196, 135);
-}
-a {
- text-decoration: none;
-}
-.block {
- display: block;
- width:50%;
- border: none;
- padding: 10px 10px;
- font-size: medium;
- cursor: pointer;
- text-align: center;
-}
-
-select {
- font-size:large;
- width: 60%;
-}
-
-select option {
- font-size:large;
-}
-
-form {
- text-align:left;
- margin-left:20px;
-}
-
-h2 {
- margin-bottom:0px;
-}
-h3 {
- margin-left: -10px;
- text-align:left;
-}
-label {
- float:left;
- width:40%;
- font-weight:bold;
-}
-input {
- width:60%;
- text-align:center;
- font-size:large;
-}
-@media screen and (max-width: 800px) {
- select {
- width:100%;
- }
- h2 {
- margin-bottom:0px;
- text-align:center;
- }
- form {
- text-align:left;
- margin-left:0px;
- }
- .column {
- float: none;
- width: 100%;
- }
- input, label {
- width:100%;
- {
-}
</style>
</head>
<h2>Basic Settings</h2>
- <body style="background-color: rgb(119, 196, 135);">
+ <body>
<div class="row">
<div class="column first">
<form action="write_config.php" method="POST" name="normal">
diff --git a/scripts/history.php b/scripts/history.php
index c8e0237c..71f9b447 100644
--- a/scripts/history.php
+++ b/scripts/history.php
@@ -21,42 +21,16 @@ $totalcount = $result1->fetchArray(SQLITE3_ASSOC);
?>
<head>
-<link rel="stylesheet" href="style.css">
<style>
-input {
- width:auto;
-}
-center {
- display: block;
- margin-left: auto;
- margin-right: auto;
- width: 100%;
-}
-body {
- background-color: rgb(119, 196, 135);
-}
-button,input {
- font-size: medium;
-}
-table,th,td {
- background-color: rgb(219, 255, 235);
-}
-table {
- width:30%;
-}
-hr {
- border: 1px solid green;
- width:80%;
-}
</style>
</head>
<body>
-<form style="margin-left: -150px;text-align:center;" action="" name="submit" method="POST">
+<form action="" method="POST">
<input type="date" name="date" value="<?php echo $theDate;?>">
- <button type="submit" class="block">Submit Date</button>
+ <button type="submit" name="view" value="History">Submit Date</button>
</form>
-<div style="margin-left: -150px;">
+<div>
<table>
<tr>
<th>Total Detections For The Day</th>
@@ -67,14 +41,14 @@ hr {
<?php
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
- echo "<img src=\"/Charts/$chart?nocache=time()\" style=\"height:auto;width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
+ echo "<img src=\"/Charts/$chart?nocache=time()\" >";
} else {
- echo "<p style=\"text-align:center;margin-left:-150px;\">No Charts for $theDate</p>";
+ echo "<p>No Charts for $theDate</p>";
}
echo "<hr>";
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart2)) {
- echo "<img src=\"/Charts/$chart2?nocache=time()\" style=\"height:auto;width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
+ echo "<img src=\"/Charts/$chart2?nocache=time()\">";
} else {
- echo "<p style=\"text-align:center;margin-left:-150px;\">No Charts For $theDate</p>";
+ echo "<p>No Charts For $theDate</p>";
}?>
</html>
diff --git a/scripts/install_services.sh b/scripts/install_services.sh
index 07277172..211a6a1d 100755
--- a/scripts/install_services.sh
+++ b/scripts/install_services.sh
@@ -17,7 +17,7 @@ install_depends() {
apt -qqq update && apt -qqy upgrade
echo "icecast2 icecast2/icecast-setup boolean false" | debconf-set-selections
apt install -qqy caddy lynx ftpd sqlite3 php-sqlite3 alsa-utils \
- pulseaudio avahi-utils sox libsox-fmt-mp3 php php-fpm php-mysql php-xml \
+ pulseaudio avahi-utils sox libsox-fmt-mp3 php php-fpm php-curl php-xml \
php-zip icecast2 swig ffmpeg wget unzip curl cmake make bc libjpeg-dev \
zlib1g-dev python3-dev python3-pip python3-venv
wget -c ${gotty_url} -O - | tar -xz -C /usr/local/bin/
diff --git a/scripts/overview.php b/scripts/overview.php
index edbc53fe..d95a8a8a 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -20,7 +20,7 @@ if($statement == False) {
$result = $statement->execute();
$totalcount = $result->fetchArray(SQLITE3_ASSOC);
-$statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\')');
+$statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\', \'localtime\')');
if($statement2 == False) {
echo "Database is busy";
header("refresh: 0;");
@@ -44,9 +44,10 @@ if($statement4 == False) {
$result4 = $statement4->execute();
$mostrecent = $result4->fetchArray(SQLITE3_ASSOC);
$comname = preg_replace('/ /', '_', $mostrecent['Com_Name']);
-$scilink = preg_replace('/ /', '_', $mostrecent['Sci_Name']);
+$comname = preg_replace('/\'/', '', $comname);
+$filename = "/By_Date/".$mostrecent['Date']."/".$comname."/".$mostrecent['File_Name'];
-$statement5 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections WHERE Date == Date(\'now\')');
+$statement5 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections WHERE Date == Date(\'now\',\'localtime\')');
if($statement5 == False) {
echo "Database is busy";
header("refresh: 0;");
@@ -62,48 +63,13 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Overview</title>
- <!-- CSS FOR STYLING THE PAGE -->
-<link rel="stylesheet" href="style.css">
-
-
<style>
-a {
- text-decoration: none;
- color:black;
-}
-table, th {
- background-color: rgb(119, 196, 135);
- border:none;
-}
-th {
- padding: 0 5px;
-}
-button {
- background-color: rgb(219, 295, 235);
- border:none;
- font-size:large;
- cursor:pointer;
-}
-.center {
- display: block;
- margin-left: 5px;
- margin-right: 5px;
- width: 90%;
- padding: 5px;
-}
-.center2 {
- display: block;
- margin-left: 5px;
- margin-right: 5px;
- width: 100%;
- padding: 5px;
-}
</style>
</head>
-<body style="background-color: rgb(119, 196, 135);">
+<body>
<div>
</div>
- <table style="padding-bottom:3%;display:block;width:50%;margin-left:auto;margin-right:auto;">
+ <table>
<tr>
<th>Total</th>
<th>Today</th>
@@ -120,31 +86,31 @@ button {
</div>
<div>
- <table style="padding-bottom:3%;display:block;width:90%;margin-left:auto;margin-right:auto;">
+ <table>
<tr>
- <th style="border:none;background-color: rgb(119, 196, 135);"></th>
- <th style="border:none;">Scientific Name</th>
- <th style="border:none;">Common Name</th>
- <th style="border:none;">Listen</th>
- <th style="border:none;">Confidence</th>
+ <th</th>
+ <th>Scientific Name</th>
+ <th>Common Name</th>
+ <th>Listen</th>
+ <th>Confidence</th>
</tr>
<tr>
<th>Most Recent Detection</th>
<td><a href="https://wikipedia.org/wiki/<?php echo $scilink;?>" target="top"/><?php echo $mostrecent['Sci_Name'];?></a></td>
- <form action="/stats.php" name="species" method="POST">
- <td><button type="submit" name="species" value="<?php echo $mostrecent['Com_Name'];?>"><?php echo $mostrecent['Com_Name'];?></button></td></form>
- <td><a href="/By_Date/<?php echo$myDate."/".$comname."/".$mostrecent['File_Name'];?>" target="footer"/><?php echo $mostrecent['Date']." ".$mostrecent['Time'];?></a></td>
+ <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><?php echo $mostrecent['Date']." ".$mostrecent['Time'];?><br><audio controls><source src="<?php echo $filename;?>"></audio></td>
<td><?php echo $mostrecent['Confidence'];?></td>
</tr>
</table>
</div>
<?php
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
- echo "<img src=\"/Charts/$chart?nocache=time()\" style=\"width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
+ echo "<img src=\"/Charts/$chart?nocache=time()\">";
} else {
- echo "<p style=\"text-align:center;margin-left:-150px;\">No Detections For Today</p>";
+ echo "<p>No Detections For Today</p>";
}
?>
<h2>Currently Analyzing</h2>
-<img src='/spectrogram.png?nocache=<?php echo time();?>' style="width: 100%;padding: 5px;">
+<img src='/spectrogram.png?nocache=<?php echo time();?>' >
</html>
diff --git a/scripts/play.php b/scripts/play.php
index 0cddd5bc..4f50b30d 100644
--- a/scripts/play.php
+++ b/scripts/play.php
@@ -53,13 +53,12 @@ if(isset($_POST['bydate'])){
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="play.css">
<style>
</style>
</head>
<body>
<div class="column left">
-<table style="float:top;">
+<table>
<?php
if(!isset($_POST['species'])){
while($results=$result->fetchArray(SQLITE3_ASSOC))
diff --git a/scripts/spectrogram.php b/scripts/spectrogram.php
index 9f2ca184..248b9f9f 100644
--- a/scripts/spectrogram.php
+++ b/scripts/spectrogram.php
@@ -7,5 +7,5 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
$refreshtime = $config['RECORDING_LENGTH'];
header("refresh:$refreshtime");
?>
-<body style='background-color:rgb(119, 196, 135)'>
-<img src='/spectrogram.png?nocache=<?php echo time();?>' style='display: block; height: 100%; width: 100%;'>
+<body>
+<img src='/spectrogram.png?nocache=<?php echo time();?>'>
diff --git a/scripts/stats.php b/scripts/stats.php
index 3b102ee3..c534dafa 100644
--- a/scripts/stats.php
+++ b/scripts/stats.php
@@ -8,25 +8,16 @@ if($db == False) {
echo "Database busy";
header("refresh: 0;");
}
-$statement = $db->prepare('SELECT Com_Name, COUNT(*), MAX(Confidence), Sci_Name FROM detections GROUP BY Com_Name ORDER BY COUNT(*) DESC');
+$statement = $db->prepare('SELECT Date, Time, File_Name, Com_Name, COUNT(*), MAX(Confidence) FROM detections GROUP BY Com_Name ORDER BY COUNT(*) DESC');
if($statement == False) {
echo "Database busy";
header("refresh: 0;");
}
$result = $statement->execute();
-
-$statement2 = $db->prepare('SELECT Com_Name FROM detections GROUP BY Com_Name ORDER BY Com_Name ASC');
-if($statement2 == False) {
- echo "Database busy";
- header("refresh: 0;");
-}
-$result2 = $statement2->execute();
-
if(isset($_POST['species'])){
$selection = $_POST['species'];
- $statement3 = $db->prepare("SELECT Com_Name, Sci_Name, COUNT(*), MAX(Confidence), File_Name, Date from detections
- WHERE Com_Name = \"$selection\"");
+ $statement3 = $db->prepare("SELECT Com_Name, Sci_Name, COUNT(*), MAX(Confidence), File_Name, Date, Time from detections WHERE Com_Name = \"$selection\"");
if($statement3 == False) {
echo "Database busy";
header("refresh: 0;");
@@ -35,142 +26,46 @@ if(isset($_POST['species'])){
}
?>
-<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BirdNET-Pi DB</title>
- <link rel="stylesheet" href="style.css">
<style>
-/* Chrome, Safari, Edge, Opera */
-input::-webkit-outer-spin-button,
-input::-webkit-inner-spin-button {
- -webkit-appearance: none;
- margin: 0;
-}
-
-/* Firefox */
-input[type=number] {
- -moz-appearance: textfield;
-}
-* {
- font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
- ' Calibri', 'Trebuchet MS', 'sans-serif';
- box-sizing: border-box;
-}
-/* Create two unequal columns that floats next to each other */
-.column {
- float: left;
- padding: 10px;
-}
-.first {
- width: calc(50% - 70px);
-}
-.second {
- width: calc(50% + 70px);
-}
-.
-/* Clear floats after the columns */
-.row:after {
- content: "";
- display: table;
- clear: both;
-}
-body {
- background-color: rgb(119, 196, 135);
-}
-a {
- color:black;
- text-decoration: none;
-}
-.block {
- display: block;
- width:40%;
- margin-left:auto;
- border: none;
- padding: 5px 5px;
- font-size: medium;
- cursor: pointer;
- text-align: center;
-}
-
-button {
- background-color: rgb(219, 295, 235);
- border:none;
- font-size:large;
- cursor:pointer;
-}
-
-img {
- width:75%;
-}
-
-.center {
- display: block;
- margin-left: auto;
- margin-right: auto;
-}
-
-select option {
- font-size:large;
-}
-
-select {
- float:left;
- display:block;
- margin-right:auto;
- font-size:large;
- width: 50%;
-}
-
-@media screen and (max-width: 800px) {
- h3 {
- margin-bottom:0px;
- text-align:center;
- }
- form {
- text-align:left;
- margin-left:0px;
- width:100%;
- }
- .column {
- float: none;
- width: 100%;
- }
- input, label, img {
- width:100%;
- {
-}
</style>
</head>
-<body style="background-color: rgb(119, 196, 135);">
+<body>
<section>
<div class="row">
<div class="column first">
<?php if(!isset($_POST['species'])){
- echo "<p style=\"text-align:center;font-size:large;\">Choose a species below to show statistics.</p>";
+ echo "<p>Choose a species below to show statistics.</p>";
};?>
<table>
<tr>
<th>Common Name</th>
<th>Occurrences</th>
<th>Max Confidence Score</th>
+ <th>Best Recording</th>
</tr>
<?php
while($results=$result->fetchArray(SQLITE3_ASSOC))
{
$comname = preg_replace('/ /', '_', $results['Com_Name']);
-$comlink = "/By_Date/".date('Y-m-d')."/".$comname;
-$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
+$comname = preg_replace('/\'/', '', $comname);
+$filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
?>
<tr>
- <form action="stats.php" method="POST">
- <td><button type="submit" name="species" value="<?php echo $results['Com_Name'];?>"><?php echo $results['Com_Name'];?></button></td></form>
+ <form action="" method="POST">
+ <td><input type="hidden" name="view" value="Species Stats">
+ <button type="submit" name="species" value="<?php echo $results['Com_Name'];?>"><?php echo $results['Com_Name'];?></button>
+ </td>
+ </form>
<td><?php echo $results['COUNT(*)'];?></td>
<td><?php echo $results['MAX(Confidence)'];?></td>
+ <td><audio controls><source src="<?php echo $filename;?>"></audio></td>
</tr>
<?php
}
@@ -198,20 +93,20 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){
$count = $results['COUNT(*)'];
$maxconf = $results['MAX(Confidence)'];
$date = $results['Date'];
+ $time = $results['Time'];
$name = $results['Com_Name'];
$sciname = $results['Sci_Name'];
- $dbname = preg_replace('/ /', '_', $results['Com_Name']);
- $dbname = preg_replace('/\'/', '', $dbname);
- $dbsciname = preg_replace('/ /', '_', $results['Sci_Name']);
- $filename = "/By_Date/".$date."/".$dbname."/".$results['File_Name'];
+ $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= "<tr>
<td><a href=\"https://wikipedia.org/wiki/$dbsciname\" target=\"top\"/>$sciname</a></td>
<td>$count</td>
<td>$maxconf</td>
- <td><a href=\"$filename\" target=\"footer\">Listen</a></td>
- <td><a href=\"https://allaboutbirds.org/guide/$dbname\" target=\"top\"/>All About Birds</a></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>
</tr>
</table>";
echo str_pad($str, 4096);
diff --git a/scripts/viewdb.php b/scripts/viewdb.php
index 3bd7238f..567acc9c 100644
--- a/scripts/viewdb.php
+++ b/scripts/viewdb.php
@@ -11,7 +11,7 @@ if($db == False){
header("refresh: 0;");
}
-$statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\') ORDER BY Time DESC');
+$statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC');
if($statement0 == False){
echo "Database is busy";
header("refresh: 0;");
@@ -26,7 +26,7 @@ if($statement1 == False){
$result1 = $statement1->execute();
$totalcount = $result1->fetchArray(SQLITE3_ASSOC);
-$statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\')');
+$statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\', \'localtime\')');
if($statement2 == False){
echo "Database is busy";
header("refresh: 0;");
@@ -67,21 +67,13 @@ $speciestally = $result5->fetchArray(SQLITE3_ASSOC);
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>BirdNET-Pi DB</title>
- <link rel="stylesheet" href="style.css">
<style>
-a {
- text-decoration:none;
- color:black;
-}
-.a2 { color:blue;}
</style>
</head>
-<body style="background-color: rgb(119, 196, 135);">
+<body>
<section>
<h2>Number of Detections</h2>
-<div class="row">
- <div class="column2">
<table>
<tr>
<th>Total</th>
@@ -96,8 +88,6 @@ a {
<td><a href="/stats.php"/><?php echo $speciestally['COUNT(DISTINCT(Com_Name))'];?></a></td>
</tr>
</table>
-</div>
-</div>
<h2>Today's Detections</h2>
<table>
<tr>