A live bird collage card for your Home Assistant dashboard.
Prevent disk_check from erasing our "Best Recordings"
ehpersonal38732f33d93324
diff --git a/scripts/disk_check.sh b/scripts/disk_check.shindex 8fb7973a..585a3916 100755--- a/scripts/disk_check.sh+++ b/scripts/disk_check.sh@@ -7,8 +7,22 @@ if [ "${used//%}" -ge 95 ]; thencase $FULL_DISK inpurge) echo "Removing oldest data"- rm -drfv "$(find ${EXTRACTED}/By_Date/* -maxdepth 1 -type d -prune \- | sort -r | tail -n1)";;+ cd ${EXTRACTED}/By_Date/++ iter=0+ for i in */*/*; do+ if [ $iter -ge 250 ]; then+ break+ fi+ if ! grep -qxFe "$i" $HOME/BirdNET-Pi/scripts/disk_check_exclude.txt; then+ rm "$i"+ fi+ ((iter++))+ done+ find ${EXTRACTED}/By_Date/ -empty -type d -delete;;++ #rm -drfv "$(find ${EXTRACTED}/By_Date/* -maxdepth 1 -type d -prune \+ # | sort -r | tail -n1)";;keep) echo "Stopping Core Services"/usr/local/bin/stop_core_services.sh;;esacdiff --git a/scripts/stats.php b/scripts/stats.phpindex d5462196..230a54ac 100644--- a/scripts/stats.php+++ b/scripts/stats.php@@ -52,6 +52,11 @@ if(isset($_GET['species'])){}$result3 = $statement3->execute();}++$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");+$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");+$home = trim($home);+file_put_contents($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "");?><html lang="en">@@ -157,6 +162,10 @@ while($results=$result->fetchArray(SQLITE3_ASSOC))$comname = preg_replace('/ /', '_', $results['Com_Name']);$comname = preg_replace('/\'/', '', $comname);$filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];++$excludefile = fopen($home."/BirdNET-Pi/scripts/disk_check_exclude.txt", "a") or die("Unable to open file!");+$txt = $results['Date']."/".$comname."/".$results['File_Name']."\n".$results['Date']."/".$comname."/".$results['File_Name'].".png\n";+fwrite($excludefile, $txt);?><tr><form action="" method="GET">@@ -174,5 +183,4 @@ $filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];</div></div></body>-</html>-+</html>\ No newline at end of file