Feat : limit the number of audio files to keep per species (#121)

* New disk usage settings

* Use sudo for rm, just in case

* Remove set -x

* Correct code for png

* Correct today

* Correct dates

* Accepts date format of different distributions

* Avoid message

* Very significant processing time optimisation

* Update disk_species_clean.sh

* Avoid locking database

* Update disk_species_clean.sh

* Disable set -x (again)

* Add number of remaining files

* Add new variables to update_birdnet_snippets.sh

* Consolidate disk management elements

* Update disk_species_clean.sh

* Update disk_species_clean.sh

* Protect last 7 days

* Add options to advanced.php, in same style

* Remove from config

* Update config.php

* Reset max_disk_usage to hard 95

* Improve layout

* Remove automatic addition of MAX_FILE_SPECIES if not defined https://github.com/alexbelgium/hassio-addons/issues/1458

* Cosmetic white-listed changed to whitelist

* Add comma in text

* Update scripts/advanced.php

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>

* Update crontab if less than 5 #birdnet occurence (= all scripts not installed)

* Made .sh file executable

* Remove unused field k5 (second field of year) ; add explanations

* Call functions without ()

* Uninstall current cron before reinstalling them

* Update update_birdnet_snippets.sh

* Use $HOME instead of $mydir

---------

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>
This commit is contained in:
Alexandre
2024-07-12 18:18:27 +02:00
committed by GitHub
parent 20c392b145
commit b77f579e35
7 changed files with 122 additions and 9 deletions
+17 -1
View File
@@ -130,6 +130,13 @@ if(isset($_GET['submit'])) {
}
}
if (isset($_GET["max_files_species"])) {
$max_files_species = $_GET["max_files_species"];
if (strcmp($max_files_species, $config['MAX_FILES_SPECIES']) !== 0) {
$contents = preg_replace("/MAX_FILES_SPECIES=.*/", "MAX_FILES_SPECIES=$max_files_species", $contents);
}
}
if(isset($_GET["privacy_threshold"])) {
$privacy_threshold = $_GET["privacy_threshold"];
if(strcmp($privacy_threshold,$config['PRIVACY_THRESHOLD']) !== 0) {
@@ -274,12 +281,21 @@ $newconfig = get_config();
</td></tr></table><br>
<table class="settingstable"><tr><td>
<h2>Full Disk Behaviour</h2>
<h2>Disk Management</h2>
<label for="purge">
<input name="full_disk" type="radio" id="purge" value="purge" <?php if (strcmp($newconfig['FULL_DISK'], "purge") == 0) { echo "checked"; }?>>Purge</label>
<label for="keep">
<input name="full_disk" type="radio" id="keep" value="keep" <?php if (strcmp($newconfig['FULL_DISK'], "keep") == 0) { echo "checked"; }?>>Keep</label>
<p>When the disk becomes full, you can choose to 'purge' old files to make room for new ones or 'keep' your data and stop all services instead.<br>Note: you can exclude specific files from 'purge' on the Recordings page.</p>
<br>
<label for="max_files_species">Amount of files to keep for each specie :</label>
<input name="max_files_species" type="number" style="width:6em;" min="0" step="1" value="<?php print($newconfig['MAX_FILES_SPECIES']);?>"/>
</td></tr><tr><td>
If different than 0 (keep all), defines the maximum number of files to be kept for each species, with priority give to files with highest confidence.
This value does not take into account the last 7 days (protected by default).
</td></tr><tr><td>
Note only the spectrogram and audio files are deleted, the obsevation data remains in the database.
The files protected through the "lock" icon are also not affected.
</td></tr></table><br>
<table class="settingstable"><tr><td>