diff --git a/scripts/overview.php b/scripts/overview.php index 5654150..da930c9 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -158,7 +158,12 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse } // Read the blacklisted image ids from the file into an array - $blacklisted_ids = array_map('trim', file($home."/BirdNET-Pi/scripts/blacklisted_images.txt")); + $blacklisted_file = file($home."/BirdNET-Pi/scripts/blacklisted_images.txt"); + if ($blacklisted_file !== false) { + $blacklisted_ids = array_map('trim', $blacklisted_file); + } else { + $blacklisted_ids = []; + } // Make the API call $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).$comnameprefix."&sort=relevance".$args."&per_page=5&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"]; diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index e5d1b78..2238e65 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -285,7 +285,12 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { } } // Read the blacklisted image ids from the file into an array - $blacklisted_ids = array_map('trim', file($home."/BirdNET-Pi/scripts/blacklisted_images.txt")); + $blacklisted_file = file($home."/BirdNET-Pi/scripts/blacklisted_images.txt"); + if ($blacklisted_file) { + $blacklisted_ids = array_map('trim', $blacklisted_file); + } else { + $blacklisted_ids = []; + } // Make the API call $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).$comnameprefix."&sort=relevance".$args."&per_page=5&media=photos&format=json&nojsoncallback=1"), true)["photos"]["photo"];