+prepare("SELECT * FROM detections where Com_Name == \"$name\" AND Date == \"$date\" ORDER BY Time DESC");
+ if(isset($_GET['sort']) && $_GET['sort'] == "confidence") {
+ $statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" AND Date == \"$date\" ORDER BY Confidence DESC");
+ } else {
+ $statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" AND Date == \"$date\" ORDER BY Time DESC");
+ }
} else {
- $statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" ORDER BY Date DESC, Time DESC");}
+ if(isset($_GET['sort']) && $_GET['sort'] == "confidence") {
+ $statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" ORDER BY Confidence DESC");
+ } else {
+ $statement2 = $db->prepare("SELECT * FROM detections where Com_Name == \"$name\" ORDER BY Date DESC, Time DESC");
+ }
+ }
if($statement2 == False){
echo "Database is busy";
header("refresh: 0;");
@@ -167,6 +190,9 @@ if(isset($_GET['species'])){
$name
";
+ $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
+ $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
+ $home = trim($home);
while($results=$result2->fetchArray(SQLITE3_ASSOC))
{
$comname = preg_replace('/ /', '_', $results['Com_Name']);
@@ -176,7 +202,13 @@ if(isset($_GET['species'])){
$sciname = preg_replace('/ /', '_', $results['Sci_Name']);
$sci_name = $results['Sci_Name'];
$time = $results['Time'];
- $confidence = round($results['Confidence'],2);
+ $confidence = $results['Confidence'];
+
+ // file was deleted by disk check, no need to show the detection in recordings
+ if(!file_exists($home."/BirdSongs/Extracted/".$filename)) {
+ continue;
+ }
+
echo "