diff --git a/scripts/advanced.php b/scripts/advanced.php index dab6339..48ac7bc 100644 --- a/scripts/advanced.php +++ b/scripts/advanced.php @@ -203,6 +203,15 @@ if (isset($_GET["max_files_species"])) { $contents = preg_replace("/SILENCE_UPDATE_INDICATOR=.*/", "SILENCE_UPDATE_INDICATOR=0", $contents); } + if(isset($_GET["automatic_update"])) { + $automatic_update = 1; + if(strcmp($automatic_update,$config['AUTOMATIC_UPDATE']) !== 0) { + $contents = preg_replace("/AUTOMATIC_UPDATE=.*/", "AUTOMATIC_UPDATE=$automatic_update", $contents); + } + } else { + $contents = preg_replace("/AUTOMATIC_UPDATE=.*/", "AUTOMATIC_UPDATE=0", $contents); + } + if(isset($_GET["raw_spectrogram"])) { $raw_spectrogram = 1; if(strcmp($RAW_SPECTROGRAM,$config['RAW_SPECTROGRAM']) !== 0) { @@ -454,19 +463,26 @@ foreach($formats as $format){

The BirdNET-Pi URL is how the main page will be reached. If you want your installation to respond to an IP address, place that here, but be sure to indicate "http://".
Example for IP: http://192.168.0.109
Example if you own your own domain: https://virginia.birdnetpi.com


+

Options

+ - >
-

This allows you to quiet the display of how many commits your installation is behind by relative to the Github repo. This number appears next to "Tools" when you're 50 or more commits behind.

- + > +

This allows you to quiet the display of how many commits your installation is behind by relative to the Github repo. This number appears next to "Tools" when you're 50 or more commits behind.


+ + + > +

This configures an automatic update of the installation each Sunday at 3:00 AM but the timing can be changed using crontab.


+ - >
-

This allows you to remove the axes and labels of the spectrograms that are generated by Sox for each detection for a cleaner appearance.

+ > +

This allows you to remove the axes and labels of the spectrograms that are generated by Sox for each detection for a cleaner appearance.


-
+

This setting defines after how many days since last detection a species is considered rare. Default is 30 days.

+

diff --git a/scripts/install_config.sh b/scripts/install_config.sh index 3c4a334..a80281a 100755 --- a/scripts/install_config.sh +++ b/scripts/install_config.sh @@ -265,6 +265,12 @@ HEARTBEAT_URL= SILENCE_UPDATE_INDICATOR=0 +## AUTOMATIC_UPDATE is for specifying that the installation is automatically +## updated from the Github repo. The update time is by default every Sunday at 3:00 AM +## but can be adjusted using crontab. + +AUTOMATIC_UPDATE=0 + ## RAW_SPECTROGRAM is for removing the axes and labels of the spectrograms ## that are generated by Sox for each detection for a cleaner appearance. diff --git a/scripts/install_services.sh b/scripts/install_services.sh index 458c568..38690a1 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -383,6 +383,10 @@ install_weekly_cron() { sed "s/\$USER/$USER/g" $my_dir/templates/weekly_report.cron >> /etc/crontab } +install_automatic_update_cron() { + sed "s/\$USER/$USER/g" $my_dir/templates/automatic_update.cron >> /etc/crontab +} + chown_things() { chown -R $USER:$USER $HOME/Bird* } @@ -418,6 +422,7 @@ install_services() { install_birdnet_mount install_cleanup_cron install_weekly_cron + install_automatic_update_cron increase_caddy_timeout create_necessary_dirs diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh index 937b888..a5878d3 100755 --- a/scripts/update_birdnet_snippets.sh +++ b/scripts/update_birdnet_snippets.sh @@ -114,6 +114,10 @@ if ! grep -E '^MAX_FILES_SPECIES=' /etc/birdnet/birdnet.conf &>/dev/null;then echo "MAX_FILES_SPECIES=\"0\"" >> /etc/birdnet/birdnet.conf fi +if ! grep -E '^AUTOMATIC_UPDATE=' /etc/birdnet/birdnet.conf &>/dev/null;then + echo "AUTOMATIC_UPDATE=0" >> /etc/birdnet/birdnet.conf +fi + if ! grep -E '^RARE_SPECIES_THRESHOLD=' /etc/birdnet/birdnet.conf &>/dev/null;then echo '## RARE_SPECIES_THRESHOLD defines after how many days a species is considered as rare and highlighted on overview page' >> /etc/birdnet/birdnet.conf echo "RARE_SPECIES_THRESHOLD=\"30\"" >> /etc/birdnet/birdnet.conf @@ -235,10 +239,11 @@ if [ -L /usr/local/bin/birdnet_analysis.sh ];then fi # Clean state and update cron if all scripts are not installed -if [ "$(grep -o "#birdnet" /etc/crontab | wc -l)" -lt 5 ]; then +if [ "$(grep -o "#birdnet" /etc/crontab | wc -l)" -lt 6 ]; 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 + sed "s/\$USER/$USER/g" "$HOME"/BirdNET-Pi/templates/automatic_update.cron >> /etc/crontab fi set +x diff --git a/templates/automatic_update.cron b/templates/automatic_update.cron new file mode 100644 index 0000000..9e93d8c --- /dev/null +++ b/templates/automatic_update.cron @@ -0,0 +1,2 @@ +#birdnet +0 3 * * 0 $USER /usr/local/bin/update_birdnet.sh -a >/dev/null 2>&1