From 7f87b107192c51af6673db78916fa5dd5ba09434 Mon Sep 17 00:00:00 2001 From: Mariusz89B Date: Sun, 8 Aug 2021 10:45:12 +0200 Subject: [PATCH] 2.1.5 --- addon.xml | 4 +- changelog.txt | 3 + .../resource.language.en_gb/strings.po | 4 + .../resource.language.pl_pl/strings.po | 4 + .../resource.language.sv_se/strings.po | 4 + resources/lib/addon.py | 74 +++++++++++-------- resources/settings.xml | 2 + 7 files changed, 61 insertions(+), 34 deletions(-) diff --git a/addon.xml b/addon.xml index 52cbc70..8eabaf6 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@  - + @@ -16,7 +16,7 @@ Se innhold fra Viaplay. Titta på innehåll från Viaplay. Oglądaj treści z Viaplay. - 2021.08.05 v.2.1.3[CR]+ Added viaplay.pl[CR]2021.08.07 v2.1.4[CR]+ Added watched and purchased categories for viaplay.pl[CR]+ Fixed category error + 2021.08.08 v2.1.5[CR]+ Added setting "Hide previously aired Live-Tv programmes"[CR][CR]2021.08.07 v2.1.4[CR]+ Added watched and purchased categories for viaplay.pl[CR]+ Fixed category error[CR][CR]2021.08.05 v.2.1.3[CR]+ Added viaplay.pl all sv dk no fi en pl diff --git a/changelog.txt b/changelog.txt index c7a8ed9..a87a699 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +2021.08.08 v.2.1.5 ++ Added setting "Hide previously aired Live-Tv programmes" @Mariusz89B + 2021.08.07 v.2.1.4 + Added watched and purchased categories for viaplay.pl @Mariusz89B + Fixed category error diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 2b43541..7095ed8 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -223,4 +223,8 @@ msgstr "" msgctxt "#30055" msgid "Polish" +msgstr "" + +msgctxt "#30056" +msgid "Hide previously aired Live-Tv programmes" msgstr "" \ No newline at end of file diff --git a/resources/language/resource.language.pl_pl/strings.po b/resources/language/resource.language.pl_pl/strings.po index d666fd0..c206523 100644 --- a/resources/language/resource.language.pl_pl/strings.po +++ b/resources/language/resource.language.pl_pl/strings.po @@ -224,3 +224,7 @@ msgstr "" msgctxt "#30055" msgid "Polish" msgstr "Polski" + +msgctxt "#30056" +msgid "Hide previously aired Live-Tv programmes" +msgstr "Ukryj wcześniej nadawane programy Live-Tv" diff --git a/resources/language/resource.language.sv_se/strings.po b/resources/language/resource.language.sv_se/strings.po index 6d5e7c3..cbb25a5 100644 --- a/resources/language/resource.language.sv_se/strings.po +++ b/resources/language/resource.language.sv_se/strings.po @@ -224,3 +224,7 @@ msgstr "" msgctxt "#30055" msgid "Polish" msgstr "Polska" + +msgctxt "#30056" +msgid "Hide previously aired Live-Tv programmes" +msgstr "Dölj tidigare sända Live-TV program" \ No newline at end of file diff --git a/resources/lib/addon.py b/resources/lib/addon.py index 8e5d2e9..db2dc3e 100644 --- a/resources/lib/addon.py +++ b/resources/lib/addon.py @@ -377,45 +377,55 @@ def add_tv_event(event): now = datetime.now() date_today = now.date() start_time_obj = helper.vp.parse_datetime(event['epg']['startTime'], localize=True) + end_time_obj = helper.vp.parse_datetime(event['epg']['endTime'], localize=True) event_status = helper.vp.get_event_status(event) - # hide non-available catchup items - if now > helper.vp.parse_datetime(event['system']['catchupAvailability']['end'], localize=True): - return - if date_today == start_time_obj.date(): - start_time = '{0} {1}'.format(helper.language(30027), start_time_obj.strftime('%H:%M')) - else: - start_time = start_time_obj.strftime('%Y-%m-%d %H:%M') + status = False - if event_status != 'upcoming': - plugin_url = plugin.url_for(play, guid=event['system']['guid'] + '-%s' % helper.get_country_code().upper(), url=None, tve='true') - playable = True - else: - plugin_url = plugin.url_for(dialog, dialog_type='ok', - heading=helper.language(30017), - message=helper.language(30016).format(start_time).encode('utf-8')) - playable = False + if end_time_obj >= now and helper.get_setting('previous_channels'): + status = True + elif not helper.get_setting('previous_channels'): + status = True - details = event['content'] + if status: + # hide non-available catchup items + if now > helper.vp.parse_datetime(event['system']['catchupAvailability']['end'], localize=True): + return + + if date_today == start_time_obj.date(): + start_time = '{0} {1}'.format(helper.language(30027), start_time_obj.strftime('%H:%M')) + else: + start_time = start_time_obj.strftime('%Y-%m-%d %H:%M') - if sys.version_info[0] > 2: - title = details.get('title') - else: - title = details.get('title').encode('utf-8') + if event_status != 'upcoming': + plugin_url = plugin.url_for(play, guid=event['system']['guid'] + '-%s' % helper.get_country_code().upper(), url=None, tve='true') + playable = True + else: + plugin_url = plugin.url_for(dialog, dialog_type='ok', + heading=helper.language(30017), + message=helper.language(30016).format(start_time).encode('utf-8')) + playable = False - event_info = { - 'mediatype': 'video', - 'title': details.get('title'), - 'plot': details.get('synopsis'), - 'year': details['production'].get('year'), - 'list_title': '[B]{0}:[/B] {1}'.format(coloring(start_time, event_status), 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 - } + details = event['content'] + + if sys.version_info[0] > 2: + title = details.get('title') + else: + title = details.get('title').encode('utf-8') + + event_info = { + 'mediatype': 'video', + 'title': details.get('title'), + 'plot': details.get('synopsis'), + 'year': details['production'].get('year'), + 'list_title': '[B]{0}:[/B] {1}'.format(coloring(start_time, event_status), 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 + } - helper.add_item(event_info['list_title'], plugin_url, playable=playable, info=event_info, art=art, content='episodes') + helper.add_item(event_info['list_title'], plugin_url, playable=playable, info=event_info, art=art, content='episodes') def add_art(images, content_type): diff --git a/resources/settings.xml b/resources/settings.xml index caf380b..5c5a2f7 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -4,6 +4,8 @@ + +