From ebe5fae82bbf7cb8853c27bf9ea2174ca924d57a Mon Sep 17 00:00:00 2001 From: mcguirepr89 Date: Mon, 11 Apr 2022 20:12:22 -0400 Subject: [PATCH] email templates fixed --- scripts/birdnetpi_request.php | 2 +- scripts/birdweather_request.php | 2 +- scripts/config.php | 10 +++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/birdnetpi_request.php b/scripts/birdnetpi_request.php index 0cf7a5a..968c174 100644 --- a/scripts/birdnetpi_request.php +++ b/scripts/birdnetpi_request.php @@ -4,7 +4,7 @@ if (file_exists('thisrun.txt')) { } elseif (file_exists('firstrun.ini')) { $config = parse_ini_file('firstrun.ini'); } -$template = file_get_contents("email_template2"); +$template = file_get_contents("./scripts/email_template2"); foreach($config as $key => $value) { diff --git a/scripts/birdweather_request.php b/scripts/birdweather_request.php index fa4f6f3..a8b82ab 100644 --- a/scripts/birdweather_request.php +++ b/scripts/birdweather_request.php @@ -4,7 +4,7 @@ if (file_exists('thisrun.txt')) { } elseif (file_exists('firstrun.ini')) { $config = parse_ini_file('firstrun.ini'); } -$template = file_get_contents("email_template"); +$template = file_get_contents("./scripts/email_template"); foreach($config as $key => $value) { diff --git a/scripts/config.php b/scripts/config.php index 7f78a15..817f949 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -31,8 +31,12 @@ fwrite($fh2, $contents2); $language = $_POST["language"]; if ($language != "none"){ - $command = "sudo -upi mv /home/*/BirdNET-Pi/model/labels.txt /home/*/BirdNET-Pi/model/labels.txt.old && sudo -upi unzip /home/*/BirdNET-Pi/model/labels_l18n.zip $language -d /home/*/BirdNET-Pi/model && sudo -upi mv /home/*/BirdNET-Pi/model/$language /home/*/BirdNET-Pi/model/labels.txt"; - $command_output = `$command`; + $user = shell_exec("awk -F: '/1000/{print $1}' /etc/passwd"); + $home = shell_exec("awk -F: '/1000/{print $6}' /etc/passwd"); + $home = trim($home); + $command = "sudo -u".$user." mv ".$home."/BirdNET-Pi/model/labels.txt ".$home."/BirdNET-Pi/model/labels.txt.old && sudo -u".$user." unzip ".$home."/BirdNET-Pi/model/labels_l18n.zip ".$language." -d ".$home."/BirdNET-Pi/model && sudo -u".$user." mv ".$home."/BirdNET-Pi/model/".$language." ".$home."/BirdNET-Pi/model/labels.txt"; + $command_output = `sudo $command`; + `sudo restart_services.sh`; } } @@ -75,7 +79,7 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {

Set your Latitude and Longitude to 4 decimal places. Get your coordinates here.


-

BirdWeather.com 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. Email Tim to request a BirdWeather ID

+

BirdWeather.com 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. Email Tim to request a BirdWeather ID