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:
@@ -94,6 +94,10 @@ if ! grep -E '^COLOR_SCHEME=' /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
echo "COLOR_SCHEME=\"light\"" >> /etc/birdnet/birdnet.conf
|
||||
fi
|
||||
|
||||
if ! grep -E '^MAX_FILES_SPECIES=' /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
echo "MAX_FILES_SPECIES=\"0\"" >> /etc/birdnet/birdnet.conf
|
||||
fi
|
||||
|
||||
[ -d $RECS_DIR/StreamData ] || sudo_with_user mkdir -p $RECS_DIR/StreamData
|
||||
[ -L ${EXTRACTED}/spectrogram.png ] || sudo_with_user ln -sf ${RECS_DIR}/StreamData/spectrogram.png ${EXTRACTED}/spectrogram.png
|
||||
|
||||
@@ -180,6 +184,13 @@ if [ -L /usr/local/bin/birdnet_analysis.sh ];then
|
||||
rm -f /usr/local/bin/birdnet_analysis.sh
|
||||
fi
|
||||
|
||||
# Clean state and update cron if all scripts are not installed
|
||||
if [ "$(grep -o "#birdnet" /etc/crontab | wc -l)" -lt 5 ]; then
|
||||
sudo sed -i '/birdnet/,+1d' /etc/crontab
|
||||
sed "s/\$USER/$USER/g" "$HOME"/BirdNET-Pi/templates/cleanup.cron >> /etc/crontab
|
||||
sed "s/\$USER/$USER/g" "$HOME"/BirdNET-Pi/templates/weekly_report.cron >> /etc/crontab
|
||||
fi
|
||||
|
||||
# update snippets above
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
Reference in New Issue
Block a user