From b2c80f0db76327b42eacb97b26cfdb80bd9ce6dd Mon Sep 17 00:00:00 2001
From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com>
Date: Sun, 17 Apr 2022 14:41:58 -0400
Subject: [PATCH] Adding links to recordings
This should add a link to all the recordings, so you can copy and share with a friend, or save somewhere.
There's better ways some of this can be done, but it works for now.
(please test this! not sure if I copied all the right files to git)
---
homepage/index.php | 8 +++++++
homepage/style.css | 11 +++++++++
scripts/overview.php | 6 ++---
scripts/play.php | 42 +++++++++++++++++++++++++++++++++--
scripts/stats.php | 24 ++++++++++----------
scripts/todays_detections.php | 7 +++---
6 files changed, 78 insertions(+), 20 deletions(-)
diff --git a/homepage/index.php b/homepage/index.php
index c989aa9..93dd966 100644
--- a/homepage/index.php
+++ b/homepage/index.php
@@ -54,6 +54,14 @@ if(isset($_GET['stream'])){
";
}
+if(isset($_GET['filename'])) {
+ $filename = $_GET['filename'];
+echo "
+
+";
+} else {
echo "
";
+}
+
diff --git a/homepage/style.css b/homepage/style.css
index 56403ae..5dd558c 100644
--- a/homepage/style.css
+++ b/homepage/style.css
@@ -494,3 +494,14 @@ button:hover {
display:none;
}
}
+
+.copyimage {
+ position:absolute;
+ top: 7px;
+ right: 7px;
+ width: 25px !important;
+ height: 25px !important;
+}
+.relative {
+ position:relative;
+}
\ No newline at end of file
diff --git a/scripts/overview.php b/scripts/overview.php
index 697491f..78ac7a6 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -96,14 +96,14 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse
Most Recent Detection:
-
-
+
+
+ " preload="none" title="">
prepare('SELECT DISTINCT(Date) FROM detections GROUP BY Date');
+ if($statement == False){
+ echo "Database is busy";
+ header("refresh: 0;");
+ }
+ $result = $statement->execute();
+ $view = "bydate";
+ #By Date
+}elseif(isset($_GET['bydate'])){
$statement = $db->prepare('SELECT DISTINCT(Date) FROM detections GROUP BY Date');
if($statement == False){
echo "Database is busy";
@@ -75,7 +84,7 @@ if(isset($_GET['bydate'])){
@@ -129,6 +138,35 @@ if(isset($_GET['species'])){
header("refresh: 0;");
}
$result2 = $statement2->execute();
+ echo "
+
+ $name
+ ";
+ while($results=$result2->fetchArray(SQLITE3_ASSOC))
+ {
+ $comname = preg_replace('/ /', '_', $results['Com_Name']);
+ $comname = preg_replace('/\'/', '', $comname);
+ $date = $results['Date'];
+ $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 $confidence
+
+ ";
+
+ }echo "
";}
+
+if(isset($_GET['filename'])){
+ $name = $_GET['filename'];
+ $statement2 = $db->prepare("SELECT * FROM detections where File_name == \"$name\" ORDER BY Date DESC, Time DESC");
+ if($statement2 == False){
+ echo "Database is busy";
+ header("refresh: 0;");
+ }
+ $result2 = $statement2->execute();
echo "
$name
diff --git a/scripts/stats.php b/scripts/stats.php
index deb6161..9a0724c 100644
--- a/scripts/stats.php
+++ b/scripts/stats.php
@@ -5,20 +5,20 @@ error_reporting(E_ALL);
$db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
if($db == False) {
- echo "Database busy";
- header("refresh: 0;");
+ echo "Database busy";
+ header("refresh: 0;");
}
$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;");
+ echo "Database busy";
+ header("refresh: 0;");
}
$result = $statement->execute();
$statement2 = $db->prepare('SELECT Date, Time, File_Name, Com_Name, COUNT(*), MAX(Confidence) FROM detections GROUP BY Com_Name ORDER BY Com_Name');
if($statement == False) {
- echo "Database busy";
- header("refresh: 0;");
+ echo "Database busy";
+ header("refresh: 0;");
}
$result2 = $statement2->execute();
@@ -28,8 +28,8 @@ if(isset($_GET['species'])){
$selection = $_GET['species'];
$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;");
+ echo "Database busy";
+ header("refresh: 0;");
}
$result3 = $statement3->execute();
}
@@ -89,8 +89,8 @@ while($results=$result3->fetchArray(SQLITE3_ASSOC)){
$linkname = preg_replace('/_/', '+', $dbsciname);
$filename = "/By_Date/".$date."/".$comname."/".$results['File_Name'];
echo str_pad("$species
-
- $sciname
+
+ $sciname
Occurrences: $count
Max Confidence: $maxconf
Best Recording: $date $time
@@ -122,9 +122,9 @@ $comname = preg_replace('/ /', '_', $results['Com_Name']);
$comname = preg_replace('/\'/', '', $comname);
$filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
?>
-
+