Merge pull request #107 from mcguirepr89/forms

Forms
This commit is contained in:
Patrick McGuire
2022-01-24 16:13:26 -05:00
committed by GitHub
29 changed files with 1081 additions and 113 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
*.pyc *.pyc
*.flac *.flac
model/BirdNET_Soundscape_Model.pkl model/*
.vscode .vscode
datasets/ datasets/
birdnet.conf birdnet.conf
+1 -4
View File
@@ -71,10 +71,7 @@ and then close the Mouse Pad editing window to continue."
echo "Installing the BirdNET-Pi configuration file." echo "Installing the BirdNET-Pi configuration file."
install_birdnet_config || exit 1 install_birdnet_config || exit 1
echo "Installing BirdNET-Lite" echo "Installing BirdNET-Lite"
if ${my_dir}/scripts/install_birdnet.sh << EOF ; then if ${my_dir}/scripts/install_birdnet.sh;then
n
EOF
echo "The next time you power on the raspberry pi, all of the services will start up automatically. echo "The next time you power on the raspberry pi, all of the services will start up automatically.
The installation has finished. Press Enter to close this window." The installation has finished. Press Enter to close this window."
+1 -1
View File
@@ -1,5 +1,5 @@
<h1 align="center"> <h1 align="center">
BirdNET-Pi <img src="https://img.shields.io/badge/version-0.10-blue" /> BirdNET-Pi <img src="https://img.shields.io/badge/version-0.11-orange" />
</h1> </h1>
<p align="center"> <p align="center">
A realtime acoustic bird classification system for the Raspberry Pi 4B A realtime acoustic bird classification system for the Raspberry Pi 4B
+3 -3
View File
@@ -33,14 +33,14 @@ RECS_DIR=/home/pi/BirdSongs
## CADDY_PWD is the plaintext password (that will be hashed) and used to access ## CADDY_PWD is the plaintext password (that will be hashed) and used to access
## certain parts of the web interface ## certain parts of the web interface
CADDY_PWD=changeme CADDY_PWD=
#------------------------- MariaDB User Passwords ---------------------------# #------------------------- MariaDB User Passwords ---------------------------#
#_____________The variable below sets the password for the_____________________# #_____________The variable below sets the password for the_____________________#
#_______________________'birder' user on the MariaDB___________________________# #_______________________'birder' user on the MariaDB___________________________#
## DB_PWD is for the 'birder' user ## DB_PWD is for the 'birder' user
DB_PWD=changeme DB_PWD=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;)
#------------------------- Live Audio Stream --------------------------------# #------------------------- Live Audio Stream --------------------------------#
#_____________The variable below configures/enables the live___________________# #_____________The variable below configures/enables the live___________________#
@@ -51,7 +51,7 @@ DB_PWD=changeme
## trusted source for the stream. You will never need to enter this manually ## trusted source for the stream. You will never need to enter this manually
## anywhere other than here. ## anywhere other than here.
ICE_PWD=changeme ICE_PWD=birdnetpi
#--------------------- BirdWeather Station Information -----------------------# #--------------------- BirdWeather Station Information -----------------------#
#_____________The variable below can be set to have your BirdNET-Pi____________# #_____________The variable below can be set to have your BirdNET-Pi____________#
+84
View File
@@ -0,0 +1,84 @@
<html>
<head>
<title>Configure `birdnet.conf`</title>
<style>
* {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif';
}
h1,h2,h3 {
text-align:center;
}
input {
font-size:large;
}
</style>
</head>
<h1>Configure BirdNET-Pi</h1>
<body style="background-color: rgb(119, 196, 135);">
<form style="text-align:center;" action="write_config.php" method="POST">
<h3>Required</h3>
<input name="field1" type="text" value="LATITUDE" />
<input name="field2" type="text" /><br>
<input name="field3" type="text" value="LONGITUDE" />
<input name="field4" type="text" /><br>
<input name="field5" type="text" value="CADDY_PWD" />
<input name="field6" type="text" value="changeme" /><br>
<input name="field7" type="text" value="DB_PWD" />
<input name="field8" type="text" value="changeme" /><br>
<input name="field9" type="text" value="ICE_PWD" />
<input name="field10" type="text" value="changeme" /><br>
<input type="submit" name="submit" value="Save Settings">
</form>
<form style="text-align:center;" action="write_config.php" method="POST">
<h3>Optional Services</h3>
<input name="field11" type="text" value="BIRDWEATHER_ID" />
<input name="field12" type="text" /><br>
<input name="field13" type="text" value="PUSHED_APP_KEY" />
<input name="field14" type="text" /><br>
<input name="field15" type="text" value="PUSHED_APP_SECRET" />
<input name="field16" type="text" /><br>
<input type="submit" name="submit" value="Save Settings">
</form>
<form style="text-align:center;" action="write_config.php" method="POST">
<h3>Custom URLs</h3>
<input name="field17" type="text" value="BIRDNETPI_URL" />
<input name="field18" type="text" /><br>
<input name="field19" type="text" value="EXTRACTIONLOG_URL" />
<input name="field20" type="text" /><br>
<input name="field21" type="text" value="BIRDNETLOG_URL" />
<input name="field22" type="text" /><br>
<input type="submit" name="submit" value="Save Settings">
</form>
<form style="text-align:center;" action="write_config.php" method="POST">
<h3>Default Services</h3>
<input name="field23" type="text" value="INSTALL_NOMACHINE" />
<input name="field24" type="text" value="y" /><br>
<input name="field25" type="text" value="DO_EXTRACTIONS" />
<input name="field26" type="text" value="y" /><br>
<input name="field27" type="text" value="DO_RECORDING" />
<input name="field28" type="text" value="y" /><br>
<input type="submit" name="submit" value="Save Settings">
</form>
<form style="text-align:center;" action="write_config.php" method="POST">
<h3>Advanced Configuration</h3>
<input name="field29" type="text" value="REC_CARD" />
<input name="field30" type="text" value="default" /><br>
<input name="field31" type="text" value="OVERLAP" />
<input name="field32" type="text" value="0.0" /><br>
<input name="field33" type="text" value="CONFIDENCE" />
<input name="field34" type="text" value="0.7" /><br>
<input name="field35" type="text" value="SENSITIVITY" />
<input name="field36" type="text" value="1.25" /><br>
<input name="field37" type="text" value="CHANNELS" />
<input name="field38" type="text" value="2" /><br>
<input name="field39" type="text" value="RECORDING_LENGTH" />
<input name="field40" type="text" value="15" /><br>
<input name="field41" type="text" value="EXTRACTION_LENGTH" />
<input name="field42" type="text" value="6" /><br>
<input type="submit" name="submit" value="Save Settings">
</form>
<a style="font-weight:bold;color:black;" href='phpconfig.txt'>View Current Config</a>
</body>
+24
View File
@@ -0,0 +1,24 @@
<?php
if($_POST['Submit']){
$open = fopen("scripts/birdnet.conf","w+");
$text = $_POST['update'];
fwrite($open, $text);
fclose($open);
echo "File updated.<br />";
echo "File:<br />";
$file = file("scripts/birdnet.conf");
foreach($file as $text) {
echo $text."<br />";
}
}else{
$file = file("scripts/birdnet.conf");
echo "<form style=\"text-align:center;\" action=\"".$PHP_SELF."\" method=\"post\">";
echo "<textarea Name=\"update\" cols=\"80\" rows=\"100\">";
foreach($file as $text) {
echo $text;
}
echo "</textarea>";
echo "<input name=\"Submit\" type=\"submit\" value=\"Update\" />\n
</form>";
}
?>
+1 -1
View File
@@ -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.10"><title>version: 0.10</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="#007ec6"/><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.10</text><text x="675" y="140" transform="scale(.1)" fill="#fff" textLength="250">0.10</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"><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>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

+80
View File
@@ -0,0 +1,80 @@
<html>
<head>
<title>Menu</title>
<style type="text/css">
a {
text-decoration:none;
margin: 0px 0px 0px 0px;
color:black;
font-size: small;
}
body {
font-family:verdana,arial,sans-serif;
font-size:medium;
margin:10px;
background-color: rgb(119, 196, 135);
text-align: left;
padding-bottom: 30px;
}
h3 {
margin: 0px 0px -15px 0px;
text-align: center;
}
h4,h5 {
text-align: center;
margin: 0px 0px 5px 0px;
}
footer {
background: rgb(119, 196, 135);
position: fixed;
padding-top: 10px;
left: 0;
bottom: 0;
width:100%;
}
hr {
border-bottom: 1px solid black;
}
body::-webkit-scrollbar {
display:none
}
</style>
</head>
<body>
<h5>Extraktionen</h5>
- <a href="https://birdnetpi.local/By_Date/" target="content">Nach Datum</a><br>
- <a href="https://birdnetpi.local/By_Common_Name/" target="content">Nach Namen</a><br>
- <a href="https://birdnetpi.local/By_Scientific_Name/" target="content">Nach wiss. Namen</a><br>
- <a href="https://birdnetpi.local/Processed/" target="content">Verarbeitet</a><br>
<hr class="solid">
<h5>System-Links</h5>
- <a href="https://birdnetpi.local/scripts/" target="content">Tools</a><br>
- <a href="https://birdnetpi.local/phpsysinfo/" target="content">System Info</a><br>
- <a href="https://birdnetpi.local:8080" target="content">BirdNET-Lite Log</a><br>
- <a href="https://birdnetpi.local:8888" target="content">Extraction Log</a><br>
<hr class="solid">
<h5>Externe Links</h5>
- <a href="https://app.birdweather.com" target="_content">BirdWeather</a><br>
- <a href="https://github.com/mcguirepr89/BirdNET-Pi" target="_content">Repository</a><br>
- <a href="https://github.com/mcguirepr89/BirdNET-Pi/wiki" target="_content">Wiki Hilfe-Seite</a><br>
- <a href="https://v2.wttr.in/" target="content">Wttr.in Report</a><br>
- <a href="https://birdnet.cornell.edu" target="_content">BirdNET @ Cornell</a><br>
<hr class="solid">
<h5>Andere<br>BirdNET-Pis</h5>
- <a href="https://birdnetpi.pmcgui.xyz" target="_content">United States</a><br>
- <a href="https://birds.naturestation.net" target="_content">South Africa</a><br>
- <a href="https://birdnet.svarsten.se" target="_content">Sweden</a>
- <a href="https://birdnetgv.ddnss.de" target="_content">Germany</a>
</body>
<footer style="font-size: small;">
Icon by <a target="_content" style="font-weight: bold" href="https://www.freepik.com" title="Freepik">Freepik</a> from <a target="_content" style="font-weight: bold" href="https://www.flaticon.com/" title="Flaticon">Flaticon.com</a>
</footer>
</html>
+3 -3
View File
@@ -38,9 +38,9 @@ body {
<a href="https://github.com/mcguirepr89/BirdNET-Pi" target="_content"> <a href="https://github.com/mcguirepr89/BirdNET-Pi" target="_content">
<img alt="BirdNET-Pi" src="images/bird.png" style="position:absolute;left:32.5px;top:15px;"> <img alt="BirdNET-Pi" src="images/bird.png" style="position:absolute;left:32.5px;top:15px;">
</a> </a>
<h1 style="padding-left:150px">BirdNET-Pi<img style="padding-left: 5px" src="images/version.svg" class="ribbon"/></h1> <h1 style="padding-left:150px;margin:0;">BirdNET-Pi</h1>
</div> <img style="padding-left: 150px;margin:0;" src="images/version.svg"/>
<p style="padding-left:150px;"> <p style="margin:0;padding-left:150px;padding-top:5px">
<a href="/overview.php" target="content">Overview</a> | <a href="/overview.php" target="content">Overview</a> |
<a href="/viewdb.php" target="content">Database View</a> | <a href="/viewdb.php" target="content">Database View</a> |
<a href="/viewday.php" target="content">Today View</a> | <a href="/viewday.php" target="content">Today View</a> |
+51
View File
@@ -0,0 +1,51 @@
<html>
<head>
<title>BirdNET-Pi</title>
<style type="text/css">
a {
font-weight:bold;
text-decoration:none;
color:black;
}
body {
text-align:center;
font-family:verdana,arial,sans-serif;
font-size:medium;
margin:10px;
background-color: rgb(119, 196, 135);
}
#content {
position: relative;
}
#content img {
position: absolute;
top: 0px;
left: 0px;
padding-top: 5px;
padding-left: 10px;
}
footer {
position: absolute;
bottom: 0px;
left: 0px;
right: 0px;
width: 100%;
}
</style>
</head>
<body>
<a href="https://github.com/mcguirepr89/BirdNET-Pi" target="_content">
<img alt="BirdNET-Pi" src="images/bird.png" style="position:absolute;left:32.5px;top:15px;">
</a>
<h1 style="padding-left:150px">BirdNET-Pi<img style="padding-left: 5px" src="images/version.svg" class="ribbon"/></h1>
</div>
<p style="padding-left:150px;">
<a href="/overview.php" target="content">Übersicht</a> |
<a href="/viewdb.php" target="content">Datenbankansicht</a> |
<a href="/viewday.php" target="content">Tagesansicht</a> |
<a href="/spectrogram.php" target="content">Spektrogrammansicht</a>
</p>
</body>
</html>
+295
View File
@@ -0,0 +1,295 @@
<?php
if(isset($_POST['field1']) && isset($_POST['field2'])) {
$data = $_POST['field1'] . '=' . $_POST['field2'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field3']) && isset($_POST['field4'])) {
$data = $_POST['field3'] . '=' . $_POST['field4'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field5']) && isset($_POST['field6'])) {
$data = $_POST['field5'] . '=' . $_POST['field6'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field7']) && isset($_POST['field8'])) {
$data = $_POST['field7'] . '=' . $_POST['field8'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field9']) && isset($_POST['field10'])) {
$data = $_POST['field9'] . '=' . $_POST['field10'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field11']) && isset($_POST['field12'])) {
$data = $_POST['field11'] . '=' . $_POST['field12'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field13']) && isset($_POST['field14'])) {
$data = $_POST['field13'] . '=' . $_POST['field14'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field15']) && isset($_POST['field16'])) {
$data = $_POST['field15'] . '=' . $_POST['field16'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field17']) && isset($_POST['field18'])) {
$data = $_POST['field17'] . '=' . $_POST['field18'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field19']) && isset($_POST['field20'])) {
$data = $_POST['field19'] . '=' . $_POST['field20'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field21']) && isset($_POST['field22'])) {
$data = $_POST['field21'] . '=' . $_POST['field22'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field23']) && isset($_POST['field24'])) {
$data = $_POST['field23'] . '=' . $_POST['field24'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field25']) && isset($_POST['field26'])) {
$data = $_POST['field25'] . '=' . $_POST['field26'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field27']) && isset($_POST['field28'])) {
$data = $_POST['field27'] . '=' . $_POST['field28'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field29']) && isset($_POST['field30'])) {
$data = $_POST['field29'] . '=' . $_POST['field30'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field31']) && isset($_POST['field32'])) {
$data = $_POST['field31'] . '=' . $_POST['field32'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field33']) && isset($_POST['field34'])) {
$data = $_POST['field33'] . '=' . $_POST['field34'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field35']) && isset($_POST['field36'])) {
$data = $_POST['field35'] . '=' . $_POST['field36'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field37']) && isset($_POST['field38'])) {
$data = $_POST['field37'] . '=' . $_POST['field38'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field39']) && isset($_POST['field40'])) {
$data = $_POST['field39'] . '=' . $_POST['field40'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
if(isset($_POST['field41']) && isset($_POST['field42'])) {
$data = $_POST['field41'] . '=' . $_POST['field42'] . "\r\n";
$ret = file_put_contents('/home/pi/BirdNET-Pi/phpconfig.txt', $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo "$ret bytes written to file";
}
}
else {
die('no post data to process');
}
-2
View File
@@ -2,7 +2,6 @@ Afrikaans,labels_af.txt
Catalan,labels_ca.txt Catalan,labels_ca.txt
Czech,labels_cs.txt Czech,labels_cs.txt
Chinese,labels_zh.txt Chinese,labels_zh.txt
Chinese_(Traditional),not_available
Croatian,labels_hr.txt Croatian,labels_hr.txt
Danish,labels_da.txt Danish,labels_da.txt
Dutch,labels_nl.txt Dutch,labels_nl.txt
@@ -18,7 +17,6 @@ Italian,labels_it.txt
Japanese,labels_ja.txt Japanese,labels_ja.txt
Latvian,labels_lv.txt Latvian,labels_lv.txt
Lithuania,labels_lt.txt Lithuania,labels_lt.txt
Northern_Sami,not_available
Norwegian,labels_no.txt Norwegian,labels_no.txt
Polish,labels_pl.txt Polish,labels_pl.txt
Portugues,labels_pt.txt Portugues,labels_pt.txt
+3 -2
View File
@@ -3,9 +3,10 @@
HOME=/home/pi HOME=/home/pi
USER=pi USER=pi
branch=main branch=main
sudo apt update
if ! which git &> /dev/null;then if ! which git &> /dev/null;then
sudo apt update
sudo apt -y install git sudo apt -y install git
fi fi
git clone -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi git clone -b ${branch} https://github.com/mcguirepr89/BirdNET-Pi.git ${HOME}/BirdNET-Pi
${HOME}/BirdNET-Pi/scripts/birdnet-pi-config cp ${HOME}/BirdNET-Pi/birdnet.conf-defaults ${HOME}/BirdNET-Pi/birdnet.conf
${HOME}/BirdNET-Pi/scripts/install_birdnet.sh
+1
View File
@@ -5,3 +5,4 @@ pytz
tzlocal tzlocal
pandas pandas
seaborn seaborn
babel
+144
View File
@@ -0,0 +1,144 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif';
box-sizing: border-box;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
}
.first {
width: calc(50% - 70px);
}
.second {
width: calc(50% - 30px);
}
.
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
body {
background-color: rgb(119, 196, 135);
}
a {
font-size:large;
text-decoration: none;
}
.block {
display: block;
font-weight: bold;
width:100%;
border: none;
background-color: #04AA6D;
padding: 20px 20px;
color: white;
font-size: medium;
cursor: pointer;
text-align: center;
}
form {
text-align:left;
margin-left:20px;
}
h2 {
margin-bottom:0px;
}
h3 {
margin-left: -10px;
text-align:left;
}
label {
font-weight:bold;
}
input {
text-align:center;
font-size:large;
}
@media screen and (max-width: 800px) {
h2 {
margin-bottom:0px;
text-align:center;
} form {
text-align:left;
margin-left:0px;
}
.column {
float: none;
width: 100%;
}
}
</style>
</head>
<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');
} ?>
<h3>Defaults</h3>
<label for="full_disk">Full Disk Behavior: </label>
<input name="full_disk" type="text" value="<?php print($config['FULL_DISK']);?>" required/><br>
<label for="rec_card">Audio Card: </label>
<input name="rec_card" type="text" value="<?php print($config['REC_CARD']);?>" required/><br>
<label for="channels">Audio Channels: </label>
<input name="channels" type="text" value="<?php print($config['CHANNELS']);?>" required/><br>
<label for="recording_length">Recording Length: </label>
<input name="recording_length" type="text" value="<?php print($config['RECORDING_LENGTH']);?>" /><br>
<label for="extraction_length">Extraction Length: </label>
<input name="extraction_length" type="text" value="<?php print($config['EXTRACTION_LENGTH']);?>" /><br>
<h3>Passwords</h3>
<label for="caddy_pwd">Webpage: </label>
<input name="caddy_pwd" type="text" value="<?php print($config['CADDY_PWD']);?>" /><br>
<label for="db_pwd">Database: </label>
<input name="db_pwd" type="text" value="<?php print($config['DB_PWD']);?>" required/><br>
<label for="ice_pwd">Live Audio Stream: </label>
<input name="ice_pwd" type="text" value="<?php print($config['ICE_PWD']);?>" required/><br>
</div>
<div class="column first">
<h3>Custom URLs</h3>
<label for="birdnetpi_url">BirdNET-Pi URL: </label>
<input name="birdnetpi_url" type="text" value="<?php print($config['BIRDNETPI_URL']);?>" /><br>
<label for="extractionlog_url">Extraction Log URL: </label>
<input name="extractionlog_url" type="text" value="<?php print($config['EXTRACTIONLOG_URL']);?>" /><br>
<label for="birdnetlog_url">BirdNET-Lite Log URL: </label>
<input name="birdnetlog_url" type="text" value="<?php print($config['BIRDNETLOG_URL']);?>" /><br>
<h3>BirdNET-Lite Settings</h3>
<label for="overlap">Overlap: </label>
<input name="overlap" type="text" value="<?php print($config['OVERLAP']);?>" required/><br>
<label for="confidence">Minimum Confidence: </label>
<input name="confidence" type="text" value="<?php print($config['CONFIDENCE']);?>" required/><br>
<label for="sensitivity">Sigmoid Sensitivity: </label>
<input name="sensitivity" type="text" value="<?php print($config['SENSITIVITY']);?>" required/><br>
<br>
<br>
<input type="submit" value="<?php
@session_start();
if(isset($_SESSION['success'])){
echo "Success!";
unset($_SESSION['success']);
} else {
echo "Update Settings";
}
?>">
<br>
<br>
<br>
<button type="text"><a href="config.php">Basic Settings</a></button>
</form>
</div>
</div>
</body>
-1
View File
@@ -221,7 +221,6 @@ do_wifi_country() {
get_labels_lang() { get_labels_lang() {
oIFS="$IFS" oIFS="$IFS"
#value=$(unzip -l ${birdnetpi_dir}/model/labels_l18n.zip | awk '{print $4}' | tail -n +4 | grep -ve '^$' | tr '\n' '/')
value=$(cat ${birdnetpi_dir}/model/labels_lang.txt | tr ',' ' ' | tr '\n' ' ') value=$(cat ${birdnetpi_dir}/model/labels_lang.txt | tr ',' ' ' | tr '\n' ' ')
IFS=" " IFS=" "
get_lang=$(whiptail --menu "Select the file that corresponds to your language" 20 60 10 ${value} 3>&1 1>&2 2>&3) get_lang=$(whiptail --menu "Select the file that corresponds to your language" 20 60 10 ${value} 3>&1 1>&2 2>&3)
+151
View File
@@ -0,0 +1,151 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
font-family: 'Arial', 'Gill Sans', 'Gill Sans MT',
' Calibri', 'Trebuchet MS', 'sans-serif';
box-sizing: border-box;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
}
.first {
width: calc(50% - 70px);
}
.second {
width: calc(50% - 30px);
}
.
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
body {
background-color: rgb(119, 196, 135);
}
a {
text-decoration: none;
}
.block {
display: block;
font-weight: bold;
width:100%;
border: none;
background-color: #04AA6D;
padding: 20px 20px;
color: white;
font-size: medium;
cursor: pointer;
text-align: center;
}
form {
text-align:left;
margin-left:20px;
}
h2 {
margin-bottom:0px;
}
h3 {
margin-left: -10px;
text-align:left;
}
label {
font-weight:bold;
}
input {
text-align:center;
font-size:large;
}
@media screen and (max-width: 800px) {
h2 {
margin-bottom:0px;
text-align:center;
}
form {
text-align:left;
margin-left:0px;
}
.column {
float: none;
width: 100%;
}
}
</style>
</head>
<h2>Basic Settings</h2>
<body style="background-color: rgb(119, 196, 135);">
<div class="row">
<div class="column first">
<form action="write_config.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');
} ?>
<label for="latitude">Latitude: </label>
<input name="latitude" type="text" value="<?php print($config['LATITUDE']);?>" required/><br>
<label for="longitude">Longitude: </label>
<input name="longitude" type="text" value="<?php print($config['LONGITUDE']);?>" required/><br>
<label for="birdweather_id">BirdWeather ID: </label>
<input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
<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>
<br>
<label for"language">Database Language: </label>
<select name="language">
<option value="none">Select your language</option>
<option value="labels_af.txt">Afrikaans</option>
<option value="labels_ca.txt">Catalan</option>
<option value="labels_cs.txt">Czech</option>
<option value="labels_zh.txt">Chinese</option>
<option value="labels_hr.txt">Croatian</option>
<option value="labels_da.txt">Danish</option>
<option value="labels_nl.txt">Dutch</option>
<option value="labels_en.txt">English</option>
<option value="labels_et.txt">Estonian</option>
<option value="labels_fi.txt">Finnish</option>
<option value="labels_fr.txt">French</option>
<option value="labels_de.txt">German</option>
<option value="labels_hu.txt">Hungarian</option>
<option value="labels_is.txt">Icelandic</option>
<option value="labels_id.txt">Indonesia</option>
<option value="labels_it.txt">Italian</option>
<option value="labels_ja.txt">Japanese</option>
<option value="labels_lv.txt">Latvian</option>
<option value="labels_lt.txt">Lithuania</option>
<option value="labels_no.txt">Norwegian</option>
<option value="labels_pl.txt">Polish</option>
<option value="labels_pt.txt">Portugues</option>
<option value="labels_ru.txt">Russian</option>
<option value="labels_sk.txt">Slovak</option>
<option value="labels_sl.txt">Slovenian</option>
<option value="labels_es.txt">Spanish</option>
<option value="labels_sv.txt">Swedish</option>
<option value="labels_th.txt">Thai</option>
<option value="labels_uk.txt">Ukrainian</option>
</select>
<br><br>
<input type="submit" value="<?php
@session_start();
if(isset($_SESSION['success'])){
echo "Success!";
unset($_SESSION['success']);
} else {
echo "Update Settings";
}
?>">
<br>
<br>
<button type="text"><a href="advanced.php">Advanced Settings</a></button>
</form>
</div>
</div>
</body>
+11 -11
View File
@@ -57,19 +57,19 @@ a {
<div class="column first"> <div class="column first">
<form action="/scripts/stop_core_services.php" onclick="return confirm('Stop core services?')"> <form action="/scripts/stop_core_services.php" onclick="return confirm('Stop core services?')">
<button type="submit" class="block">Stop Core BirdNET-Pi Services</button> <button type="submit" class="block">Stop Core Services</button>
</form> </form>
<form action="/scripts/restart_services.php" onclick="return confirm('Restart ALL services?')"> <form action="/scripts/restart_services.php" onclick="return confirm('Restart ALL services?')">
<button type="submit" class="block">Restart ALL BirdNET-Pi Services</button> <button type="submit" class="block">Restart ALL Services</button>
</form> </form>
<form action="/scripts/restart_birdnet_analysis.php"> <form action="/scripts/restart_birdnet_analysis.php">
<button type="submit" class="block">Restart BirdNET Analysis Service</button> <button type="submit" class="block">Restart BirdNET Analysis</button>
</form> </form>
<form action="/scripts/restart_birdnet_recording.php"> <form action="/scripts/restart_birdnet_recording.php">
<button type="submit" class="block">Restart Recording Service</button> <button type="submit" class="block">Restart Recording</button>
</form> </form>
<form action="/scripts/restart_extraction.php"> <form action="/scripts/restart_extraction.php">
<button type="submit" class="block">Restart Extraction Service</button> <button type="submit" class="block">Restart Extraction</button>
</form> </form>
<form action="/scripts/restart_caddy.php" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')"> <form action="/scripts/restart_caddy.php" onclick="return confirm('Restart Caddy? You will be disconnected for about 20 seconds.')">
<button type="submit" class="block">Restart Caddy</button> <button type="submit" class="block">Restart Caddy</button>
@@ -79,18 +79,18 @@ a {
<form > <form >
<button type="submit" class="block"><a target="_content" href="/scripts/adminer.php">Database Maintenance</a></button> <button type="submit" class="block"><a target="_content" href="/scripts/adminer.php">Database Maintenance</a></button>
</form> </form>
<form action="/scripts/config.php">
<form action="/scripts/backup_data.php" onclick="return confirm('Backup ALL Data? Warning: This could take a long time.')"> <button type="submit" class="block">Settings</button>
<button type="submit" class="block">Backup ALL data</button> </form>
</form> </form>
<form action="/scripts/reboot_system.php" onclick="return confirm('Are you sure you want to reboot?')"> <form action="/scripts/reboot_system.php" onclick="return confirm('Are you sure you want to reboot?')">
<button type="submit" class="block">Reboot BirdNET-Pi</button> <button type="submit" class="block">Reboot</button>
</form> </form>
<form action="/scripts/update_birdnet.php" onclick="return confirm('BE SURE TO STASH ANY LOCAL CHANGES YOU HAVE MADE TO THE SYSTEM BEFORE UPDATING!!!')"> <form action="/scripts/update_birdnet.php" onclick="return confirm('BE SURE TO STASH ANY LOCAL CHANGES YOU HAVE MADE TO THE SYSTEM BEFORE UPDATING!!!')">
<button style="color:blue;" type="submit" class="block">Update BirdNET-Pi</button> <button style="color:blue;" type="submit" class="block">Update</button>
</form> </form>
<form action="/scripts/shutdown_system.php" onclick="return confirm('Are you sure you want to shutdown?')"> <form action="/scripts/shutdown_system.php" onclick="return confirm('Are you sure you want to shutdown?')">
<button style="color: red;" type="submit" class="block">Shutdown BirdNET-Pi</button> <button style="color: red;" type="submit" class="block">Shutdown</button>
</form> </form>
<form action="/scripts/clear_all_data.php" onclick="return confirm('Clear ALL Data? This cannot be undone.')"> <form action="/scripts/clear_all_data.php" onclick="return confirm('Clear ALL Data? This cannot be undone.')">
<button style="color: red;" type="submit" class="block">Clear ALL data</button> <button style="color: red;" type="submit" class="block">Clear ALL data</button>
+3 -12
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Install BirdNET script # Install BirdNET script
#set -x # debugging set -x # debugging
set -e # exit installation if anything fails set -e # exit installation if anything fails
my_dir=$(realpath $(dirname $0)) my_dir=$(realpath $(dirname $0))
trap '${my_dir}/dump_logs.sh && echo -e "\n\nExiting the installation. Goodbye!" && exit 1' SIGINT trap '${my_dir}/dump_logs.sh && echo -e "\n\nExiting the installation. Goodbye!" && exit 1' SIGINT
@@ -20,8 +20,8 @@ fi
sudo ./install_services.sh || exit 1 sudo ./install_services.sh || exit 1
source /etc/birdnet/birdnet.conf source /etc/birdnet/birdnet.conf
APT_DEPS=(swig ffmpeg wget unzip curl cmake make) APT_DEPS=(swig ffmpeg wget unzip curl cmake make bc)
LIBS_MODULES=(libjpeg-dev zlib1g-dev python3-dev python3-pip) LIBS_MODULES=(libjpeg-dev zlib1g-dev python3-dev python3-pip python3-venv)
install_deps() { install_deps() {
echo " Checking dependencies" echo " Checking dependencies"
@@ -70,15 +70,6 @@ install_birdnet() {
pip3 install -U -r /home/pi/BirdNET-Pi/requirements.txt pip3 install -U -r /home/pi/BirdNET-Pi/requirements.txt
} }
read -sp "\
Be sure you have read the software license before installing. This is
available in the BirdNET-Pi directory as "LICENSE"
If you DO NOT want to install BirdNET and the birdnet_analysis.service,
press Ctrl+C to cancel. If you DO wish to install BirdNET and the
birdnet_analysis.service, press ENTER to continue with the installation."
echo
echo
[ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} &> /dev/null [ -d ${RECS_DIR} ] || mkdir -p ${RECS_DIR} &> /dev/null
install_deps install_deps
+8
View File
@@ -5,6 +5,7 @@ set -e
trap 'exit 1' SIGINT SIGHUP trap 'exit 1' SIGINT SIGHUP
my_dir=$(realpath $(dirname $0)) my_dir=$(realpath $(dirname $0))
birdnetpi_dir=$(realpath $(dirname $my_dir))
BIRDNET_CONF="$(dirname ${my_dir})/birdnet.conf" BIRDNET_CONF="$(dirname ${my_dir})/birdnet.conf"
get_RECS_DIR() { get_RECS_DIR() {
@@ -375,12 +376,19 @@ EOF
# non-interactive installation. Otherwise,the installation is interactive. # non-interactive installation. Otherwise,the installation is interactive.
if [ -f ${BIRDNET_CONF} ];then if [ -f ${BIRDNET_CONF} ];then
source ${BIRDNET_CONF} source ${BIRDNET_CONF}
chmod g+w ${BIRDNET_CONF}
sed -i "s/LATITUDE=.*/LATITUDE=${LATITUDE}/g" ${BIRDNET_CONF}
sed -i "s/LONGITUDE=.*/LONGITUDE=${LONGITUDE}/g" ${BIRDNET_CONF}
sed -i "s/DB_PWD=.*/DB_PWD=${DB_PWD}/g" ${BIRDNET_CONF}
#install_birdnet_conf #install_birdnet_conf
[ -d /etc/birdnet ] || sudo mkdir /etc/birdnet [ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf
grep -ve '^#' -e '^$' /etc/birdnet/birdnet.conf > ${birdnetpi_dir}/firstrun.ini
else else
configure configure
install_birdnet_conf install_birdnet_conf
chmod g+w ${BIRDNET_CONF}
[ -d /etc/birdnet ] || sudo mkdir /etc/birdnet [ -d /etc/birdnet ] || sudo mkdir /etc/birdnet
sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf sudo ln -sf $(dirname ${my_dir})/birdnet.conf /etc/birdnet/birdnet.conf
grep -ve '^#' -e '^$' /etc/birdnet/birdnet.conf > ${birdnetpi_dir}/firstrun.ini
fi fi
+33 -24
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This installs the services that have been selected # This installs the services that have been selected
#set -x # Uncomment to enable debugging set -x # Uncomment to enable debugging
trap 'rm -f ${tmpfile}' EXIT trap 'rm -f ${tmpfile}' EXIT
trap 'exit 1' SIGINT SIGHUP trap 'exit 1' SIGINT SIGHUP
USER=pi USER=pi
@@ -16,10 +16,13 @@ set_hostname() {
echo "Setting hostname to 'birdnetpi'" echo "Setting hostname to 'birdnetpi'"
hostnamectl set-hostname birdnetpi hostnamectl set-hostname birdnetpi
sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts
sed -i 's/localhost$/localhost birdnetpi.local/g' /etc/hosts
fi fi
} }
update_system() {
apt update && apt -y upgrade
}
install_scripts() { install_scripts() {
echo "Installing BirdNET-Pi scripts to /usr/local/bin" echo "Installing BirdNET-Pi scripts to /usr/local/bin"
ln -sf ${my_dir}/* /usr/local/bin/ ln -sf ${my_dir}/* /usr/local/bin/
@@ -188,6 +191,15 @@ install_alsa() {
apt install -qqy pulseaudio apt install -qqy pulseaudio
echo "PulseAudio installed" echo "PulseAudio installed"
fi fi
if ! [ -d /etc/lightdm ];then
systemctl set-default multi-user.target
ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
EOF
fi
} }
install_recording_service() { install_recording_service() {
@@ -219,9 +231,11 @@ install_caddy() {
apt -qq update apt -qq update
apt install -qqy caddy=2.4.5 && apt-mark hold caddy apt install -qqy caddy=2.4.5 && apt-mark hold caddy
systemctl enable --now caddy systemctl enable --now caddy
usermod -aG pi caddy
else else
echo "Caddy is installed" echo "Caddy is installed"
systemctl enable --now caddy systemctl enable --now caddy
usermod -aG pi caddy
fi fi
} }
@@ -232,6 +246,7 @@ install_Caddyfile() {
cp /etc/caddy/Caddyfile{,.original} cp /etc/caddy/Caddyfile{,.original}
fi fi
php_version="$(awk -F'php' '{print $3}' <(ls -l $(which /etc/alternatives/php)))" php_version="$(awk -F'php' '{print $3}' <(ls -l $(which /etc/alternatives/php)))"
if ! [ -z ${CADDY_PWD} ];then
HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD}) HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD})
cat << EOF > /etc/caddy/Caddyfile cat << EOF > /etc/caddy/Caddyfile
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} { http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
@@ -253,6 +268,17 @@ http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
php_fastcgi unix//run/php/php${php_version}-fpm.sock php_fastcgi unix//run/php/php${php_version}-fpm.sock
} }
EOF EOF
else
cat << EOF > /etc/caddy/Caddyfile
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
root * ${EXTRACTED}
file_server browse
reverse_proxy /stream localhost:8000
php_fastcgi unix//run/php/php${php_version}-fpm.sock
}
EOF
fi
if [ ! -z ${EXTRACTIONLOG_URL} ];then if [ ! -z ${EXTRACTIONLOG_URL} ];then
cat << EOF >> /etc/caddy/Caddyfile cat << EOF >> /etc/caddy/Caddyfile
@@ -296,7 +322,7 @@ Requires=network-online.target
Restart=always Restart=always
RestartSec=3 RestartSec=3
Type=simple Type=simple
ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(avahi-resolve -4 -n %H.local | cut -f 2)" ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' ' -f1)"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@@ -416,25 +442,6 @@ EOF
fi fi
} }
install_edit_birdnet_conf() {
cat << EOF > /etc/systemd/system/edit_birdnet_conf.service
[Unit]
Description=Edit birdnet.conf
[Service]
Restart=on-failure
RestartSec=3
Type=simple
User=pi
Environment=TERM=xterm-256color
ExecStart=/usr/local/bin/gotty -w -p 9898 --title-format "Edit birdnet.conf" nano /home/pi/BirdNET-Pi/birdnet.conf
[Install]
WantedBy=multi-user.target
EOF
}
install_icecast() { install_icecast() {
if ! which icecast2;then if ! which icecast2;then
echo "Installing IceCast2" echo "Installing IceCast2"
@@ -486,11 +493,13 @@ EOF
} }
install_nomachine() { install_nomachine() {
if [ ! -d /usr/share/NX ];then if [ ! -d /usr/share/NX ] && [ -d /etc/lightdm ];then
echo "Installing NoMachine" echo "Installing NoMachine"
curl -s -o ${HOME}/nomachine.deb -O "${nomachine_url}" curl -s -o ${HOME}/nomachine.deb -O "${nomachine_url}"
apt install -y ${HOME}/nomachine.deb apt install -y ${HOME}/nomachine.deb
rm -f ${HOME}/nomachine.deb rm -f ${HOME}/nomachine.deb
echo "Enabling VNC"
systemctl enable --now vncserver-x11-serviced.service
fi fi
} }
@@ -507,6 +516,7 @@ install_cleanup_cron() {
install_selected_services() { install_selected_services() {
set_hostname set_hostname
update_system
install_scripts install_scripts
install_birdnet_analysis install_birdnet_analysis
@@ -529,7 +539,6 @@ install_selected_services() {
install_mariadb install_mariadb
install_spectrogram_service install_spectrogram_service
install_chart_viewer_service install_chart_viewer_service
install_edit_birdnet_conf
install_pushed_notifications install_pushed_notifications
if [ ! -z "${ICE_PWD}" ];then if [ ! -z "${ICE_PWD}" ];then
+8 -1
View File
@@ -1,6 +1,7 @@
<?php <?php
header("refresh: 300;"); header("refresh: 300;");
$myDate = date('d-m-Y'); $myDate = date('d-m-Y');
$chart = "Combo-$myDate.png";
$mysqli = mysqli_connect(); $mysqli = mysqli_connect();
$mysqli->select_db('birds'); $mysqli->select_db('birds');
@@ -119,7 +120,13 @@ while($rows=$mostrecent ->fetch_assoc())
</div> </div>
</div> </div>
<h2>Today's Top 10 Species</h2> <h2>Today's Top 10 Species</h2>
<img src='/Charts/Combo-<?php echo $myDate;?>.png?nocache=<?php echo time();?>' style="width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;"> <?php
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
echo "<img src=\"/Charts/$chart?nocache=$time()\" style=\"width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
} else {
echo "<p style=\"text-align:center;margin-left:-150px;\">No Detections For Today</p>";
}
?>
<h2>Currently Analyzing</h2> <h2>Currently Analyzing</h2>
<img src='/spectrogram.png?nocache=<?php echo time();?>' style="width: 100%;padding: 5px;"> <img src='/spectrogram.png?nocache=<?php echo time();?>' style="width: 100%;padding: 5px;">
</html> </html>
+1 -1
View File
@@ -2,4 +2,4 @@
header("refresh: 15;"); header("refresh: 15;");
echo "<body style='background-color:rgb(119, 196, 135)'>"; echo "<body style='background-color:rgb(119, 196, 135)'>";
?> ?>
<img src='/spectrogram.png?nocache=<?php echo time();?>' style='display: block;margin-left: auto;margin-right: auto; height: 100%;'> <img src='/spectrogram.png?nocache=<?php echo time();?>' style='display: block; height: 100%; width: 100%;'>
BIN
View File
Binary file not shown.
+32 -23
View File
@@ -16,10 +16,13 @@ set_hostname() {
echo "Setting hostname to 'birdnetpi'" echo "Setting hostname to 'birdnetpi'"
hostnamectl set-hostname birdnetpi hostnamectl set-hostname birdnetpi
sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts sed -i 's/raspberrypi/birdnetpi/g' /etc/hosts
sed -i 's/localhost$/localhost birdnetpi.local/g' /etc/hosts
fi fi
} }
update_system() {
apt update && apt -y upgrade
}
install_scripts() { install_scripts() {
echo "Installing BirdNET-Pi scripts to /usr/local/bin" echo "Installing BirdNET-Pi scripts to /usr/local/bin"
ln -sf ${my_dir}/* /usr/local/bin/ ln -sf ${my_dir}/* /usr/local/bin/
@@ -185,6 +188,16 @@ install_alsa() {
apt install -qqy pulseaudio apt install -qqy pulseaudio
echo "PulseAudio installed" echo "PulseAudio installed"
fi fi
if ! [ -d /etc/lightdm ];then
systemctl set-default multi-user.target
ln -fs /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty1.service
cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM
EOF
fi
} }
install_recording_service() { install_recording_service() {
@@ -229,6 +242,7 @@ install_Caddyfile() {
cp /etc/caddy/Caddyfile{,.original} cp /etc/caddy/Caddyfile{,.original}
fi fi
php_version="$(awk -F'php' '{print $3}' <(ls -l $(which /etc/alternatives/php)))" php_version="$(awk -F'php' '{print $3}' <(ls -l $(which /etc/alternatives/php)))"
if ! [ -z ${CADDY_PWD} ];then
HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD}) HASHWORD=$(caddy hash-password -plaintext ${CADDY_PWD})
cat << EOF > /etc/caddy/Caddyfile cat << EOF > /etc/caddy/Caddyfile
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} { http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
@@ -250,6 +264,17 @@ http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
php_fastcgi unix//run/php/php${php_version}-fpm.sock php_fastcgi unix//run/php/php${php_version}-fpm.sock
} }
EOF EOF
else
cat << EOF > /etc/caddy/Caddyfile
http://localhost http://birdnetpi.local ${BIRDNETPI_URL} {
root * ${EXTRACTED}
file_server browse
reverse_proxy /stream localhost:8000
php_fastcgi unix//run/php/php${php_version}-fpm.sock
}
EOF
fi
if [ ! -z ${EXTRACTIONLOG_URL} ];then if [ ! -z ${EXTRACTIONLOG_URL} ];then
cat << EOF >> /etc/caddy/Caddyfile cat << EOF >> /etc/caddy/Caddyfile
@@ -291,8 +316,9 @@ Requires=network-online.target
[Service] [Service]
Restart=always Restart=always
RestartSec=3
Type=simple Type=simple
ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(avahi-resolve -4 -n %H.local | cut -f 2)" ExecStart=/bin/bash -c "/usr/bin/avahi-publish -a -R %I $(hostname -I |cut -d' ' -f1)"
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@@ -411,25 +437,6 @@ EOF
fi fi
} }
install_edit_birdnet_conf() {
cat << EOF > /etc/systemd/system/edit_birdnet_conf.service
[Unit]
Description=Edit birdnet.conf
[Service]
Restart=on-failure
RestartSec=3
Type=simple
User=pi
Environment=TERM=xterm-256color
ExecStart=/usr/local/bin/gotty -w -p 9898 --title-format "Edit birdnet.conf" nano /home/pi/BirdNET-Pi/birdnet.conf
[Install]
WantedBy=multi-user.target
EOF
}
install_icecast() { install_icecast() {
if ! which icecast2;then if ! which icecast2;then
echo "Installing IceCast2" echo "Installing IceCast2"
@@ -481,11 +488,13 @@ EOF
} }
install_nomachine() { install_nomachine() {
if [ ! -d /usr/share/NX ];then if [ ! -d /usr/share/NX ] && [ -d /etc/lightdm ];then
echo "Installing NoMachine" echo "Installing NoMachine"
curl -s -o ${HOME}/nomachine.deb -O "${nomachine_url}" curl -s -o ${HOME}/nomachine.deb -O "${nomachine_url}"
apt install -y ${HOME}/nomachine.deb apt install -y ${HOME}/nomachine.deb
rm -f ${HOME}/nomachine.deb rm -f ${HOME}/nomachine.deb
echo "Enabling VNC"
systemctl enable --now vncserver-x11-serviced.service
fi fi
} }
@@ -502,6 +511,7 @@ install_cleanup_cron() {
install_selected_services() { install_selected_services() {
set_hostname set_hostname
update_system
install_scripts install_scripts
install_birdnet_analysis install_birdnet_analysis
@@ -524,7 +534,6 @@ install_selected_services() {
install_mariadb install_mariadb
install_spectrogram_service install_spectrogram_service
install_chart_viewer_service install_chart_viewer_service
install_edit_birdnet_conf
install_pushed_notifications install_pushed_notifications
if [ ! -z "${ICE_PWD}" ];then if [ ! -z "${ICE_PWD}" ];then
+8 -1
View File
@@ -1,6 +1,7 @@
<?php <?php
header("refresh: 300;"); header("refresh: 300;");
$myDate = date('d-m-Y'); $myDate = date('d-m-Y');
$chart = "Combo-$myDate.png";
$mysqli = mysqli_connect(); $mysqli = mysqli_connect();
$mysqli->select_db('birds'); $mysqli->select_db('birds');
@@ -64,7 +65,13 @@ table,th,td {
</style> </style>
</head> </head>
<img src='/Charts/Combo-<?php echo $myDate;?>.png?nocache=<?php echo time();?>' class="center"> <?php
if (file_exists('/home/pi/BirdSongs/Extracted/Charts/'.$chart)) {
echo "<img src=\"/Charts/$chart?nocache=$time()\" style=\"width: 100%;padding: 5px;margin-left: auto;margin-right: auto;display: block;\">";
} else {
echo "<p style=\"text-align:center;margin-left:-150px;\">No Detections For Today</p>";
}
?>
<body style="background-color: rgb(119, 196, 135);"> <body style="background-color: rgb(119, 196, 135);">
<section> <section>
+60
View File
@@ -0,0 +1,60 @@
<?php
$caddy_pwd = $_POST["caddy_pwd"];
$db_pwd = $_POST["db_pwd"];
$ice_pwd = $_POST["ice_pwd"];
$birdnetpi_url = $_POST["birdnetpi_url"];
$extractionlog_url = $_POST["extractionlog_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("/EXTRACTIONLOG_URL=.*/", "EXTRACTIONLOG_URL=$extractionlog_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("/EXTRACTIONLOG_URL=.*/", "EXTRACTIONLOG_URL=$extractionlog_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");
}
?>
+46
View File
@@ -0,0 +1,46 @@
<?php
$latitude = $_POST["latitude"];
$longitude = $_POST["longitude"];
$birdweather_id = $_POST["birdweather_id"];
$pushed_app_key = $_POST["pushed_app_key"];
$pushed_app_secret = $_POST["pushed_app_secret"];
$contents = file_get_contents("/home/pi/BirdNET-Pi/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("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents);
$contents = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $contents);
$contents2 = file_get_contents("/home/pi/BirdNET-Pi/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("/PUSHED_APP_KEY=.*/", "PUSHED_APP_KEY=$pushed_app_key", $contents2);
$contents2 = preg_replace("/PUSHED_APP_SECRET=.*/", "PUSHED_APP_SECRET=$pushed_app_secret", $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:config.php");
}
$language = $_POST["language"];
if ($language != "none"){
$command = "sudo -upi set -x; sudo -upi mv /home/pi/BirdNET-Pi/model/labels.txt /home/pi/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/pi/BirdNET-Pi/model/labels_l18n.zip $language -d /home/pi/BirdNET-Pi/model && sudo -upi mv /home/pi/BirdNET-Pi/model/$language /home/pi/BirdNET-Pi/model/labels.txt";
$command_output = `$command`;
echo $command_output;
@session_start();
if(true){
$_SESSION['success'] = 1;
header("Location:config.php");
}
}
?>
+6
View File
@@ -1,3 +1,9 @@
# main v.11
- New "Reconfigure System" GUI
- labels.txt language support for 20+ languages
- Tool in `birdnet-pi-config` for now
- Added German top.html and menu.html
# main v.10 & pre-installed image notes # main v.10 & pre-installed image notes
- New "BirdWeather" Chromium App (Pre-install image) - New "BirdWeather" Chromium App (Pre-install image)
- New Infographics _chart_viewer.service_ (courtesy of @CaiusX) - New Infographics _chart_viewer.service_ (courtesy of @CaiusX)