A live bird collage card for your Home Assistant dashboard.
fix: delete picture early, we might not find a replacement later on to overwrite it
frederikf7cc26949565
diff --git a/scripts/common.php b/scripts/common.phpindex 784da53e..103d6581 100644--- a/scripts/common.php+++ b/scripts/common.php@@ -175,6 +175,7 @@ class Flickr {$image = $this->get_image_from_db($sci_name);if ($image !== false && in_array($image['id'], $this->blacklisted_ids)) {$image = false;+ $this->delete_image_from_db($sci_name);}if ($image !== false) {$now = new DateTime();@@ -195,6 +196,12 @@ class Flickr {return $image;}+ private function delete_image_from_db($sci_name) {+ $statement0 = $this->db->prepare('DELETE FROM images WHERE sci_name == :sci_name');+ $statement0->bindValue(':sci_name', $sci_name);+ $statement0->execute();+ }+private function get_image_from_db($sci_name) {$statement0 = $this->db->prepare('SELECT sci_name, com_en_name, image_url, title, id, author_url, license_url, date_created FROM images WHERE sci_name == :sci_name');$statement0->bindValue(':sci_name', $sci_name);