@@ -16,7 +16,7 @@ a {
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a href="http://birdnetpi.local/stream" target="footer"><h4>Play Live Audio</h4></a>
|
||||
<a href="/stream" target="footer"><h4>Play Live Audio</h4></a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20" role="img" aria-label="version: 0.11"><title>version: 0.11</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="51" height="20" fill="#555"/><rect x="51" width="35" height="20" fill="#fe7d37"/><rect width="86" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="265" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">version</text><text x="265" y="140" transform="scale(.1)" fill="#fff" textLength="410">version</text><text aria-hidden="true" x="675" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">0.11</text><text x="675" y="140" transform="scale(.1)" fill="#fff" textLength="250">0.11</text></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20" role="img" aria-label="version: 0.11.1"><title>version: 0.11.1</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="51" height="20" fill="#555"/><rect x="51" width="35" height="20" fill="#fe7d37"/><rect width="86" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="265" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="410">version</text><text x="265" y="140" transform="scale(.1)" fill="#fff" textLength="410">version</text><text aria-hidden="true" x="675" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="250">0.11.1</text><text x="675" y="140" transform="scale(.1)" fill="#fff" textLength="250">0.11.1</text></g></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
+205
-35
@@ -1,3 +1,161 @@
|
||||
<?php
|
||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
||||
}
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
if(isset($_POST['submit'])) {
|
||||
$contents = file_get_contents("/home/pi/BirdNET-Pi/birdnet.conf");
|
||||
$contents2 = file_get_contents("/home/pi/BirdNET-Pi/thisrun.txt");
|
||||
|
||||
if(isset($_POST["caddy_pwd"])) {
|
||||
$caddy_pwd = $_POST["caddy_pwd"];
|
||||
if(strcmp($caddy_pwd,$config['CADDY_PWD']) !== 0) {
|
||||
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
|
||||
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
|
||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["db_pwd"])) {
|
||||
$db_pwd = $_POST["db_pwd"];
|
||||
if(strcmp($db_pwd,$config['DB_PWD']) !== 0) {
|
||||
shell_exec('sudo /usr/local/bin/update_db_pwd_bullseye.sh');
|
||||
$contents = preg_replace("/DB_PWD=.*/", "DB_PWD=$db_pwd", $contents);
|
||||
$contents2 = preg_replace("/DB_PWD=.*/", "DB_PWD=$db_pwd", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["ice_pwd"])) {
|
||||
$ice_pwd = $_POST["ice_pwd"];
|
||||
if(strcmp($ice_pwd,$config['ICE_PWD']) !== 0) {
|
||||
$contents = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents);
|
||||
$contents2 = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["webterminal_url"])) {
|
||||
$webterminal_url = $_POST["webterminal_url"];
|
||||
if(strcmp($webterminal_url,$config['WEBTERMINAL_URL']) !== 0) {
|
||||
$contents = preg_replace("/WEBTERMINAL_URL=.*/", "WEBTERMINAL_URL=$webterminal_url", $contents);
|
||||
$contents2 = preg_replace("/WEBTERMINAL_URL=.*/", "WEBTERMINAL_URL=$webterminal_url", $contents2);
|
||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["birdnetlog_url"])) {
|
||||
$birdnetlog_url = $_POST["birdnetlog_url"];
|
||||
if(strcmp($birdnetlog_url,$config['BIRDNETLOG_URL']) !== 0) {
|
||||
$contents = preg_replace("/BIRDNETLOG_URL=.*/", "BIRDNETLOG_URL=$birdnetlog_url", $contents);
|
||||
$contents2 = preg_replace("/BIRDNETLOG_URL=.*/", "BIRDNETLOG_URL=$birdnetlog_url", $contents2);
|
||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["birdnetpi_url"])) {
|
||||
$birdnetpi_url = $_POST["birdnetpi_url"];
|
||||
if(strcmp($birdnetpi_url,$config['BIRDNETPI_URL']) !== 0) {
|
||||
$contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents);
|
||||
$contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2);
|
||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
exec('sudo /usr/local/bin/update_caddyfile.sh > /dev/null 2>&1 &');
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["overlap"])) {
|
||||
$overlap = $_POST["overlap"];
|
||||
if(strcmp($overlap,$config['OVERLAP']) !== 0) {
|
||||
$contents = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents);
|
||||
$contents2 = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["confidence"])) {
|
||||
$confidence = $_POST["confidence"];
|
||||
if(strcmp($confidence,$config['CONFIDENCE']) !== 0) {
|
||||
$contents = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents);
|
||||
$contents2 = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["sensitivity"])) {
|
||||
$sensitivity = $_POST["sensitivity"];
|
||||
if(strcmp($sensitivity,$config['SENSITIVITY']) !== 0) {
|
||||
$contents = preg_replace("/SENSITIVITY=.*/", "SENSITIVITY=$sensitivity", $contents);
|
||||
$contents2 = preg_replace("/SENSITIVITY=.*/", "SENSITIVITY=$sensitivity", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["full_disk"])) {
|
||||
$full_disk = $_POST["full_disk"];
|
||||
if(strcmp($full_disk,$config['FULL_DISK']) !== 0) {
|
||||
$contents = preg_replace("/FULL_DISK=.*/", "FULL_DISK=$full_disk", $contents);
|
||||
$contents2 = preg_replace("/FULL_DISK=.*/", "FULL_DISK=$full_disk", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["rec_card"])) {
|
||||
$rec_card = $_POST["rec_card"];
|
||||
if(strcmp($rec_card,$config['REC_CARD']) !== 0) {
|
||||
$contents = preg_replace("/REC_CARD=.*/", "REC_CARD=$rec_card", $contents);
|
||||
$contents2 = preg_replace("/REC_CARD=.*/", "REC_CARD=$rec_card", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["channels"])) {
|
||||
$channels = $_POST["channels"];
|
||||
if(strcmp($channels,$config['CHANNELS']) !== 0) {
|
||||
$contents = preg_replace("/CHANNELS=.*/", "CHANNELS=$channels", $contents);
|
||||
$contents2 = preg_replace("/CHANNELS=.*/", "CHANNELS=$channels", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["recording_length"])) {
|
||||
$recording_length = $_POST["recording_length"];
|
||||
if(strcmp($recording_length,$config['RECORDING_LENGTH']) !== 0) {
|
||||
$contents = preg_replace("/RECORDING_LENGTH=.*/", "RECORDING_LENGTH=$recording_length", $contents);
|
||||
$contents2 = preg_replace("/RECORDING_LENGTH=.*/", "RECORDING_LENGTH=$recording_length", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($_POST["extraction_length"])) {
|
||||
$extraction_length = $_POST["extraction_length"];
|
||||
if(strcmp($extraction_length,$config['EXTRACTION_LENGTH']) !== 0) {
|
||||
$contents = preg_replace("/EXTRACTION_LENGTH=.*/", "EXTRACTION_LENGTH=$extraction_length", $contents);
|
||||
$contents2 = preg_replace("/EXTRACTION_LENGTH=.*/", "EXTRACTION_LENGTH=$extraction_length", $contents2);
|
||||
}
|
||||
}
|
||||
|
||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
@session_start();
|
||||
if(true){
|
||||
$_SESSION['success'] = 1;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
/* Chrome, Safari, Edge, Opera */
|
||||
@@ -89,73 +247,86 @@ input {
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<?php
|
||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
$newconfig = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
||||
$newconfig = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
||||
}
|
||||
?>
|
||||
<h2>Advanced Settings</h2>
|
||||
<body style="background-color: rgb(119, 196, 135);">
|
||||
<div class="row">
|
||||
<div class="column first">
|
||||
<form action="write_advanced.php" method="POST">
|
||||
<?php
|
||||
|
||||
if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/thisrun.txt');
|
||||
} elseif (file_exists('/home/pi/BirdNET-Pi/firstrun.ini')) {
|
||||
$config = parse_ini_file('/home/pi/BirdNET-Pi/firstrun.ini');
|
||||
} ?>
|
||||
<form action="advanced.php" method="POST">
|
||||
<h3>Defaults</h3>
|
||||
<label>Full Disk Behavior: </label>
|
||||
<label style="width:30%;" for="purge">
|
||||
<input style="width:15%;" name="full_disk" type="radio" id="purge" value="purge"
|
||||
<?php
|
||||
if (strcmp($config['FULL_DISK'], "purge") == 0) {
|
||||
echo "checked";
|
||||
if (strcmp($newconfig['FULL_DISK'], "purge") == 0) {
|
||||
echo "checked";
|
||||
}?>>Purge</label>
|
||||
<label style="width:30%;" for="keep">
|
||||
<input style="width:15%" name="full_disk" type="radio" id="keep" value="keep"
|
||||
<?php
|
||||
if (strcmp($config['FULL_DISK'], "keep") == 0) {
|
||||
echo "checked";
|
||||
}?>>Keep</label>
|
||||
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.</p>
|
||||
<label for="rec_card">Audio Card: </label>
|
||||
<input name="rec_card" type="text" value="<?php print($config['REC_CARD']);?>" required/><br>
|
||||
<input name="rec_card" type="text" value="<?php print($newconfig['REC_CARD']);?>" required/><br>
|
||||
<p>Set Audio Card to 'default' to use PulseAudio (always recommended), or an ALSA recognized sound card device from the output of `aplay -L`.</p>
|
||||
<label for="channels">Audio Channels: </label>
|
||||
<input name="channels" type="number" min="1" max="32" step="1" value="<?php print($config['CHANNELS']);?>" required/><br>
|
||||
<input name="channels" type="number" min="1" max="32" step="1" value="<?php print($newconfig['CHANNELS']);?>" required/><br>
|
||||
<p>Set Channels to the number of channels supported by your sound card. 32 max.</p>
|
||||
<label for="recording_length">Recording Length: </label>
|
||||
<input name="recording_length" type="number" min="3" max="60" step="1" value="<?php print($config['RECORDING_LENGTH']);?>" required/><br>
|
||||
<input name="recording_length" type="number" min="3" max="60" step="1" value="<?php print($newconfig['RECORDING_LENGTH']);?>" required/><br>
|
||||
<p>Set Recording Length in seconds between 6 and 60. Multiples of 3 are recommended, as BirdNET analyzes in 3-second chunks.</p>
|
||||
<label for="extraction_length">Extraction Length: </label>
|
||||
<input name="extraction_length" type="number" min="3" max="<?php print($config['RECORDING_LENGTH']);?>" value="<?php print($config['EXTRACTION_LENGTH']);?>" /><br>
|
||||
<input name="extraction_length" type="number" min="3" max="<?php print($newconfig['RECORDING_LENGTH']);?>" value="<?php print($newconfig['EXTRACTION_LENGTH']);?>" /><br>
|
||||
<p>Set Extraction Length to something less than your Recording Length. Min=3 Max=Recording Length
|
||||
<h3>Passwords</h3>
|
||||
<label for="caddy_pwd">Webpage: </label>
|
||||
<input name="caddy_pwd" type="text" value="<?php print($config['CADDY_PWD']);?>" /><br>
|
||||
<input name="caddy_pwd" type="text" value="<?php print($newconfig['CADDY_PWD']);?>" /><br>
|
||||
<p>This password protects the Live Audio Stream, the Processed extractions, phpSysInfo, your Tools, and WebTerminal. When you update this value, the web server will reload, so wait about 30 seconds and then reload the page.</p>
|
||||
<label for="db_pwd">Database: </label>
|
||||
<input name="db_pwd" type="text" value="<?php print($config['DB_PWD']);?>" required/><br>
|
||||
<input name="db_pwd" type="text" value="<?php print($newconfig['DB_PWD']);?>" required/><br>
|
||||
<p>This password protects the database. When you update this value, it will be updated automatically.</p>
|
||||
<label for="ice_pwd">Live Audio Stream: </label>
|
||||
<input name="ice_pwd" type="text" value="<?php print($config['ICE_PWD']);?>" required/><br>
|
||||
<input name="ice_pwd" type="text" value="<?php print($newconfig['ICE_PWD']);?>" required/><br>
|
||||
</div>
|
||||
<div class="column second">
|
||||
<h3>Custom URLs</h3>
|
||||
<p>When you update any of the URL settings below, the web server will reload, so be sure to wait at least 30 seconds and then reload the page.</p>
|
||||
<label for="birdnetpi_url">BirdNET-Pi URL: </label>
|
||||
<input name="birdnetpi_url" type="url" value="<?php print($config['BIRDNETPI_URL']);?>" /><br>
|
||||
<input name="birdnetpi_url" type="url" value="<?php print($newconfig['BIRDNETPI_URL']);?>" /><br>
|
||||
<p>This 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://`.<br>Example for IP:http://192.168.0.109<br>Example if you own your own domain:https://birdnetpi.pmcgui.xyz</p>
|
||||
<label for="birdnetlog_url">BirdNET-Lite Log URL: </label>
|
||||
<input name="birdnetlog_url" type="url" value="<?php print($config['BIRDNETLOG_URL']);?>" /><br>
|
||||
<input name="birdnetlog_url" type="url" value="<?php print($newconfig['BIRDNETLOG_URL']);?>" /><br>
|
||||
<p>This URL is how the log will be reached. Only use this variable if you own your own domain.</p>
|
||||
<label for="webterminal_url">Web Terminal URL: </label>
|
||||
<input name="webterminal_url" type="url" value="<?php print($config['WEBTERMINAL_URL']);?>" /><br>
|
||||
<input name="webterminal_url" type="url" value="<?php print($newconfig['WEBTERMINAL_URL']);?>" /><br>
|
||||
<p>This URL is how the Web browser terminal will be reached. Only use this variable if you own your own domain.</p>
|
||||
<h3>BirdNET-Lite Settings</h3>
|
||||
<label for="overlap">Overlap: </label>
|
||||
<input name="overlap" type="number" min="0.0" max="2.9" step="0.1" value="<?php print($config['OVERLAP']);?>" required/><br>
|
||||
<input name="overlap" type="number" min="0.0" max="2.9" step="0.1" value="<?php print($newconfig['OVERLAP']);?>" required/><br>
|
||||
<p>Min=0.0, Max=2.9</p>
|
||||
<label for="confidence">Minimum Confidence: </label>
|
||||
<input name="confidence" type="number" min="0.01" max="0.99" step="0.01" value="<?php print($config['CONFIDENCE']);?>" required/><br>
|
||||
<input name="confidence" type="number" min="0.01" max="0.99" step="0.01" value="<?php print($newconfig['CONFIDENCE']);?>" required/><br>
|
||||
<p>Min=0.01, Max=0.99</p>
|
||||
<label for="sensitivity">Sigmoid Sensitivity: </label>
|
||||
<input name="sensitivity" type="number" min="0.5" max="1.5" step="0.01" value="<?php print($config['SENSITIVITY']);?>" required/><br>
|
||||
<input name="sensitivity" type="number" min="0.5" max="1.5" step="0.01" value="<?php print($newconfig['SENSITIVITY']);?>" required/><br>
|
||||
<p>Min=0.5, Max=1.5</p>
|
||||
<br><br>
|
||||
<button type="submit" class="block"><?php
|
||||
@session_start();
|
||||
<button type="submit" name="submit" class="block"><?php
|
||||
|
||||
if(isset($_SESSION['success'])){
|
||||
echo "Success!";
|
||||
unset($_SESSION['success']);
|
||||
} else {
|
||||
echo "Update Settings";
|
||||
}
|
||||
if(isset($_SESSION['success'])){
|
||||
echo "Success!";
|
||||
unset($_SESSION['success']);
|
||||
} else {
|
||||
echo "Update Settings";
|
||||
}
|
||||
?></button>
|
||||
<br>
|
||||
</form>
|
||||
@@ -169,4 +340,3 @@ if(isset($_SESSION['success'])){
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<?php
|
||||
shell_exec("sudo -u pi /home/pi/BirdNET-Pi/scripts/backup_data.sh > /tmp/birdnetbackup.log 2&>1");
|
||||
header('Location: /backup_inprogress.html');
|
||||
?>
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tar and compress all data
|
||||
source /etc/birdnet/birdnet.conf
|
||||
|
||||
tar -czvf /home/pi/BirdNET-Pi/BirdNET-Pi_Data_Dump_$(date +%F).tar.gz ${EXTRACTED} /home/pi/BirdNET-Pi/BirdDB.txt
|
||||
+3
-1
@@ -124,13 +124,15 @@ if (file_exists('/home/pi/BirdNET-Pi/thisrun.txt')) {
|
||||
<input name="latitude" type="number" max="90" min="-90" step="0.0001" value="<?php print($config['LATITUDE']);?>" required/><br>
|
||||
<label for="longitude">Longitude: </label>
|
||||
<input name="longitude" type="number" max="180" min="-180" step="0.0001" value="<?php print($config['LONGITUDE']);?>" required/><br>
|
||||
<p>Set your Latitude and Longitude to 4 decimal places. Get your coordinates <a href="https://latlong.net" target="_blank">here</a>.</p>
|
||||
<label for="birdweather_id">BirdWeather ID: </label>
|
||||
<input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
|
||||
<p><a href="mailto:tim@birdweather.com?subject=Request%20BirdWeather%20ID&body=<?php include('birdweather_request.php'); ?>" target="top">Email Tim</a> to request a BirdWeather ID</p>
|
||||
<p><a href="https://app.birdweather.com" target="_blank">BirdWeather.com</a> 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. <a href="mailto:tim@birdweather.com?subject=Request%20BirdWeather%20ID&body=<?php include('birdweather_request.php'); ?>" target="_blank">Email Tim</a> to request a BirdWeather ID</p>
|
||||
<label for="pushed_app_key">Pushed App Key: </label>
|
||||
<input name="pushed_app_key" type="text" value="<?php print($config['PUSHED_APP_KEY']);?>" /><br>
|
||||
<label for="pushed_app_secret">Pushed App Secret: </label>
|
||||
<input name="pushed_app_secret" type="text" value="<?php print($config['PUSHED_APP_SECRET']);?>" /><br>
|
||||
<p><a href="https://pushed.co/quick-start-guide">Pushed iOS Notifications</a> can be setup and enabled for New Species notifications. Sorry, Android users, this only works on iOS.</p>
|
||||
<label for="language">Database Language: </label>
|
||||
<select name="language">
|
||||
<option value="none">Select your language</option>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Pi/scripts/restart_birdnet_analysis.sh");
|
||||
header('Location: http://birdnetpi.local:8080');
|
||||
header("Location: /overview.php");
|
||||
?>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
shell_exec("/home/pi/BirdNET-Pi/scripts/stop_core_services.sh");
|
||||
header('Location: http://birdnetpi.local/scripts/index.html?success=true');
|
||||
header('Location: /overview.php');
|
||||
?>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
shell_exec("sudo -u pi /home/pi/BirdNET-Pi/scripts/update_birdnet.sh > /tmp/phpupdate.log 2&>1");
|
||||
header('Location: http://birdnetpi.local/scripts/update_inprogress.php');
|
||||
header('Location: update_inprogress.php');
|
||||
?>
|
||||
|
||||
@@ -42,4 +42,5 @@ birdnet_log.service)
|
||||
for i in "${services[@]}";do
|
||||
sudo systemctl restart "${i}"
|
||||
done
|
||||
|
||||
sudo systemctl reload caddy
|
||||
sudo systemctl restart php7.4-fpm.service
|
||||
|
||||
Executable
+113
@@ -0,0 +1,113 @@
|
||||
#!/usr/bin/env bash
|
||||
source /etc/birdnet/birdnet.conf
|
||||
USER=pi
|
||||
HOME=/home/pi
|
||||
my_dir=/home/pi/BirdNET-Pi/scripts
|
||||
set -x
|
||||
[ -d /etc/caddy ] || mkdir /etc/caddy
|
||||
if [ -f /etc/caddy/Caddyfile ];then
|
||||
cp /etc/caddy/Caddyfile{,.original}
|
||||
fi
|
||||
if ! [ -z ${CADDY_PWD} ];then
|
||||
HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD})
|
||||
cat << EOF > /etc/caddy/Caddyfile
|
||||
http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
basicauth /Processed* {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
basicauth /scripts* {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
basicauth /stream {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
basicauth /phpsysinfo* {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy /stream localhost:8000
|
||||
php_fastcgi unix//run/php/php7.4-fpm.sock
|
||||
}
|
||||
EOF
|
||||
else
|
||||
cat << EOF > /etc/caddy/Caddyfile
|
||||
http://localhost http://$(hostname).local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
reverse_proxy /stream localhost:8000
|
||||
php_fastcgi unix//run/php/php7.4-fpm.sock
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -z ${WEBTERMINAL_URL} ] && [ ! -z ${HASHWORD} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
${WEBTERMINAL_URL} {
|
||||
basicauth {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
EOF
|
||||
elif [ ! -z ${WEBTERMINAL_URL} ] && [ -z ${HASHWORD} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
${WEBTERMINAL_URL} {
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ ! -z ${BIRDNETLOG_URL} ];then
|
||||
cat << EOF >> /etc/caddy/Caddyfile
|
||||
|
||||
${BIRDNETLOG_URL} {
|
||||
reverse_proxy localhost:8080
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
################################################################################
|
||||
sudo -u${USER} git -C /home/pi/BirdNET-Pi checkout -f homepage/*
|
||||
sudo -u${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/*
|
||||
sudo -u${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/*/*
|
||||
sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
|
||||
|
||||
if [ ! -z ${BIRDNETLOG_URL} ];then
|
||||
BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
else
|
||||
BIRDNETLOG_URL="$(echo http://$(hostname).local:8080 | sed 's/\/\//\\\/\\\//g')"
|
||||
fi
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
|
||||
if [ ! -z ${WEBTERMINAL_URL} ];then
|
||||
WEBTERMINAL_URL="$(echo ${WEBTERMINAL_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
else
|
||||
WEBTERMINAL_URL="$(echo http://$(hostname).local:8888 | sed 's/\/\//\\\/\\\//g')"
|
||||
fi
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8888/${WEBTERMINAL_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
|
||||
|
||||
if [ -z ${BIRDNETPI_URL} ];then
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/birdnetpi.local/$(hostname).local/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
else
|
||||
BIRDNETPI_URL="$(echo ${BIRDNETPI_URL} | sed 's/\/\//\\\/\\\//g')"
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/homepage/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.html
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*.php
|
||||
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
|
||||
fi
|
||||
|
||||
systemctl reload caddy
|
||||
@@ -5,9 +5,7 @@ source /etc/birdnet/birdnet.conf
|
||||
mysql -e "
|
||||
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||
FLUSH PRIVILEGES";
|
||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/server.py
|
||||
sudo -u ${USER} git -C /home/pi/BirdNET-Pi checkout -f scripts/viewdb.php
|
||||
sudo -u ${USER} sed -i "s/databasepassword/${DB_PWD}/g" /home/pi/BirdNET-Pi/scripts/server.py
|
||||
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
||||
systemctl restart php7.4-fpm.service
|
||||
|
||||
@@ -21,8 +21,6 @@ function countDown(secs,elem) {
|
||||
|
||||
element.innerHTML = '<h4>Let\'s see</h4>';
|
||||
|
||||
element.innerHTML += '<a href="http://birdnetpi.local"></a>';
|
||||
|
||||
}
|
||||
|
||||
secs--;
|
||||
|
||||
@@ -26,7 +26,6 @@ install_scripts() {
|
||||
install_mariadb() {
|
||||
if ! which mysql &> /dev/null;then
|
||||
echo "Installing MariaDB Server"
|
||||
apt -qqy update
|
||||
apt -qqy install mariadb-server
|
||||
echo "MariaDB Installed"
|
||||
fi
|
||||
@@ -34,7 +33,12 @@ install_mariadb() {
|
||||
if [[ "${VERSION_CODENAME}" == "buster" ]];then
|
||||
USER=${USER} ${my_dir}/update_db_pwd_buster.sh
|
||||
elif [[ "${VERSION_CODENAME}" == "bullseye" ]];then
|
||||
USER=${USER} ${my_dir}/update_db_pwd_bullseye.sh
|
||||
mysql -e "
|
||||
SET PASSWORD FOR 'birder'@'localhost' = PASSWORD('${DB_PWD}');
|
||||
FLUSH PRIVILEGES";
|
||||
sed -i "s/mysqli.default_host =.*/mysqli.default_host = localhost/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_user =.*/mysqli.default_user = birder/g" /etc/php/7.4/fpm/php.ini
|
||||
sed -i "s/mysqli.default_pw =.*/mysqli.default_pw = ${DB_PWD}/g" /etc/php/7.4/fpm/php.ini
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -201,7 +205,6 @@ install_alsa() {
|
||||
echo "alsa-utils installed"
|
||||
else
|
||||
echo "Installing alsa-utils"
|
||||
apt -qqq update
|
||||
apt install -qqy alsa-utils
|
||||
echo "alsa-utils installed"
|
||||
fi
|
||||
@@ -209,7 +212,6 @@ install_alsa() {
|
||||
echo "PulseAudio installed"
|
||||
else
|
||||
echo "Installing pulseaudio"
|
||||
apt -qqq update
|
||||
apt install -qqy pulseaudio
|
||||
echo "PulseAudio installed"
|
||||
fi
|
||||
@@ -251,7 +253,6 @@ install_caddy() {
|
||||
curl -1sLf \
|
||||
'https://dl.cloudsmith.io/public/caddy/stable/setup.deb.sh' \
|
||||
| sudo -E bash
|
||||
apt -qq update
|
||||
apt install -qqy caddy=2.4.5
|
||||
systemctl enable --now caddy
|
||||
else
|
||||
@@ -324,7 +325,6 @@ ${BIRDNETLOG_URL} {
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
systemctl reload caddy
|
||||
}
|
||||
|
||||
update_etc_hosts() {
|
||||
@@ -441,7 +441,6 @@ install_sox() {
|
||||
echo "Sox is installed"
|
||||
else
|
||||
echo "Installing sox"
|
||||
apt -qq update
|
||||
apt install -y sox
|
||||
echo "Sox installed"
|
||||
fi
|
||||
@@ -450,7 +449,6 @@ install_sox() {
|
||||
install_php() {
|
||||
if ! which php &> /dev/null || ! which php-fpm || ! apt list --installed | grep php-xml;then
|
||||
echo "Installing PHP modules"
|
||||
apt -qq update
|
||||
apt install -qqy php php-fpm php-mysql php-xml php-zip
|
||||
else
|
||||
echo "PHP and PHP-FPM installed"
|
||||
@@ -472,7 +470,6 @@ EOF
|
||||
install_icecast() {
|
||||
if ! which icecast2;then
|
||||
echo "Installing IceCast2"
|
||||
apt -qq update
|
||||
echo "icecast2 icecast2/icecast-setup boolean false" | debconf-set-selections
|
||||
apt install -qqy icecast2
|
||||
config_icecast
|
||||
@@ -536,6 +533,7 @@ install_cleanup_cron() {
|
||||
}
|
||||
|
||||
install_selected_services() {
|
||||
sudo apt -qqqq update
|
||||
install_scripts
|
||||
install_birdnet_analysis
|
||||
install_birdnet_server
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$timer=30;
|
||||
header( "refresh:$timer;url=/advanced.php" );
|
||||
?>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<head></head>
|
||||
<body style="background-color: rgb(119, 196, 135)">
|
||||
<script>
|
||||
|
||||
function countDown(secs,elem) {
|
||||
|
||||
var element = document.getElementById(elem);
|
||||
|
||||
element.innerHTML = "Updating settings... Please allow another "+secs+" seconds for it to complete.";
|
||||
|
||||
if(secs < 1) {
|
||||
|
||||
clearTimeout(timer);
|
||||
|
||||
element.innerHTML = '<h4>Let\'s see</h4>';
|
||||
|
||||
}
|
||||
|
||||
secs--;
|
||||
|
||||
var timer = setTimeout('countDown('+secs+',"'+elem+'")',1000);
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div id="status"style="font-size:30px;"></div>
|
||||
|
||||
<script>countDown(<?php echo $timer;?>,"status");</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,60 +0,0 @@
|
||||
<?php
|
||||
$caddy_pwd = $_POST["caddy_pwd"];
|
||||
$db_pwd = $_POST["db_pwd"];
|
||||
$ice_pwd = $_POST["ice_pwd"];
|
||||
$birdnetpi_url = $_POST["birdnetpi_url"];
|
||||
$webterminal_url = $_POST["webterminal_url"];
|
||||
$birdnetlog_url = $_POST["birdnetlog_url"];
|
||||
$overlap = $_POST["overlap"];
|
||||
$confidence = $_POST["confidence"];
|
||||
$sensitivity = $_POST["sensitivity"];
|
||||
$full_disk = $_POST["full_disk"];
|
||||
$rec_card = $_POST["rec_card"];
|
||||
$channels = $_POST["channels"];
|
||||
$recording_length = $_POST["recording_length"];
|
||||
$extraction_length = $_POST["extraction_length"];
|
||||
|
||||
$contents = file_get_contents("/home/pi/BirdNET-Pi/birdnet.conf");
|
||||
$contents = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents);
|
||||
$contents = preg_replace("/DB_PWD=.*/", "DB_PWD=$db_pwd", $contents);
|
||||
$contents = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents);
|
||||
$contents = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents);
|
||||
$contents = preg_replace("/WEBTERMINAL_URL=.*/", "WEBTERMINAL_URL=$webterminal_url", $contents);
|
||||
$contents = preg_replace("/BIRDNETLOG_URL=.*/", "BIRDNETLOG_URL=$birdnetlog_url", $contents);
|
||||
$contents = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents);
|
||||
$contents = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents);
|
||||
$contents = preg_replace("/SENSITIVITY=.*/", "SENSITIVITY=$sensitivity", $contents);
|
||||
$contents = preg_replace("/FULL_DISK=.*/", "FULL_DISK=$full_disk", $contents);
|
||||
$contents = preg_replace("/REC_CARD=.*/", "REC_CARD=$rec_card", $contents);
|
||||
$contents = preg_replace("/CHANNELS=.*/", "CHANNELS=$channels", $contents);
|
||||
$contents = preg_replace("/RECORDING_LENGTH=.*/", "RECORDING_LENGTH=$recording_length", $contents);
|
||||
$contents = preg_replace("/EXTRACTION_LENGTH=.*/", "EXTRACTION_LENGTH=$extraction_length", $contents);
|
||||
|
||||
$contents2 = file_get_contents("/home/pi/BirdNET-Pi/thisrun.txt");
|
||||
$contents2 = preg_replace("/CADDY_PWD=.*/", "CADDY_PWD=$caddy_pwd", $contents2);
|
||||
$contents2 = preg_replace("/DB_PWD=.*/", "DB_PWD=$db_pwd", $contents2);
|
||||
$contents2 = preg_replace("/ICE_PWD=.*/", "ICE_PWD=$ice_pwd", $contents2);
|
||||
$contents2 = preg_replace("/BIRDNETPI_URL=.*/", "BIRDNETPI_URL=$birdnetpi_url", $contents2);
|
||||
$contents2 = preg_replace("/WEBTERMINAL_URL=.*/", "WEBTERMINAL_URL=$webterminal_url", $contents2);
|
||||
$contents2 = preg_replace("/BIRDNETLOG_URL=.*/", "BIRDNETLOG_URL=$birdnetlog_url", $contents2);
|
||||
$contents2 = preg_replace("/OVERLAP=.*/", "OVERLAP=$overlap", $contents2);
|
||||
$contents2 = preg_replace("/CONFIDENCE=.*/", "CONFIDENCE=$confidence", $contents2);
|
||||
$contents2 = preg_replace("/SENSITIVITY=.*/", "SENSITIVITY=$sensitivity", $contents2);
|
||||
$contents2 = preg_replace("/FULL_DISK=.*/", "FULL_DISK=$full_disk", $contents2);
|
||||
$contents2 = preg_replace("/REC_CARD=.*/", "REC_CARD=$rec_card", $contents2);
|
||||
$contents2 = preg_replace("/CHANNELS=.*/", "CHANNELS=$channels", $contents2);
|
||||
$contents2 = preg_replace("/RECORDING_LENGTH=.*/", "RECORDING_LENGTH=$recording_length", $contents2);
|
||||
$contents2 = preg_replace("/EXTRACTION_LENGTH=.*/", "EXTRACTION_LENGTH=$extraction_length", $contents2);
|
||||
|
||||
$fh = fopen("/home/pi/BirdNET-Pi/birdnet.conf", "w");
|
||||
$fh2 = fopen("/home/pi/BirdNET-Pi/thisrun.txt", "w");
|
||||
fwrite($fh, $contents);
|
||||
fwrite($fh2, $contents2);
|
||||
@session_start();
|
||||
|
||||
if(true){
|
||||
$_SESSION['success'] = 1;
|
||||
header("Location:advanced.php");
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
basicauth ${PROCESSED}* {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
basicauth /stream {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
reverse_proxy /stream localhost:8000
|
||||
}
|
||||
http://birdlog.local {
|
||||
reverse_proxy localhost:8080
|
||||
}
|
||||
http://extractionlog.local {
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
http://birdnetpi.local ${BIRDNETPI_URL} {
|
||||
root * ${EXTRACTED}
|
||||
file_server browse
|
||||
basicauth ${PROCESSED}* {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
basicauth /stream {
|
||||
birdnet ${HASHWORD}
|
||||
}
|
||||
}
|
||||
http://birdlog.local {
|
||||
reverse_proxy localhost:8080
|
||||
}
|
||||
http://extractionlog.local {
|
||||
reverse_proxy localhost:8888
|
||||
}
|
||||
Reference in New Issue
Block a user