resolve #934
This commit is contained in:
+18
-20
@@ -2,14 +2,14 @@
|
|||||||
error_reporting(E_ERROR);
|
error_reporting(E_ERROR);
|
||||||
ini_set('display_errors',1);
|
ini_set('display_errors',1);
|
||||||
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
||||||
$home = trim($home);
|
$home = trim($home);
|
||||||
|
if (file_exists($home.'/BirdNET-Pi/scripts/thisrun.txt')) {
|
||||||
|
$config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.txt');
|
||||||
|
} elseif (file_exists($home.'/BirdNET-Pi/scripts/thisrun.ini')) {
|
||||||
|
$config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.ini');
|
||||||
|
}
|
||||||
if (file_exists($home."/BirdNET-Pi/apprise.txt")) {
|
if (file_exists($home."/BirdNET-Pi/apprise.txt")) {
|
||||||
$apprise_config = file_get_contents($home."/BirdNET-Pi/apprise.txt");
|
$apprise_config = file_get_contents($home."/BirdNET-Pi/apprise.txt");
|
||||||
} else {
|
} else {
|
||||||
@@ -136,11 +136,10 @@ if(isset($_GET["latitude"])){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Language settings only if a change is requested
|
if (file_exists($home.'/BirdNET-Pi/scripts/thisrun.txt')) {
|
||||||
if (file_exists('./scripts/thisrun.txt')) {
|
$lang_config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.txt');
|
||||||
$lang_config = parse_ini_file('./scripts/thisrun.txt');
|
} elseif (file_exists($home.'/BirdNET-Pi/scripts/thisrun.ini')) {
|
||||||
} elseif (file_exists('./scripts/firstrun.ini')) {
|
$lang_config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.ini');
|
||||||
$lang_config = parse_ini_file('./scripts/firstrun.ini');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($model != $lang_config['MODEL'] || $language != $lang_config['DATABASE_LANG']){
|
if ($model != $lang_config['MODEL'] || $language != $lang_config['DATABASE_LANG']){
|
||||||
@@ -183,7 +182,7 @@ if(isset($_GET["latitude"])){
|
|||||||
$contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents);
|
$contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES=\"$only_notify_species_names\"", $contents);
|
||||||
$contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"$only_notify_species_names_2\"", $contents);
|
$contents = preg_replace("/APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=.*/", "APPRISE_ONLY_NOTIFY_SPECIES_NAMES_2=\"$only_notify_species_names_2\"", $contents);
|
||||||
|
|
||||||
$contents2 = file_get_contents("./scripts/thisrun.txt");
|
$contents2 = file_get_contents($home."/BirdNET-Pi/scripts/thisrun.txt");
|
||||||
$contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2);
|
$contents2 = preg_replace("/SITE_NAME=.*/", "SITE_NAME=\"$site_name\"", $contents2);
|
||||||
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
|
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
|
||||||
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
|
$contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2);
|
||||||
@@ -213,7 +212,7 @@ if(isset($_GET["latitude"])){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$fh = fopen("/etc/birdnet/birdnet.conf", "w");
|
$fh = fopen("/etc/birdnet/birdnet.conf", "w");
|
||||||
$fh2 = fopen("./scripts/thisrun.txt", "w");
|
$fh2 = fopen($home."/BirdNET-Pi/scripts/thisrun.txt", "w");
|
||||||
fwrite($fh, $contents);
|
fwrite($fh, $contents);
|
||||||
fwrite($fh2, $contents2);
|
fwrite($fh2, $contents2);
|
||||||
|
|
||||||
@@ -231,18 +230,17 @@ if(isset($_GET["latitude"])){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
|
if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") {
|
||||||
$db = new SQLite3('./birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
|
||||||
|
|
||||||
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
$user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd");
|
||||||
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
$home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd");
|
||||||
$home = trim($home);
|
$home = trim($home);
|
||||||
|
if (file_exists($home.'/BirdNET-Pi/scripts/thisrun.txt')) {
|
||||||
if (file_exists('./thisrun.txt')) {
|
$config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.txt');
|
||||||
$config = parse_ini_file('./thisrun.txt');
|
} elseif (file_exists($home.'/BirdNET-Pi/scripts/thisrun.ini')) {
|
||||||
} elseif (file_exists('./firstrun.ini')) {
|
$config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.ini');
|
||||||
$config = parse_ini_file('./firstrun.ini');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db = new SQLite3($home."/BirdNET-Pi/scripts/birds.db", SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE);
|
||||||
|
|
||||||
$cf = explode("\n",$_GET['apprise_config']);
|
$cf = explode("\n",$_GET['apprise_config']);
|
||||||
$cf = "'".implode("' '", $cf)."'";
|
$cf = "'".implode("' '", $cf)."'";
|
||||||
|
|
||||||
@@ -497,7 +495,7 @@ function runProcess() {
|
|||||||
<h2>BirdWeather</h2>
|
<h2>BirdWeather</h2>
|
||||||
<label for="birdweather_id">BirdWeather ID: </label>
|
<label for="birdweather_id">BirdWeather ID: </label>
|
||||||
<input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
|
<input name="birdweather_id" type="text" value="<?php print($config['BIRDWEATHER_ID']);?>" /><br>
|
||||||
<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('./scripts/birdweather_request.php'); ?>" target="_blank">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($home.'/BirdNET-Pi/scripts/birdweather_request.php'); ?>" target="_blank">Email Tim</a> to request a BirdWeather ID</p>
|
||||||
</td></tr></table><br>
|
</td></tr></table><br>
|
||||||
<table class="settingstable" style="width:100%"><tr><td>
|
<table class="settingstable" style="width:100%"><tr><td>
|
||||||
<h2>Notifications</h2>
|
<h2>Notifications</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user