Skip to content

A live bird collage card for your Home Assistant dashboard.

Update stats.php

ehpersonal38bd7fee901246
diff --git a/scripts/stats.php b/scripts/stats.php
index 39871877..329aa7dc 100644
--- a/scripts/stats.php
+++ b/scripts/stats.php
@@ -56,8 +56,9 @@ if(isset($_GET['species'])){
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
$home = trim($home);
-if(!file_exists($home."/BirdNET-Pi/scripts/disk_check_exclude.txt")) {
- file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "##start\n##end");
+if(!file_exists($home."/BirdNET-Pi/scripts/disk_check_exclude.txt") || strpos(file_get_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt"),"##start") === false) {
+ file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "");
+ file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "##start\n##end\n");
}
?>