0) { syslog(LOG_INFO, $output); } } if(isset($_GET['restart_php']) && $_GET['restart_php'] == "true") { shell_exec("sudo service php7.4-fpm restart"); die(); } # Basic Settings if(isset($_GET["latitude"])){ $latitude = $_GET["latitude"]; $longitude = $_GET["longitude"]; $birdweather_id = $_GET["birdweather_id"]; $apprise_input = $_GET['apprise_input']; $apprise_notification_title = $_GET['apprise_notification_title']; $apprise_notification_body = $_GET['apprise_notification_body']; $flickr_api_key = $_GET['flickr_api_key']; $flickr_filter_email = $_GET["flickr_filter_email"]; $language = $_GET["language"]; $timezone = $_GET["timezone"]; if(isset($_GET['apprise_notify_each_detection'])) { $apprise_notify_each_detection = 1; } else { $apprise_notify_each_detection = 0; } if(isset($_GET['apprise_notify_new_species'])) { $apprise_notify_new_species = 1; } else { $apprise_notify_new_species = 0; } if(isset($timezone)) { shell_exec("sudo timedatectl set-timezone ".$timezone); date_default_timezone_set($timezone); echo ""; } // logic for setting the date and time based on user inputs from the form below if(isset($_GET['date']) && isset($_GET['time'])) { // can't set the date manually if it's getting it from the internet, disable ntp exec("sudo timedatectl set-ntp false"); exec("sudo date -s '".$_GET['date']." ".$_GET['time']."'"); } else { // user checked 'use time from internet if available,' so make sure that's on if(strlen(trim(exec("sudo timedatectl | grep \"NTP service: active\""))) == 0){ exec("sudo timedatectl set-ntp true"); sleep(3); } } // Update Language settings only if a change is requested if (file_exists('./scripts/thisrun.txt')) { $lang_config = parse_ini_file('./scripts/thisrun.txt'); } elseif (file_exists('./scripts/firstrun.ini')) { $lang_config = parse_ini_file('./scripts/firstrun.ini'); } if ($language != $lang_config['DATABASE_LANG']){ $user = trim(shell_exec("awk -F: '/1000/{print $1}' /etc/passwd")); $home = trim(shell_exec("awk -F: '/1000/{print $6}' /etc/passwd")); // Archive old language file syslog_shell_exec("cp -f $home/BirdNET-Pi/model/labels.txt $home/BirdNET-Pi/model/labels.txt.old", $user); // Install new language label file syslog_shell_exec("$home/BirdNET-Pi/scripts/install_language_label.sh -l $language", $user); syslog(LOG_INFO, "Successfully changed language to '$language'"); } $contents = file_get_contents("/etc/birdnet/birdnet.conf"); $contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents); $contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents); $contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents); $contents = preg_replace("/APPRISE_NOTIFICATION_TITLE=.*/", "APPRISE_NOTIFICATION_TITLE=\"$apprise_notification_title\"", $contents); $contents = preg_replace("/APPRISE_NOTIFICATION_BODY=.*/", "APPRISE_NOTIFICATION_BODY=\"$apprise_notification_body\"", $contents); $contents = preg_replace("/APPRISE_NOTIFY_EACH_DETECTION=.*/", "APPRISE_NOTIFY_EACH_DETECTION=$apprise_notify_each_detection", $contents); $contents = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents); $contents = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents); $contents = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents); $contents = preg_replace("/FLICKR_FILTER_EMAIL=.*/", "FLICKR_FILTER_EMAIL=$flickr_filter_email", $contents); $contents2 = file_get_contents("./scripts/thisrun.txt"); $contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2); $contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2); $contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2); $contents2 = preg_replace("/APPRISE_NOTIFICATION_TITLE=.*/", "APPRISE_NOTIFICATION_TITLE=\"$apprise_notification_title\"", $contents2); $contents2 = preg_replace("/APPRISE_NOTIFICATION_BODY=.*/", "APPRISE_NOTIFICATION_BODY=\"$apprise_notification_body\"", $contents2); $contents2 = preg_replace("/APPRISE_NOTIFY_EACH_DETECTION=.*/", "APPRISE_NOTIFY_EACH_DETECTION=$apprise_notify_each_detection", $contents2); $contents2 = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents2); $contents2 = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents2); $contents2 = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents2); $contents2 = preg_replace("/FLICKR_FILTER_EMAIL=.*/", "FLICKR_FILTER_EMAIL=$flickr_filter_email", $contents2); $fh = fopen("/etc/birdnet/birdnet.conf", "w"); $fh2 = fopen("./scripts/thisrun.txt", "w"); fwrite($fh, $contents); fwrite($fh2, $contents2); if(isset($apprise_input)){ $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); $home = trim($home); $appriseconfig = fopen($home."/BirdNET-Pi/apprise.txt", "w"); fwrite($appriseconfig, $apprise_input); } syslog(LOG_INFO, "Restarting Services"); shell_exec("sudo restart_services.sh"); } ?>

Basic Settings

You cannot edit the settings for this installation'; exit; } else { $submittedpwd = $_SERVER['PHP_AUTH_PW']; $submitteduser = $_SERVER['PHP_AUTH_USER']; if($submittedpwd !== $caddypwd || $submitteduser !== 'birdnet'){ header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo '
You cannot edit the settings for this installation
'; exit; } } ?>

Set your Latitude and Longitude to 4 decimal places. Get your coordinates here.


BirdWeather.com is a weather map for bird sounds. Stations around the world supply audio and video streams to BirdWeather where they are then analyzed by BirdNET and compared to eBird Grid data. BirdWeather catalogues the bird audio and spectrogram visualizations so that you can listen to, view, and read about birds throughout the world. Email Tim to request a BirdWeather ID


Notifications

Apprise Notifications can be setup and enabled for 70+ notification services. Each service should be on its own line.

$sciname
Scientific Name
$comname
Common Name
$confidence
Confidence Score
$listenurl
A link to the detection

Use the variables defined above to customize your notification title and body.



>
>

Bird Photos from Flickr



Set your Flickr API key to enable the display of bird images next to detections. Get your free key here.

Localization



0) { $checkedvalue = "checked"; $disabledvalue = "disabled"; } else { $checkedvalue = ""; $disabledvalue = ""; } ?>
If connected to the internet, retrieve time automatically? >
> >