From 52bbc4ffcaf97e21ea208a9f6a8fbea37be516a1 Mon Sep 17 00:00:00 2001 From: Andrea Spacca Date: Thu, 6 May 2021 10:19:39 +0200 Subject: [PATCH] Send only text notification without art if `entry["art"]` is empty `pms.get_image` will return `None` and previous implementation would return without sending any notification Now at lest the text notification without image will be sent --- modules/tautulli.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/tautulli.py b/modules/tautulli.py index d4a4436..8e89920 100644 --- a/modules/tautulli.py +++ b/modules/tautulli.py @@ -44,14 +44,12 @@ async def send_entry(bot, room, entry): if plexpy: pms = plexpy.pmsconnect.PmsConnect() pms_image = pms.get_image(entry["art"], 600, 300) - if not pms_image: - return + if pms_image: + (blob, content_type) = pms_image + matrix_uri = await bot.upload_and_send_image(room, blob, "", True, content_type) - (blob, content_type) = pms_image - matrix_uri = await bot.upload_and_send_image(room, blob, "", True, content_type) - - if matrix_uri is not None: - await bot.send_image(room, matrix_uri, "") + if matrix_uri is not None: + await bot.send_image(room, matrix_uri, "") fmt_params = { "title": entry["title"],