A live bird collage card for your Home Assistant dashboard.
silence update indicator
ehpersonal38e19c7c6ba38c
diff --git a/homepage/style.css b/homepage/style.cssindex db0266f2..4b6fe595 100644--- a/homepage/style.css+++ b/homepage/style.css@@ -790,3 +790,7 @@ pre.bash {width: 100%;display: inline-block;}++#toolsbtn {+ min-width: max-content;+}\ No newline at end of filediff --git a/homepage/views.php b/homepage/views.phpindex dd75f001..aada46e3 100644--- a/homepage/views.php+++ b/homepage/views.php@@ -16,6 +16,12 @@ if(!isset($_SESSION['behind'])) {}</style><?php }}++if (file_exists('./scripts/thisrun.txt')) {+ $config = parse_ini_file('./scripts/thisrun.txt');+} elseif (file_exists('./scripts/firstrun.ini')) {+ $config = parse_ini_file('./scripts/firstrun.ini');+}?><link rel="stylesheet" href="style.css?v=6.22.22"><style>@@ -49,8 +55,8 @@ body::-webkit-scrollbar {<form action="" method="GET" id="views"><button type="submit" name="view" value="View Log" form="views">View Log</button></form>-<form action="" method="GET" id="views">- <button type="submit" name="view" value="Tools" form="views">Tools<?php if(isset($_SESSION['behind']) && intval($_SESSION['behind']) >= 50){ $updatediv = ' <div class="updatenumber">'.$_SESSION["behind"].'</div>'; } else { $updatediv = ""; } echo $updatediv; ?></button>+<form action="" id="toolsbtn" method="GET" id="views">+ <button type="submit" name="view" value="Tools" form="views">Tools<?php if(isset($_SESSION['behind']) && intval($_SESSION['behind']) >= 50 && ($config['SILENCE_UPDATE_INDICATOR'] != 1)){ $updatediv = ' <div class="updatenumber">'.$_SESSION["behind"].'</div>'; } else { $updatediv = ""; } echo $updatediv; ?></button></form><button href="javascript:void(0);" class="icon" onclick="myFunction()"><img src="images/menu.png"></button></div>@@ -93,11 +99,6 @@ if(isset($_GET['view'])){if($_GET['view'] == "Streamlit"){echo "<iframe src=\"/stats\"></iframe>";}if($_GET['view'] == "Daily Charts"){include('history.php');}if($_GET['view'] == "Tools"){- if (file_exists('./scripts/thisrun.txt')) {- $config = parse_ini_file('./scripts/thisrun.txt');- } elseif (file_exists('./scripts/firstrun.ini')) {- $config = parse_ini_file('./scripts/firstrun.ini');- }$caddypwd = $config['CADDY_PWD'];if (!isset($_SERVER['PHP_AUTH_USER'])) {header('WWW-Authenticate: Basic realm="My Realm"');diff --git a/scripts/advanced.php b/scripts/advanced.phpindex ebe7c33f..17e5eeda 100644--- a/scripts/advanced.php+++ b/scripts/advanced.php@@ -157,6 +157,16 @@ if(isset($_GET['submit'])) {$contents2 = preg_replace("/AUDIOFMT=.*/", "AUDIOFMT=$audiofmt", $contents2);}}+ if(isset($_GET["silence_update_indicator"])) {+ $silence_update_indicator = 1;+ if(strcmp($silence_update_indicator,$config['SILENCE_UPDATE_INDICATOR']) !== 0) {+ $contents = preg_replace("/SILENCE_UPDATE_INDICATOR=.*/", "SILENCE_UPDATE_INDICATOR=$silence_update_indicator", $contents);+ $contents2 = preg_replace("/SILENCE_UPDATE_INDICATOR=.*/", "SILENCE_UPDATE_INDICATOR=$silence_update_indicator", $contents2);+ }+ } else {+ $contents = preg_replace("/SILENCE_UPDATE_INDICATOR=.*/", "SILENCE_UPDATE_INDICATOR=0", $contents);+ $contents2 = preg_replace("/SILENCE_UPDATE_INDICATOR=.*/", "SILENCE_UPDATE_INDICATOR=0", $contents2);+ }$fh = fopen('/etc/birdnet/birdnet.conf', "w");$fh2 = fopen("./scripts/thisrun.txt", "w");@@ -250,7 +260,8 @@ foreach($formats as $format){<label for="sensitivity">Sigmoid Sensitivity: </label><input name="sensitivity" type="number" min="0.5" max="1.5" step="0.01" value="<?php print($newconfig['SENSITIVITY']);?>" required/><br><p>Min=0.5, Max=1.5</p>- <br><br>+ <label for="silence_update_indicator">Silence Update Indicator: </label>+ <input type="checkbox" name="silence_update_indicator" <?php if($newconfig['SILENCE_UPDATE_INDICATOR'] == 1) { echo "checked"; };?> ><br><br><br><input type="hidden" name="view" value="Advanced"><button onclick="if(<?php print($newconfig['PRIVACY_THRESHOLD']);?> != document.getElementById('privacy_threshold').value){return confirm('This will take about 90 seconds.')}" type="submit" name="submit" value="advanced"><?phpdiff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.shindex 1f616007..85ce5c1e 100755--- a/scripts/update_birdnet_snippets.sh+++ b/scripts/update_birdnet_snippets.sh@@ -98,6 +98,10 @@ if [[ "$pytest_installation_status" = "not installed" ]];then$HOME/BirdNET-Pi/birdnet/bin/pip3 install pytest==7.1.2 pytest-mock==3.7.0fi+if ! grep SILENCE_UPDATE_INDICATOR /etc/birdnet/birdnet.conf &>/dev/null;then+ sudo -u$USER echo "SILENCE_UPDATE_INDICATOR=0" >> /etc/birdnet/birdnet.conf+fi+sudo systemctl daemon-reloadrestart_services.sh