From 2baf4679eb7ec931dae59d341f3c37666bff1d76 Mon Sep 17 00:00:00 2001 From: emilsvennesson Date: Mon, 23 Jul 2018 16:16:11 +0200 Subject: [PATCH] 'fallback' image is not always available #24 --- resources/lib/addon.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/lib/addon.py b/resources/lib/addon.py index bc779e9..e94694b 100644 --- a/resources/lib/addon.py +++ b/resources/lib/addon.py @@ -104,9 +104,13 @@ def channels(): for channel in channels_dict['channels']: plugin_url = plugin.url_for(list_products, url=channel['_links']['self']['href']) + if 'fallback' in channel['content']['images']: + channel_image = channel['content']['images']['fallback']['template'].split('{')[0] + else: + channel_image = channel['content']['images']['logo']['template'].split('{')[0] art = { - 'thumb': channel['content']['images']['fallback']['template'].split('{')[0], - 'fanart': channel['content']['images']['fallback']['template'].split('{')[0] + 'thumb': channel_image, + 'fanart': channel_image } for program in channel['_embedded']['viaplay:products']: # get current live program