A live bird collage card for your Home Assistant dashboard.
better search results
ehpersonal38787c5d65a980
diff --git a/scripts/overview.php b/scripts/overview.phpindex f8479dac..49c0ccb0 100644--- a/scripts/overview.php+++ b/scripts/overview.php@@ -52,7 +52,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isseif($key !== false) {$image = $images[$key];} else {- $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=".$comname."&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance&per_page=5&orientation=square,portrait&format=json&nojsoncallback=1"), true)["photos"]["photo"][0];+ $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=".str_replace("_", "%20", $comname)."&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance&per_page=5&orientation=square,portrait&format=json&media=photos&nojsoncallback=1"), true)["photos"]["photo"][0];$modaltext = "https://flickr.com/photos/".$flickrjson["owner"]."/".$flickrjson["id"];$authorlink = "https://flickr.com/people/".$flickrjson["owner"];$imageurl = 'http://farm' .$flickrjson["farm"]. '.static.flickr.com/' .$flickrjson["server"]. '/' .$flickrjson["id"]. '_' .$flickrjson["secret"]. '.jpg';diff --git a/scripts/play.php b/scripts/play.phpindex 370f53fc..aca95748 100644--- a/scripts/play.php+++ b/scripts/play.php@@ -260,7 +260,7 @@ if(isset($_GET['species'])){ ?>$sciname = preg_replace('/ /', '_', $results['Sci_Name']);$sci_name = $results['Sci_Name'];$time = $results['Time'];- $confidence = $results['Confidence'];+ $confidence = round((float)round($results['Confidence'],2) * 100 ) . '%';$filename_formatted = $date."/".$comname."/".$results['File_Name'];// file was deleted by disk check, no need to show the detection in recordings@@ -316,7 +316,7 @@ if(isset($_GET['filename'])){$sciname = preg_replace('/ /', '_', $results['Sci_Name']);$sci_name = $results['Sci_Name'];$time = $results['Time'];- $confidence = $results['Confidence'];+ $confidence = round((float)round($results['Confidence'],2) * 100 ) . '%';$filename_formatted = $date."/".$comname."/".$results['File_Name'];// add disk_check_exclude.txt lines into an array for greppingdiff --git a/scripts/stats.php b/scripts/stats.phpindex 65d532b2..cfa2c478 100644--- a/scripts/stats.php+++ b/scripts/stats.php@@ -150,7 +150,7 @@ function setModalText(iter, title, text, authorlink) {$iter=0;while($results=$result3->fetchArray(SQLITE3_ASSOC)){$count = $results['COUNT(*)'];- $maxconf = round($results['MAX(Confidence)'],2);+ $maxconf = round((float)round($results['MAX(Confidence)'],2) * 100 ) . '%';$date = $results['Date'];$time = $results['Time'];$name = $results['Com_Name'];@@ -206,7 +206,7 @@ array_push($excludelines, $results['Date']."/".$comname."/".$results['File_Name'<input type="hidden" name="sort" value="<?php if(isset($_GET['sort'])){echo $_GET['sort'];}?>"><td class="relative"><a target="_blank" href="index.php?filename=<?php echo $results['File_Name']; ?>"><img class="copyimage" width=25 src="images/copy.png"></a><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><br><b>Occurrences:</b> <?php echo $results['COUNT(*)'];?><br>- <b>Max Confidence:</b> <?php echo round($results['MAX(Confidence)'],2);?><br>+ <b>Max Confidence:</b> <?php echo $percent = round((float)round($results['Confidence'],2) * 100 ) . '%';?><br><b>Best Recording:</b> <?php echo $results['Date']." ".$results['Time'];?><br><video onplay='setLiveStreamVolume(0)' onended='setLiveStreamVolume(1)' onpause='setLiveStreamVolume(1)' controls poster="<?php echo $filename.".png";?>" preload="none" title="<?php echo $filename;?>"><source src="<?php echo $filename;?>" type="audio/mp3"></video></td></tr><?phpdiff --git a/scripts/todays_detections.php b/scripts/todays_detections.phpindex 18ee509f..caa3a62e 100644--- a/scripts/todays_detections.php+++ b/scripts/todays_detections.php@@ -101,7 +101,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) {if($key !== false) {$image = $images[$key];} else {- $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=".$comname."&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance&per_page=5&orientation=square,portrait&format=json&nojsoncallback=1"), true)["photos"]["photo"][0];+ $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=".str_replace("_", "%20", $comname)."&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance&per_page=5&orientation=square,portrait&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"][0];$modaltext = "https://flickr.com/photos/".$flickrjson["owner"]."/".$flickrjson["id"];$authorlink = "https://flickr.com/people/".$flickrjson["owner"];$imageurl = 'http://farm' .$flickrjson["farm"]. '.static.flickr.com/' .$flickrjson["server"]. '/' .$flickrjson["id"]. '_' .$flickrjson["secret"]. '.jpg';