From 15d933debf608fa6678c49c35f7fe8ce3b6bf1ac Mon Sep 17 00:00:00 2001 From: Mariusz89B Date: Sun, 12 Feb 2023 23:13:03 +0100 Subject: [PATCH] v2.4.0 --- resources/lib/addon.py | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/resources/lib/addon.py b/resources/lib/addon.py index e093740..d4c978e 100644 --- a/resources/lib/addon.py +++ b/resources/lib/addon.py @@ -663,7 +663,7 @@ def add_sports_event(event): } helper.add_item(event_info['title'], plugin_url, playable=playable, info=event_info, - art=add_art(details['images'], 'sport'), content='episodes') + art=add_art(details['images'], 'sport'), content='playlists') def add_sports_series(event): @@ -795,19 +795,31 @@ def add_event(event): title = details.get('title').encode('utf-8') event_info = { - 'mediatype': 'video', - 'originaltitle': details.get('title'), - 'plot': details.get('synopsis'), - 'year': details['production'].get('year'), - 'title': '{0}'.format(title) - } + 'mediatype': 'video', + 'originaltitle': details.get('title'), + 'plot': details.get('synopsis'), + 'year': details['production'].get('year'), + 'title': '{0}'.format(title) + } art = { - 'thumb': event['content']['images']['landscape']['template'].split('{')[0] if 'landscape' in details['images'] else None, - 'fanart': event['content']['images']['landscape']['template'].split('{')[0] if 'landscape' in details['images'] else None - } + 'thumb': event['content']['images']['landscape']['template'].split('{')[0] if 'landscape' in details['images'] else None, + 'fanart': event['content']['images']['landscape']['template'].split('{')[0] if 'landscape' in details['images'] else None + } + + watched_list, duration_list = sql_watched() + + properties = [] + + for w in watched_list: + if w[0] == event['system']['guid']: + event_info.update({'playcount': w[1], 'lastplayed': w[2]}) + + for d in duration_list: + if d[2] == w[3]: + properties.append((d[0], d[1])) - helper.add_item(event_info['title'], plugin_url, playable=True, info=event_info, art=art, content='episodes') + helper.add_item(event_info['title'], plugin_url, playable=True, info=event_info, art=art, content='episodes', properties=properties) def add_art(images, content_type): artwork = {}