From 840b071ffa6b6bfba0ebdff239d8cb8b12f3955d Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Fri, 25 Feb 2022 10:21:42 -0500 Subject: [PATCH 1/4] tweaks for this --- homepage/index.php | 54 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/homepage/index.php b/homepage/index.php index 31eb1c6..9793749 100644 --- a/homepage/index.php +++ b/homepage/index.php @@ -25,13 +25,16 @@ foreach($pages as $page){ echo $response; } if(isset($_POST['view'])){ + if($_POST['view'] == "System"){header('location:phpsysinfo/index.php');} + if($_POST['view'] == "Spectrogram"){include('spectrogram.php');} if($_POST['view'] == "Overview"){include('overview.php');} if($_POST['view'] == "Database"){include('viewdb.php');} if($_POST['view'] == "Species Stats"){ include('stats.php'); if(isset($_POST['species'])){ - $data = [ 'species' => $_POST['species'] ]; - httpPost('/stats.php', $data);} + $data = [ 'species' => $_POST['species'] ]; + httpPost('/stats.php', $data); + } } if($_POST['view'] == "History"){ include('history.php'); @@ -42,40 +45,30 @@ if(isset($_POST['view'])){ echo "
-
"; + "; } if($_POST['view'] == "Live Stream"){ - echo "
";} + echo "";} if($_POST['view'] == "Extractions"){ include('play.php'); $data = []; httpPost('/play.php', $data);} - while($_POST['view'] == "Spectrogram"){ - ob_start(); - $time = time(); - echo str_pad("", '4096'); - ob_flush(); - flush(); - sleep($config['RECORDING_LENGTH']); - ob_clean(); - ob_end_clean(); - ob_end_flush();} - if($_POST['view'] == "Settings"){ - if(isset($_POST['submit'])){ - $data = [ - '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"], - 'language' => $_POST["language"], - 'submit' => $_POST["submit"], - ]; - $url = $_SERVER['HTTP_REFERER']; - httpPost("$url/scripts/update_config.php", $data); - } - include('scripts/config.php'); - } + if($_POST['view'] == "Settings"){ + if(isset($_POST['submit'])){ + $data = [ + '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"], + 'language' => $_POST["language"], + 'submit' => $_POST["submit"], + ]; + $url = $_SERVER['HTTP_REFERER']; + httpPost("$url/scripts/update_config.php", $data); + } + include('scripts/config.php'); + } if($_POST['view'] == "Advanced"){ if(isset($_POST['submit'])){ $data = [ @@ -100,7 +93,6 @@ if(isset($_POST['view'])){ } include('scripts/advanced.php'); } - if($_POST['view'] == "System"){header('location:phpsysinfo/index.php');} if($_POST['view'] == "Log"){ $url = 'http://birdnetpi.local:8080'; header("location: $url;");} From 957a7d83905a985c0116810cc8fb78e84f3022be Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Fri, 25 Feb 2022 10:31:38 -0500 Subject: [PATCH 2/4] pulling sqlite changes --- scripts/update_caddyfile.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/update_caddyfile.sh b/scripts/update_caddyfile.sh index 6b8982d..20503fb 100755 --- a/scripts/update_caddyfile.sh +++ b/scripts/update_caddyfile.sh @@ -70,12 +70,14 @@ 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 +sudo -u${USER} sed -i "s/wttr.in/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 +87,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:8080" 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 +114,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 From 95c01b749ff2b4ac81f20f70504f7d5ffdcbb17f Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Fri, 25 Feb 2022 10:40:11 -0500 Subject: [PATCH 3/4] typo --- scripts/update_caddyfile.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/update_caddyfile.sh b/scripts/update_caddyfile.sh index 20503fb..180dcae 100755 --- a/scripts/update_caddyfile.sh +++ b/scripts/update_caddyfile.sh @@ -70,7 +70,6 @@ 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/wttr.in/wttr.in\/${LATITUDE},${LONGITUDE}/g" $(dirname ${my_dir})/homepage/menu.html if [ ! -z ${BIRDNETLOG_URL} ];then BIRDNETLOG_URL="$(echo ${BIRDNETLOG_URL} | sed 's/\/\//\\\/\\\//g')" @@ -88,7 +87,7 @@ 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:8080" + WEBTERMINAL_URL="http:\/\/$(hostname).local:8888" else WEBTERMINAL_URL="${BIRDNETPI_URL}:8888" fi From c5a49c1cca854466c7d75e0d0c75c0aaeb10c1c6 Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Fri, 25 Feb 2022 11:35:47 -0500 Subject: [PATCH 4/4] newif overhauls so far --- homepage/external.html | 60 ---- homepage/footer.html | 22 -- homepage/index.html | 42 --- homepage/index.php | 54 +++ homepage/menu.html | 92 ----- homepage/menu_de.html | 80 ----- homepage/mobile.html | 509 ---------------------------- homepage/top.html | 51 --- homepage/top_de.html | 51 --- scripts/add_to_exclude.php | 14 - scripts/add_to_include.php | 14 - scripts/clear_all_data.sh | 2 - scripts/del_from_exclude.php | 22 -- scripts/del_from_include.php | 22 -- scripts/exclude_list.php | 117 ++----- scripts/filemanager/filemanager.php | 2 +- scripts/include_list.php | 95 +----- scripts/index.html | 2 +- scripts/install_services.sh | 2 - 19 files changed, 83 insertions(+), 1170 deletions(-) delete mode 100644 homepage/external.html delete mode 100644 homepage/footer.html delete mode 100644 homepage/index.html delete mode 100644 homepage/menu.html delete mode 100644 homepage/menu_de.html delete mode 100644 homepage/mobile.html delete mode 100644 homepage/top.html delete mode 100644 homepage/top_de.html delete mode 100644 scripts/add_to_exclude.php delete mode 100644 scripts/add_to_include.php delete mode 100644 scripts/del_from_exclude.php delete mode 100644 scripts/del_from_include.php diff --git a/homepage/external.html b/homepage/external.html deleted file mode 100644 index ec8343d..0000000 --- a/homepage/external.html +++ /dev/null @@ -1,60 +0,0 @@ - - -HTML Frames Example - Content - - - -tbc.... -

Thanks

-stefan kahl -patrick mcguire -

Similar Systems

-

Technical Details

-machine learning -deep learning -

Used Tools

-SoX -ffmpeg -Python -Tensorfflow (Lite) -Rasberian OS -

Disclaimer

-

Other Systems

-links to other systems - - - -

Content

-

Replacing the Contents of the Current Frame

-

Clicking on these links will open the new page within the current frame.

- - -

Replacing the Whole Frameset

-

When you click on any of the following links, the whole frameset is replaced with the new website. This is because we're using target="_top" in the anchor links.

- - -

Open a New Window

-

These links open in a new browser window. This is because we use target="_blank".

- - - - \ No newline at end of file diff --git a/homepage/footer.html b/homepage/footer.html deleted file mode 100644 index 9741849..0000000 --- a/homepage/footer.html +++ /dev/null @@ -1,22 +0,0 @@ - - -HTML Frames Example - Footer - - - -

Play Live Audio

-

- - diff --git a/homepage/index.html b/homepage/index.html deleted file mode 100644 index a1294b0..0000000 --- a/homepage/index.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - BirdNET-Pi - - - - - - - - - - - - - - - - <p>This section (everything between the 'noframes' tags) will only be displayed if the users' browser doesn't support frames. You can provide a link to a non-frames version of the website here. Feel free to use HTML tags within this section.</p> - - - - diff --git a/homepage/index.php b/homepage/index.php index 9793749..8bcb502 100644 --- a/homepage/index.php +++ b/homepage/index.php @@ -29,6 +29,58 @@ if(isset($_POST['view'])){ if($_POST['view'] == "Spectrogram"){include('spectrogram.php');} if($_POST['view'] == "Overview"){include('overview.php');} if($_POST['view'] == "Database"){include('viewdb.php');} + if($_POST['view'] == "Included"){ + if(isset($_POST['species']) && isset($_POST['add'])){ + $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); + } + } elseif(isset($_POST['species']) && isset($_POST['del'])){ + $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"); + 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('/^\h*\v+/m', '', $str); + file_put_contents("$file", "$str"); + } + include('scripts/include_list.php'); + } + if($_POST['view'] == "Excluded"){ + if(isset($_POST['species']) && isset($_POST['add'])){ + $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"); + foreach ($_POST['species'] as $selectedOption) + file_put_contents("/home/pi/BirdNET-Pi/exclude_species_list.txt", $selectedOption."\n", FILE_APPEND); + } elseif (isset($_POST['species']) && isset($_POST['del'])){ + $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"); + 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('/^\h*\v+/m', '', $str); + file_put_contents("$file", "$str"); + } + include('scripts/exclude_list.php'); + } if($_POST['view'] == "Species Stats"){ include('stats.php'); if(isset($_POST['species'])){ @@ -45,6 +97,8 @@ if(isset($_POST['view'])){ echo "
+ +
"; } if($_POST['view'] == "Live Stream"){ diff --git a/homepage/menu.html b/homepage/menu.html deleted file mode 100644 index 2bfe9fe..0000000 --- a/homepage/menu.html +++ /dev/null @@ -1,92 +0,0 @@ - - - HTML Frames Example - Menu - - - - -
Extractions
-
- - -
-
- - -
- - Processed
- -
- -
System
- - Tools
- - Info
- - Log
- -
- -
External
- - BirdWeather
- - Wiki Help Page
- - Wttr.in Report
- - BirdNET
-
- -
Other
BirdNET-Pis
- - United States
- - South Africa
- - Sweden
- - Germany - - - - - diff --git a/homepage/menu_de.html b/homepage/menu_de.html deleted file mode 100644 index 39c5652..0000000 --- a/homepage/menu_de.html +++ /dev/null @@ -1,80 +0,0 @@ - - - Menu - - - - -
Extraktionen
- - Nach Datum
- - Nach Namen
- - Nach wiss. Namen
- - Verarbeitet
- -
- -
System-Links
- - Tools
- - System Info
- - BirdNET-Lite Log
- - Extraction Log
- -
- -
Externe Links
- - BirdWeather
- - Repository
- - Wiki Hilfe-Seite
- - Wttr.in Report
- - BirdNET @ Cornell
-
- -
Andere
BirdNET-Pis
- - United States
- - South Africa
- - Sweden - - Germany - - - - - diff --git a/homepage/mobile.html b/homepage/mobile.html deleted file mode 100644 index 90986c6..0000000 --- a/homepage/mobile.html +++ /dev/null @@ -1,509 +0,0 @@ - - - - BirdNET-Pi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- πŸ•Š BirdNET-Pi -

-
-
-

- - 🐦 Overview - -

-
-

- - 🐦 Today's Top 10 - -

-
-

- - 🐦 View the Database - -

-
-

- - πŸ”Š Live Audio Stream - -

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Extractions

-
- - - By Common Name - -
- - - By Date - -
- - - By Scientific Name - -
- - - Processed - -
-

Tools

-
- - - πŸ—Ž Scripts - -
- - - βš™ Analysis Log - -
- - - ⚝ Extraction Log - -
- - System Information - -
-
- -
- -
-
-
- - - - - diff --git a/homepage/top.html b/homepage/top.html deleted file mode 100644 index c141a28..0000000 --- a/homepage/top.html +++ /dev/null @@ -1,51 +0,0 @@ - - - BirdNET-Pi - - - - - BirdNET-Pi - -

BirdNET-Pi

- -

- Overview | - Database | - Species Stats | - History | - Spectrogram -

- - diff --git a/homepage/top_de.html b/homepage/top_de.html deleted file mode 100644 index 30db041..0000000 --- a/homepage/top_de.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - BirdNET-Pi - - - - - BirdNET-Pi - -

BirdNET-Pi

- -

- Übersicht | - Datenbankansicht | - Tagesansicht | - Spektrogrammansicht -

- - diff --git a/scripts/add_to_exclude.php b/scripts/add_to_exclude.php deleted file mode 100644 index 6922eb2..0000000 --- a/scripts/add_to_exclude.php +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/scripts/add_to_include.php b/scripts/add_to_include.php deleted file mode 100644 index 4f18653..0000000 --- a/scripts/add_to_include.php +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/scripts/clear_all_data.sh b/scripts/clear_all_data.sh index 1eba83b..bd44cb5 100755 --- a/scripts/clear_all_data.sh +++ b/scripts/clear_all_data.sh @@ -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} diff --git a/scripts/del_from_exclude.php b/scripts/del_from_exclude.php deleted file mode 100644 index 5fa7a48..0000000 --- a/scripts/del_from_exclude.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/scripts/del_from_include.php b/scripts/del_from_include.php deleted file mode 100644 index 219d88f..0000000 --- a/scripts/del_from_include.php +++ /dev/null @@ -1,22 +0,0 @@ - diff --git a/scripts/exclude_list.php b/scripts/exclude_list.php index 99e20fc..ebf4691 100644 --- a/scripts/exclude_list.php +++ b/scripts/exclude_list.php @@ -1,121 +1,42 @@ 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); ?> - -
-
+

All Species Labels

-
- + $lines"; +foreach($eachline as $lines){ + echo ""; }?> +
-
-
-
- -
+
+ -

Excluded Species List

-
- + $lines"; + $filename = '/home/pi/BirdNET-Pi/exclude_species_list.txt'; +$eachline = file($filename, FILE_IGNORE_NEW_LINES); +foreach($eachline as $lines){ + echo ""; }?> +
-
-
diff --git a/scripts/filemanager/filemanager.php b/scripts/filemanager/filemanager.php index 1db4bb8..79e9df1 100644 --- a/scripts/filemanager/filemanager.php +++ b/scripts/filemanager/filemanager.php @@ -3344,7 +3344,7 @@ function fm_show_nav_path($path)