Skip to content

A live bird collage card for your Home Assistant dashboard.

fixed the streamer mess

mcguirepr89decf49e37cc1
diff --git a/homepage/index.php b/homepage/index.php
index e498aa7f..4b264677 100644
--- a/homepage/index.php
+++ b/homepage/index.php
@@ -7,30 +7,31 @@
<?php
if(isset($_GET['stream'])){
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
- $config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
-} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
- $config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
-}
-$caddypwd = $config['CADDY_PWD'];
-if (!isset($_SERVER['PHP_AUTH_USER'])) {
- header('WWW-Authenticate: Basic realm="My Realm"');
- header('HTTP/1.0 401 Unauthorized');
- echo 'You cannot listen to the live audio stream';
- exit;
-} else {
- $submittedpwd = $_SERVER['PHP_AUTH_PW'];
- $submitteduser = $_SERVER['PHP_AUTH_USER'];
- if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){
- echo "
- <audio controls autoplay><source src=\"/stream\"></audio>
- <h1><a href=\"\">BirdNET-Pi</a></h1>";
- } else {
+ $config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
+ } elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
+ $config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
+ }
+ $caddypwd = $config['CADDY_PWD'];
+ if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'You cannot listen to the live audio stream';
exit;
+ } else {
+ $submittedpwd = $_SERVER['PHP_AUTH_PW'];
+ $submitteduser = $_SERVER['PHP_AUTH_USER'];
+ if($submittedpwd == $caddypwd && $submitteduser == 'birdnet'){
+ echo "
+ <audio controls autoplay><source src=\"/stream\"></audio>
+ <h1><a href=\"\">BirdNET-Pi</a></h1>
+ </div>";
+ } else {
+ header('WWW-Authenticate: Basic realm="My Realm"');
+ header('HTTP/1.0 401 Unauthorized');
+ echo 'You cannot listen to the live audio stream';
+ exit;
+ }
}
-}
} else {
echo "
<form action=\"\" method=\"GET\">
@@ -63,6 +64,7 @@ if(isset($_GET['log'])) {
} elseif(isset($_GET['spectrogram'])){
header("Location: /spectrogram.php");
} else {
- echo "
-<iframe src=\"/views.php\">";
+ echo "
+<iframe src=\"/views.php\">
+</div>";
}
diff --git a/homepage/style.css b/homepage/style.css
index 75ebee60..dabe886c 100644
--- a/homepage/style.css
+++ b/homepage/style.css
@@ -9,6 +9,10 @@ a {
text-decoration: none;
}
+a:hover {
+ font-weight: bold;
+}
+
h3 {
text-align: center;
}
diff --git a/scripts/overview.php b/scripts/overview.php
index 60f140ce..dbcac9c9 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -56,21 +56,11 @@ if($statement5 == False) {
$result5 = $statement5->execute();
$speciestally = $result5->fetchArray(SQLITE3_ASSOC);
?>
-
-<!DOCTYPE html>
-<html lang="en">
-
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Overview</title>
-<style>
-button, a, form {
-padding: 0;
-}
-</style>
</head>
-<body>
<div class="overview">
<table>
<tr>
@@ -99,10 +89,9 @@ padding: 0;
<button type="submit" name="species" value="<?php echo $mostrecent['Com_Name'];?>"><?php echo $mostrecent['Com_Name'];?>: </button>
<a href="https://wikipedia.org/wiki/<?php echo $sciname;?>" target="_blank"/><i><?php echo $mostrecent['Sci_Name'];?></i></a><br>Confidence: <?php echo $mostrecent['Confidence'];?><br>
<?php echo $mostrecent['Date']." ".$mostrecent['Time'];?><br><video controls poster="<?php echo $filename.".png";?>"><source src="<?php echo $filename;?>"></video></td>
-
+ </form>
</tr>
</table>
- </form>
<?php
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
echo "<img class=\"centered\" src=\"/Charts/$chart?nocache=time()\">";