diff --git a/README.md b/README.md index 072b6fd..92ae118 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ Currently listening in these countries . . . that I know of . . . - Estonia - Tasmania - Luxembourgh +- Crete ## Features * **24/7 recording and automatic identification** of bird songs, chirps, and peeps using BirdNET machine learning diff --git a/homepage/index.php b/homepage/index.php index eeae423..160edf6 100644 --- a/homepage/index.php +++ b/homepage/index.php @@ -1,4 +1,9 @@ "; } - +?> diff --git a/homepage/views.php b/homepage/views.php index e753700..6784ab1 100644 --- a/homepage/views.php +++ b/homepage/views.php @@ -1,4 +1,9 @@ = 99) {?> +} +if(isset($_SESSION['behind'])&&intval($_SESSION['behind']) >= 99) {?> -Overview
- +
@@ -143,7 +149,7 @@ if(isset($_GET['view'])){ if($_GET['view'] == "Spectrogram"){include('spectrogram.php');} if($_GET['view'] == "View Log"){echo "";} if($_GET['view'] == "Overview"){include('overview.php');} - if($_GET['view'] == "Today's Detections"){include('todays_detections.php');} + if($_GET['view'] == "Todays Detections"){include('todays_detections.php');} if($_GET['view'] == "Kiosk"){$kiosk = true;include('todays_detections.php');} if($_GET['view'] == "Species Stats"){include('stats.php');} if($_GET['view'] == "Weekly Report"){include('weekly_report.php');} diff --git a/requirements.txt b/requirements.txt index 6624403..13b2b56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,5 @@ apprise==1.2.1 paho-mqtt pytest==7.1.2 pytest-mock==3.7.0 -suntime \ No newline at end of file +suntime +altair<5 \ No newline at end of file diff --git a/scripts/config.php b/scripts/config.php index ceb5e0a..72cfb8a 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -2,14 +2,14 @@ error_reporting(E_ERROR); 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"); $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); $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")) { $apprise_config = file_get_contents($home."/BirdNET-Pi/apprise.txt"); } else { @@ -136,11 +136,10 @@ if(isset($_GET["latitude"])){ } } - // Update Language settings only if a change is requested - if (file_exists('./scripts/thisrun.txt')) { - $lang_config = parse_ini_file('./scripts/thisrun.txt'); - } elseif (file_exists('./scripts/firstrun.ini')) { - $lang_config = parse_ini_file('./scripts/firstrun.ini'); + if (file_exists($home.'/BirdNET-Pi/scripts/thisrun.txt')) { + $lang_config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.txt'); + } elseif (file_exists($home.'/BirdNET-Pi/scripts/thisrun.ini')) { + $lang_config = parse_ini_file($home.'/BirdNET-Pi/scripts/thisrun.ini'); } 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_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("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2); $contents2 = preg_replace("/LONGITUDE=.*/", "LONGITUDE=$longitude", $contents2); @@ -213,7 +212,7 @@ if(isset($_GET["latitude"])){ } $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($fh2, $contents2); @@ -231,18 +230,17 @@ if(isset($_GET["latitude"])){ } 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"); $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); $home = trim($home); - - if (file_exists('./thisrun.txt')) { - $config = parse_ini_file('./thisrun.txt'); - } elseif (file_exists('./firstrun.ini')) { - $config = parse_ini_file('./firstrun.ini'); + 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'); } + $db = new SQLite3($home."/BirdNET-Pi/scripts/birds.db", SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE); + $cf = explode("\n",$_GET['apprise_config']); $cf = "'".implode("' '", $cf)."'"; @@ -315,6 +313,12 @@ if(isset($_GET['sendtest']) && $_GET['sendtest'] == "true") { die(); } +// have to get the config again after we change the variables, so the UI reflects the changes too +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'); +} ?>