From fba631009a2a3768bc8745bcce4dc37a94d910cf Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 14 Aug 2024 12:08:00 +0200 Subject: [PATCH] Update birdnet_to_mqtt.py --- birdnet-pi/rootfs/helpers/birdnet_to_mqtt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/birdnet-pi/rootfs/helpers/birdnet_to_mqtt.py b/birdnet-pi/rootfs/helpers/birdnet_to_mqtt.py index d9b8dab52..da4aeb25e 100644 --- a/birdnet-pi/rootfs/helpers/birdnet_to_mqtt.py +++ b/birdnet-pi/rootfs/helpers/birdnet_to_mqtt.py @@ -64,7 +64,7 @@ def automatic_mqtt_publish(file, detections, path): # Flickimage image_url = "" - common_name = high_bird_fields[3] + common_name = detection.common_name if len(settings_dict.get('FLICKR_API_KEY')) > 0: if common_name not in flickr_images: try: @@ -77,12 +77,12 @@ def automatic_mqtt_publish(file, detections, path): data = resp.json()["photos"]["photo"][0] image_url = 'https://farm'+str(data["farm"])+'.static.flickr.com/'+str(data["server"])+'/'+str(data["id"])+'_'+str(data["secret"])+'_n.jpg' - flickr_images[comName] = image_url + flickr_images[common_name] = image_url except Exception as e: print("FLICKR API ERROR: "+str(e)) image_url = "" else: - image_url = flickr_images[comName] + image_url = flickr_images[common_name] bird['Flickrimage'] = image_url json_bird = json.dumps(bird)