Skip to content

A live bird collage card for your Home Assistant dashboard.

Add RARE_SPECIES_THRESHOLD

Alexandredfd6199b1ce9
diff --git a/scripts/advanced.php b/scripts/advanced.php
index 765016cb..fd484d49 100644
--- a/scripts/advanced.php
+++ b/scripts/advanced.php
@@ -196,6 +196,15 @@ if (isset($_GET["max_files_species"])) {
$contents = preg_replace("/RAW_SPECTROGRAM=.*/", "RAW_SPECTROGRAM=0", $contents);
}
+ if(isset($_GET["rare_species_threshold"])) {
+ $rare_species_threshold = $_GET["rare_species_threshold"];
+ if(strcmp($rare_species_threshold, $config['RARE_SPECIES_THRESHOLD']) !== 0) {
+ $contents = preg_replace("/RARE_SPECIES_THRESHOLD=.*/", "RARE_SPECIES_THRESHOLD=$rare_species_threshold", $contents);
+ }
+ } else {
+ $contents = preg_replace("/RARE_SPECIES_THRESHOLD=.*/", "RARE_SPECIES_THRESHOLD=30", $contents);
+ }
+
if(isset($_GET["custom_image"])) {
$custom_image = $_GET["custom_image"];
if(strcmp($custom_image,$config['CUSTOM_IMAGE']) !== 0) {
@@ -434,6 +443,10 @@ foreach($formats as $format){
<label for="raw_spectrogram">Minimalist Spectrograms: </label>
<input type="checkbox" name="raw_spectrogram" <?php if($newconfig['RAW_SPECTROGRAM'] == 1) { echo "checked"; };?> ><br>
<p>This allows you to remove the axes and labels of the spectrograms that are generated by Sox for each detection for a cleaner appearance.</p>
+
+ <label for="rare_species_threshold">Rare Species Threshold (days): </label>
+ <input type="number" name="rare_species_threshold" min="1" value="<?php echo isset($newconfig['RARE_SPECIES_THRESHOLD']) ? $newconfig['RARE_SPECIES_THRESHOLD'] : 30; ?>"><br>
+ <p>This setting defines after how many days since last detection a species is considered rare. Default is 30 days.</p>
</td></tr></table><br>
<table class="settingstable"><tr><td>