From 37dc1ba546a7a736b42798729dc1ac6beac3f73e Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 18 Jun 2022 08:10:15 -0400 Subject: [PATCH 1/3] #386 --- scripts/overview.php | 6 ++++-- scripts/todays_detections.php | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index c442876..236f596 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -49,6 +49,8 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse $sciname = preg_replace('/ /', '_', $mostrecent['Sci_Name']); $comname = preg_replace('/\'/', '', $comname); $filename = "/By_Date/".$mostrecent['Date']."/".$comname."/".$mostrecent['File_Name']; + $args = "&license=2%2C3%2C4%2C5%2C6%2C9&orientation=square,portrait"; + // check to make sure the image actually exists, sometimes it takes a minute to be created\ if(file_exists($home."/BirdSongs/Extracted".$filename.".png")){ if($_GET['previous_detection_identifier'] == $filename) { die(); } @@ -61,7 +63,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse unset($_SESSION['images']); $_SESSION['FLICKR_FILTER_EMAIL'] = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.people.findByEmail&api_key=".$config["FLICKR_API_KEY"]."&find_email=".$config["FLICKR_FILTER_EMAIL"]."&format=json&nojsoncallback=1"), true)["user"]["nsid"]; } - $emailargs = "&user_id=".$_SESSION['FLICKR_FILTER_EMAIL']; + $args = "&user_id=".$_SESSION['FLICKR_FILTER_EMAIL']; } else { if(isset($_SESSION["FLICKR_FILTER_EMAIL"])) { unset($_SESSION["FLICKR_FILTER_EMAIL"]); @@ -87,7 +89,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse } } - $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=\"".str_replace(" ", "%20", $engname)."\"&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance".$emailargs."&per_page=5&orientation=square,portrait&format=json&media=photos&nojsoncallback=1"), true)["photos"]["photo"][0]; + $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=\"".str_replace(" ", "%20", $engname)."\"&sort=relevance".$args."&per_page=5&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"][0]; $modaltext = "https://flickr.com/photos/".$flickrjson["owner"]."/".$flickrjson["id"]; $authorlink = "https://flickr.com/people/".$flickrjson["owner"]; $imageurl = 'https://farm' .$flickrjson["farm"]. '.static.flickr.com/' .$flickrjson["server"]. '/' .$flickrjson["id"]. '_' .$flickrjson["secret"]. '.jpg'; diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index ad1becb..01948a4 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -118,6 +118,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { $comname = preg_replace('/\'/', '_', $comname); $filename = "/By_Date/".date('Y-m-d')."/".$comname."/".$todaytable['File_Name']; $sciname = preg_replace('/ /', '_', $todaytable['Sci_Name']); + $args = "&license=2%2C3%2C4%2C5%2C6%2C9&orientation=square,portrait"; if (!empty($config["FLICKR_API_KEY"]) && (isset($_GET['display_limit']) || isset($_GET['hard_limit']))) { @@ -126,7 +127,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { unset($_SESSION['images']); $_SESSION['FLICKR_FILTER_EMAIL'] = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.people.findByEmail&api_key=".$config["FLICKR_API_KEY"]."&find_email=".$config["FLICKR_FILTER_EMAIL"]."&format=json&nojsoncallback=1"), true)["user"]["nsid"]; } - $emailargs = "&user_id=".$_SESSION['FLICKR_FILTER_EMAIL']; + $args = "&user_id=".$_SESSION['FLICKR_FILTER_EMAIL']; } else { if(isset($_SESSION["FLICKR_FILTER_EMAIL"])) { unset($_SESSION["FLICKR_FILTER_EMAIL"]); @@ -150,8 +151,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { break; } } - - $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=\"".str_replace(" ", "%20", $engname)."\"&license=2%2C3%2C4%2C5%2C6%2C9&sort=relevance".$emailargs."&per_page=5&orientation=square,portrait&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"][0]; + $flickrjson = json_decode(file_get_contents("https://www.flickr.com/services/rest/?method=flickr.photos.search&api_key=".$config["FLICKR_API_KEY"]."&text=\"".str_replace(" ", "%20", $engname)."\"&sort=relevance".$args."&per_page=5&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"][0]; $modaltext = "https://flickr.com/photos/".$flickrjson["owner"]."/".$flickrjson["id"]; $authorlink = "https://flickr.com/people/".$flickrjson["owner"]; $imageurl = 'https://farm' .$flickrjson["farm"]. '.static.flickr.com/' .$flickrjson["server"]. '/' .$flickrjson["id"]. '_' .$flickrjson["secret"]. '.jpg'; From 620526122a220a2413441d8efc281494ef9ef691 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 18 Jun 2022 10:45:01 -0400 Subject: [PATCH 2/3] Update server.py --- scripts/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/server.py b/scripts/server.py index 5472e7f..9840d5a 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -271,8 +271,8 @@ def sendAppriseNotifications(species, confidence, path): config.add(userDir + '/BirdNET-Pi/apprise.txt') apobj.add(config) apobj.notify( - body=body.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence).replace("$listenurl", listenurl) + " (only seen "+str(int(numberDetections)+1)+" times in last 7d)", - title=title.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence).replace("$listenurl", listenurl) + " (only seen "+str(int(numberDetections)+1)+" times in last 7d)", + body=body.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence).replace("$listenurl", listenurl) + " (only seen "+str(int(numberDetections))+" times in last 7d)", + title=title.replace("$sciname", species.split("_")[0]).replace("$comname", species.split("_")[1]).replace("$confidence", confidence).replace("$listenurl", listenurl) + " (only seen "+str(int(numberDetections))+" times in last 7d)", ) con.close() From 961802695eb854250f4d7b5cea68a8ba683add5d Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Sat, 18 Jun 2022 11:09:27 -0400 Subject: [PATCH 3/3] Better settings styling --- homepage/style.css | 21 +++++++++++++++++++++ scripts/config.php | 37 ++++++++++++++++++++++++++----------- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/homepage/style.css b/homepage/style.css index 594c0b5..2737905 100644 --- a/homepage/style.css +++ b/homepage/style.css @@ -758,3 +758,24 @@ form#views button .updatenumber { height:75px; float:left; } + +.settingstable { + margin-left:unset; + margin-right:unset; +} +.settingstable td { + text-align:unset; +} +.settingstable textarea { + width:100%; + margin-top:10px; +} +h1 { + font-size: xx-large; +} +h2 { + font-size:x-large; +} +.brbanner h1 { + margin:0px; +} \ No newline at end of file diff --git a/scripts/config.php b/scripts/config.php index ce32111..cbf3d25 100644 --- a/scripts/config.php +++ b/scripts/config.php @@ -136,7 +136,7 @@ if(isset($_GET["latitude"])){