diff --git a/birdnet.conf-defaults b/birdnet.conf-defaults
index 3ada803..88732b9 100644
--- a/birdnet.conf-defaults
+++ b/birdnet.conf-defaults
@@ -64,8 +64,12 @@ APPRISE_NOTIFY_EACH_DETECTION=0
APPRISE_NOTIFY_NEW_SPECIES=0
#---------------------- Flickr Images API Configuration -----------------------#
+## If FLICKR_API_KEY is set, the web interface will try and display bird images
+## for each detection. If FLICKR_FILTER_EMAIL is set, the images will only be
+## displayed from a particular Flickr user (e.g. yourself).
FLICKR_API_KEY=
+FLICKR_FILTER_EMAIL=
################################################################################
#-------------------------------- Defaults ----------------------------------#
diff --git a/scripts/config.php b/scripts/config.php
index 62d3188..233d05b 100644
--- a/scripts/config.php
+++ b/scripts/config.php
@@ -22,6 +22,7 @@ if(isset($_GET["latitude"])){
$apprise_notification_title = $_GET['apprise_notification_title'];
$apprise_notification_body = $_GET['apprise_notification_body'];
$flickr_api_key = $_GET['flickr_api_key'];
+ $flickr_filter_email = $_GET["flickr_filter_email"];
$language = $_GET["language"];
if(isset($_GET['apprise_notify_each_detection'])) {
@@ -79,6 +80,7 @@ if(isset($_GET["latitude"])){
$contents = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents);
$contents = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents);
$contents = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents);
+ $contents = preg_replace("/FLICKR_FILTER_EMAIL=.*/", "FLICKR_FILTER_EMAIL=$flickr_filter_email", $contents);
$contents2 = file_get_contents("./scripts/thisrun.txt");
$contents2 = preg_replace("/LATITUDE=.*/", "LATITUDE=$latitude", $contents2);
@@ -90,6 +92,7 @@ if(isset($_GET["latitude"])){
$contents2 = preg_replace("/APPRISE_NOTIFY_NEW_SPECIES=.*/", "APPRISE_NOTIFY_NEW_SPECIES=$apprise_notify_new_species", $contents2);
$contents2 = preg_replace("/FLICKR_API_KEY=.*/", "FLICKR_API_KEY=$flickr_api_key", $contents2);
$contents2 = preg_replace("/DATABASE_LANG=.*/", "DATABASE_LANG=$language", $contents2);
+ $contents2 = preg_replace("/FLICKR_FILTER_EMAIL=.*/", "FLICKR_FILTER_EMAIL=$flickr_filter_email", $contents2);
$fh = fopen("/etc/birdnet/birdnet.conf", "w");
@@ -187,6 +190,8 @@ https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}
Bird Photos from Flickr
+
+
Set your Flickr API key to enable the display of bird images next to detections. Get your free key here.
Localization
diff --git a/scripts/install_config.sh b/scripts/install_config.sh
index 6b579e8..dcb78c1 100755
--- a/scripts/install_config.sh
+++ b/scripts/install_config.sh
@@ -77,8 +77,12 @@ APPRISE_NOTIFY_EACH_DETECTION=0
APPRISE_NOTIFY_NEW_SPECIES=0
#---------------------- Flickr Images API Configuration -----------------------#
+## If FLICKR_API_KEY is set, the web interface will try and display bird images
+## for each detection. If FLICKR_FILTER_EMAIL is set, the images will only be
+## displayed from a particular Flickr user (e.g. yourself).
FLICKR_API_KEY=
+FLICKR_FILTER_EMAIL=
################################################################################
#-------------------------------- Defaults ----------------------------------#
diff --git a/scripts/overview.php b/scripts/overview.php
index a861faf..ef04455 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -67,6 +67,21 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse
if($_GET['only_name'] == "true") { echo $comname.",".$filename;die(); }
if (!empty($config["FLICKR_API_KEY"])) {
+
+ if(!empty($config["FLICKR_FILTER_EMAIL"])) {
+ if(!isset($_SESSION["FLICKR_FILTER_EMAIL"])) {
+ 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'];
+ } else {
+ if(isset($_SESSION["FLICKR_FILTER_EMAIL"])) {
+ unset($_SESSION["FLICKR_FILTER_EMAIL"]);
+ unset($_SESSION['images']);
+ }
+ }
+
+
// if we already searched flickr for this species before, use the previous image rather than doing an unneccesary api call
$key = array_search($comname, array_column($_SESSION['images'], 0));
if($key !== false) {
@@ -84,7 +99,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&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)."&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];
$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';
@@ -117,7 +132,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse
-
+ 0) { ?>
|