Skip to content

Commit

Permalink
2.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz89B committed Aug 8, 2021
1 parent d2b20ab commit 7f87b10
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 34 deletions.
4 changes: 2 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="plugin.video.viaplay" version="2.1.4" name="Viaplay" provider-name="emilsvennesson">
<addon id="plugin.video.viaplay" version="2.1.5" name="Viaplay" provider-name="emilsvennesson">
<requires>
<import addon="script.module.requests" version="2.9.1" />
<import addon="script.module.iso8601" version="0.1.11" />
Expand All @@ -16,7 +16,7 @@
<description lang="nb_NO">Se innhold fra Viaplay.</description>
<description lang="sv_SE">Titta på innehåll från Viaplay.</description>
<description lang="pl_PL">Oglądaj treści z Viaplay.</description>
<news>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
<news>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
</news>
<platform>all</platform>
<language>sv dk no fi en pl</language>
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,8 @@ msgstr ""

msgctxt "#30055"
msgid "Polish"
msgstr ""

msgctxt "#30056"
msgid "Hide previously aired Live-Tv programmes"
msgstr ""
4 changes: 4 additions & 0 deletions resources/language/resource.language.pl_pl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 4 additions & 0 deletions resources/language/resource.language.sv_se/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
74 changes: 42 additions & 32 deletions resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<setting id="subtitles" type="bool" label="30012" default="true"/>
<setting id="sub_lang" type="enum" label="30044" lvalues="30045|30046|30047|30048|30055" default="0" visible="!eq(-1,false)" subsetting="true"/>
<setting id="first_run" type="bool" default="true" visible="false"/>
<setting type="sep" />
<setting id="previous_channels" type="bool" label="30056" default="false"/>
<setting type="sep" />
<setting id="ia_settings" type="action" label="30053" action="RunPlugin(plugin://plugin.video.viaplay/ia_settings)" enable="System.HasAddon(inputstream.adaptive)" option="close" />
</category>
Expand Down

0 comments on commit 7f87b10

Please sign in to comment.