Merge branch 'newif' of github.com:mcguirepr89/BirdNET-Pi into newif

This commit is contained in:
mcguirepr89
2022-02-25 11:54:00 -05:00
20 changed files with 113 additions and 1205 deletions
-14
View File
@@ -1,14 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$file='/home/pi/BirdNET-Pi/exclude_species_list.txt';
$str=file_get_contents("$file");
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
file_put_contents("$file", "$str");
if (isset($_POST['species']))
foreach ($_POST['species'] as $selectedOption)
file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND);
header("Location: {$_SERVER['HTTP_REFERER']}");
exit;
?>
-14
View File
@@ -1,14 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$file='/home/pi/BirdNET-Pi/include_species_list.txt';
$str=file_get_contents("$file");
$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
file_put_contents("$file", "$str");
if (isset($_POST['species']))
foreach ($_POST['species'] as $selectedOption)
file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", $selectedOption."\n", FILE_APPEND);
header("Location: {$_SERVER['HTTP_REFERER']}");
exit;
?>
-2
View File
@@ -67,8 +67,6 @@ sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/phpsysinfo.ini ${HOME}/phps
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
sudo -u ${USER} cp -f $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
echo "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}""
sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
sudo chmod -R g+rw $(dirname ${my_dir})
sudo chmod -R g+rw ${RECS_DIR}
-22
View File
@@ -1,22 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$file='/home/pi/BirdNET-Pi/exclude_species_list.txt';
$str=file_get_contents("$file");
$str = preg_replace('/^\h*\v+/m', '', $str);
file_put_contents("$file", "$str");
if (isset($_POST['species']))
foreach($_POST['species'] as $selectedOption) {
$content = file_get_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt");
$newcontent = str_replace($selectedOption, "", "$content");
file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", "$newcontent");
}
$file='/home/pi/BirdNET-Pi/exclude_species_list.txt';
$str=file_get_contents("$file");
//$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
$str = preg_replace('/^\h*\v+/m', '', $str);
file_put_contents("$file", "$str");
header("Location: {$_SERVER['HTTP_REFERER']}");
exit;
?>
-22
View File
@@ -1,22 +0,0 @@
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
$file='/home/pi/BirdNET-Pi/include_species_list.txt';
$str=file_get_contents("$file");
$str = preg_replace('/^\h*\v+/m', '', $str);
file_put_contents("$file", "$str");
if (isset($_POST['species']))
foreach($_POST['species'] as $selectedOption) {
$content = file_get_contents("/home/pi/BirdNET-Pi/include_species_list.txt");
$newcontent = str_replace($selectedOption, "", "$content");
file_put_contents("/home/pi/BirdNET-Pi/include_species_list.txt", "$newcontent");
}
$file='/home/pi/BirdNET-Pi/include_species_list.txt';
$str=file_get_contents("$file");
//$str = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $str);
$str = preg_replace('/^\h*\v+/m', '', $str);
file_put_contents("$file", "$str");
header("Location: {$_SERVER['HTTP_REFERER']}");
exit;
?>
+19 -98
View File
@@ -1,121 +1,42 @@
<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;
box-sizing: border-box;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
}
.first {
width: 45%;
}
.second {
width: 10%;
display: flex;
justify-content: center;
flex-direction: column;
height: 100%;
}
.third {
width: 45%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
body {
background-color: rgb(119, 196, 135);
}
a {
text-decoration: none;
color: white;
}
.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;
}
h2 {
text-align: center;
}
select {
width:100%
}
@media screen and (max-width: 800px) {
.column {
float: none;
width: 100%;
}
}
</style>
<?php
//remove <script></script> and add php start and close tag
//comment these two lines when code started working fine
error_reporting(E_ALL);
ini_set('display_errors',1);
$filename = 'labels.txt';
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
$filename = 'scripts/labels.txt';
$eachline = file($filename, FILE_IGNORE_NEW_LINES);
?>
<body style="background-color: rgb(119, 196, 135);">
<div class="row">
<div class="column first">
<body>
<h2>All Species Labels</h2>
<form action="add_to_exclude.php" method="POST" id="add">
<select name="species[]" id="species" multiple size="30">
<option selected value="base">Please Select</option>
<form action="" method="POST" id="add">
<select name="species[]" id="species" multiple size="30">
<option selected value="base">Please Select</option>
<?php
foreach($eachlines as $lines){
echo "<option value='".$lines."'>$lines</option>";
foreach($eachline as $lines){
echo "<option value='".$lines."'>$lines</option>";
}?>
</select>
<input type="hidden" name="add" value="add">
</form>
</div>
<div class="column second">
<button type="submit" form="add" class="block">Add to list</button><br>
<button type="submit" form="del" class="block">Remove from list</button>
</div>
<button type="submit" name="view" value="Excluded" form="add">Add to list</button><br>
<button type="submit" name="view" value="Excluded" form="del">Remove from list</button>
<div class="column third">
<h2>Excluded Species List</h2>
<form action="del_from_exclude.php" method="POST" id="del">
<select name="species[]" id="value2" multiple size="30">
<option selected value="base">Please Select</option>
<form action="" method="POST" id="del">
<select name="species[]" id="value2" multiple size="30">
<option selected value="base">Please Select</option>
<?php
$filename = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
foreach($eachlines as $lines){
echo "<option value='".$lines."'>$lines</option>";
$filename = '/home/pi/BirdNET-Pi/exclude_species_list.txt';
$eachline = file($filename, FILE_IGNORE_NEW_LINES);
foreach($eachline as $lines){
echo "<option value='".$lines."'>$lines</option>";
}?>
<input type="hidden" name="del" value="del">
</form>
</div>
</div>
</body>
+1 -1
View File
@@ -3344,7 +3344,7 @@ function fm_show_nav_path($path)
<nav class="navbar navbar-expand-lg <?php echo $getTheme; ?> mb-4 main-nav <?php echo $isStickyNavBar ?>">
<a class="navbar-brand" href="../../">BirdNET-Pi Homepage </a>
<a class="navbar-brand" href="../"><?php echo lng('Tools'); ?></a>
<a class="navbar-brand" href="http://birdnetpi.local:8888" target="_"><?php echo lng('WebTerminal'); ?></a>
<a class="navbar-brand" href="http://birdnetpi.local:8080" target="_"><?php echo lng('WebTerminal'); ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
+8 -87
View File
@@ -1,94 +1,19 @@
<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;
box-sizing: border-box;
}
/* Create two unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
}
.first {
width: 45%;
}
.second {
width: 10%;
display: flex;
justify-content: center;
flex-direction: column;
height: 100%;
}
.third {
width: 45%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
body {
background-color: rgb(119, 196, 135);
}
a {
text-decoration: none;
color: white;
}
.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;
}
h2 {
text-align: center;
}
select {
width:100%
}
@media screen and (max-width: 800px) {
.column {
float: none;
width: 100%;
}
}
</style>
<?php
//remove <script></script> and add php start and close tag
//comment these two lines when code started working fine
error_reporting(E_ALL);
ini_set('display_errors',1);
$filename = 'labels.txt';
$filename = 'scripts/labels.txt';
$eachlines = file($filename, FILE_IGNORE_NEW_LINES);
?>
<body style="background-color: rgb(119, 196, 135);">
<div class="row">
<div class="column first">
<body>
<h2>All Species Labels</h2>
<form action="add_to_include.php" method="POST" id="add">
<form action="" method="POST" id="add">
<select name="species[]" id="species" multiple size="30">
<option selected value="base">Please Select</option>
<?php
@@ -96,17 +21,14 @@ foreach($eachlines as $lines){
echo "<option value='".$lines."'>$lines</option>";
}?>
</select>
<input type="hidden" name="add" value="add">
</form>
</div>
<div class="column second">
<button type="submit" form="add" class="block">Add to list</button><br>
<button type="submit" form="del" class="block">Remove from list</button>
</div>
<button type="submit" name="view" value="Included" form="add">Add to list</button><br>
<button type="submit" name="view" value="Included" form="del">Remove from list</button>
<div class="column third">
<h2>Included Species List</h2>
<form action="del_from_include.php" method="POST" id="del">
<form action="" method="POST" id="del">
<select name="species[]" id="value2" multiple size="30">
<option selected value="base">Please Select</option>
<?php
@@ -115,7 +37,6 @@ $eachlines = file($filename, FILE_IGNORE_NEW_LINES);
foreach($eachlines as $lines){
echo "<option value='".$lines."'>$lines</option>";
}?>
<input type="hidden" name="del" value="del">
</form>
</div>
</div>
</body>
+1 -1
View File
@@ -73,7 +73,7 @@ a {
</form>
</div>
<div class="column second">
<form action="http://birdnetpi.local:8888" target="top">
<form action="http://birdnetpi.local:8080" target="top">
<button type="submit" class="block">Web Terminal</button>
</form>
<form action="/scripts/service_controls.php">
-2
View File
@@ -158,8 +158,6 @@ create_necessary_dirs() {
sudo -u ${USER} ln -fs $(dirname ${my_dir})/templates/green_bootstrap.css ${HOME}/phpsysinfo/templates/
sudo -u ${USER} ln -fs $(dirname ${my_dir})/templates/index_bootstrap.html ${HOME}/phpsysinfo/templates/html
echo "Setting Wttr.in URL to "${LATITUDE}", "${LONGITUDE}""
sudo -u${USER} sed -i "s/https:\/\/v2.wttr.in\//https:\/\/v2.wttr.in\/"${LATITUDE},${LONGITUDE}"/g" $(dirname ${my_dir})/homepage/menu.html
chmod -R g+rw $(dirname ${my_dir})
chmod -R g+rw ${RECS_DIR}
}
+7 -4
View File
@@ -70,12 +70,13 @@ 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')"
elif [ -z ${BIRDNETPI_URL} ];then
BIRDNETLOG_URL="http:\/\/$(hostname).local:8080"
else
BIRDNETLOG_URL="$(echo http://$(hostname).local:8080 | sed 's/\/\//\\\/\\\//g')"
BIRDNETLOG_URL="${BIRDNETPI_URL}:8080"
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
@@ -85,8 +86,10 @@ sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local:8080/${BIRDNETLOG_URL}/g" $(di
if [ ! -z ${WEBTERMINAL_URL} ];then
WEBTERMINAL_URL="$(echo ${WEBTERMINAL_URL} | sed 's/\/\//\\\/\\\//g')"
elif [ -z ${BIRDNETPI_URL} ];then
WEBTERMINAL_URL="http:\/\/$(hostname).local:8888"
else
WEBTERMINAL_URL="$(echo http://$(hostname).local:8888 | sed 's/\/\//\\\/\\\//g')"
WEBTERMINAL_URL="${BIRDNETPI_URL}:8888"
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
@@ -110,4 +113,4 @@ else
sudo -u${USER} sed -i "s/http:\/\/birdnetpi.local/${BIRDNETPI_URL}/g" $(dirname ${my_dir})/scripts/*/*.php
fi
systemctl reload caddy
sudo systemctl reload caddy