Merge pull request #651 from lloydbayley/main
Add Site Name to settings.
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
# Configuration settings for BirdNET-Pi #
|
||||
################################################################################
|
||||
|
||||
# Site Name - Optional
|
||||
|
||||
SITE_NAME=""
|
||||
|
||||
|
||||
#--------------------- Required: Latitude, and Longitude ----------------------#
|
||||
|
||||
## Please only go to 4 decimal places. Example:43.3984
|
||||
|
||||
@@ -16,6 +16,16 @@ echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\
|
||||
echo "<a href=\"https://github.com/mcguirepr89/BirdNET-Pi.git\" target=\"_blank\"><img src=\"images/bird.png\"></a>";
|
||||
}?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if (file_exists('./scripts/thisrun.txt')) {
|
||||
$config = parse_ini_file('./scripts/thisrun.txt');
|
||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
||||
$config = parse_ini_file('./scripts/firstrun.ini');
|
||||
}
|
||||
$site_name = $config['SITE_NAME'];
|
||||
?>
|
||||
|
||||
<div class="stream">
|
||||
<?php
|
||||
if(isset($_GET['stream'])){
|
||||
|
||||
@@ -22,6 +22,8 @@ if(isset($_GET['restart_php']) && $_GET['restart_php'] == "true") {
|
||||
if(isset($_GET["latitude"])){
|
||||
$latitude = $_GET["latitude"];
|
||||
$longitude = $_GET["longitude"];
|
||||
$site_name = $_GET["site_name"];
|
||||
$site_name = preg_replace( '/[^A-Za-z0-9 ]/' , "", $site_name);
|
||||
$birdweather_id = $_GET["birdweather_id"];
|
||||
$apprise_input = $_GET['apprise_input'];
|
||||
$apprise_notification_title = $_GET['apprise_notification_title'];
|
||||
@@ -99,6 +101,7 @@ if(isset($_GET["latitude"])){
|
||||
|
||||
|
||||
$contents = file_get_contents("/etc/birdnet/birdnet.conf");
|
||||
$contents = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents);
|
||||
$contents = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents);
|
||||
$contents = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents);
|
||||
$contents = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents);
|
||||
@@ -114,6 +117,7 @@ if(isset($_GET["latitude"])){
|
||||
$contents = preg_replace("/APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=.*/", "APPRISE_MINIMUM_SECONDS_BETWEEN_NOTIFICATIONS_PER_SPECIES=$minimum_time_limit", $contents);
|
||||
|
||||
$contents2 = file_get_contents("./scripts/thisrun.txt");
|
||||
$contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2);
|
||||
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
|
||||
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
|
||||
$contents2 = preg_replace("/BIRDWEATHER_ID=.*/", "BIRDWEATHER_ID=$birdweather_id", $contents2);
|
||||
@@ -295,6 +299,8 @@ function sendTestNotification(e) {
|
||||
|
||||
<table class="settingstable"><tr><td>
|
||||
<h2>Location</h2>
|
||||
<label for="site_name">Site Name: </label>
|
||||
<input name="site_name" type="text" value="<?php print($config['SITE_NAME']);?>"/> (Optional)<br>
|
||||
<label for="latitude">Latitude: </label>
|
||||
<input name="latitude" type="number" max="90" min="-90" step="0.0001" value="<?php print($config['LATITUDE']);?>" required/><br>
|
||||
<label for="longitude">Longitude: </label>
|
||||
|
||||
@@ -13,12 +13,17 @@ install_config() {
|
||||
# Configuration settings for BirdNET-Pi #
|
||||
################################################################################
|
||||
|
||||
# Optional: Site Title for banner
|
||||
|
||||
SITE_NAME="$HOSTNAME"
|
||||
|
||||
#--------------------- Required: Latitude, and Longitude ----------------------#
|
||||
|
||||
## The shell substitution below guesses these based on your network. THESE NEED
|
||||
## TO BE CHANGED TO STATIC VALUES
|
||||
## Please only go to 4 decimal places. Example:43.3984
|
||||
|
||||
|
||||
LATITUDE=$(curl -s4 ifconfig.co/json | jq .latitude)
|
||||
LONGITUDE=$(curl -s4 ifconfig.co/json | jq .longitude)
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ my_dir=$HOME/BirdNET-Pi/scripts
|
||||
sudo -E chown -R $USER:$USER $HOME/*
|
||||
sudo chmod -R g+wr $HOME/*
|
||||
|
||||
# Create blank sitename as it's optional. First time install will use $HOSTNAME.
|
||||
if ! grep SITE_NAME /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
sudo -u$USER echo "SITE_NAME=\"\"" >> /etc/birdnet/birdnet.conf
|
||||
fi
|
||||
|
||||
if ! grep PRIVACY_THRESHOLD /etc/birdnet/birdnet.conf &>/dev/null;then
|
||||
sudo -u$USER echo "PRIVACY_THRESHOLD=0" >> /etc/birdnet/birdnet.conf
|
||||
git -C $HOME/BirdNET-Pi rm $my_dir/privacy_server.py
|
||||
|
||||
Reference in New Issue
Block a user