Skip to content

Commit

Permalink
2.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariusz89B committed Jan 30, 2022
1 parent 68d5ea7 commit f0a7763
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 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.2.7" name="Viaplay" provider-name="emilsvennesson, mariusz89b">
<addon id="plugin.video.viaplay" version="2.2.8" name="Viaplay" provider-name="emilsvennesson, mariusz89b">
<requires>
<import addon="script.module.requests" version="2.9.1" />
<import addon="script.module.iso8601" version="0.1.11" />
Expand All @@ -17,7 +17,7 @@
<description lang="sv_SE">Titta på innehåll från Viaplay.</description>
<description lang="pl_PL">Oglądaj treści z Viaplay.</description>
<description lang="lt_LT">Žiūrėkite turinį iš Viaplay.</description>
<news>2022.01.27 v2.2.7[CR]+ Fixed logout[CR][CR]2022.01.27 v2.2.6[CR]+ Fixed login error[CR][CR]2022.01.25 v2.2.5[CR]+ Fixes[CR][CR]2022.01.23 v2.2.4[CR]+ Fixed external authorization[CR][CR]2021.11.09 v2.2.3[CR]+ Added viaplay.lt[CR][CR]2021.10.24 v2.2.2[CR]+ Fixed plot[CR][CR]2021.10.06 v2.2.1[CR]+ Fixed category sport matches abbreviations[CR][CR]2021.09.29 v2.2.0[CR]+ Fixed subtitles[CR][CR]2021.09.27 v2.1.9[CR]+ Fixed product categories[CR][CR]2021.08.17 v2.1.8[CR]+ Fixed html import error[CR][CR]2021.08.11 v2.1.7[CR]+ Fixed M3U playlist generator[CR][CR]2021.08.09 v2.1.6[CR]+ Added M3U playlist generator[CR][CR]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>2022.01.28 v2.2.8[CR]+ Kids category updates[CR][CR]2022.01.27 v2.2.7[CR]+ Fixed logout[CR][CR]2022.01.27 v2.2.6[CR]+ Fixed login error[CR][CR]2022.01.25 v2.2.5[CR]+ Fixes[CR][CR]2022.01.23 v2.2.4[CR]+ Fixed external authorization[CR][CR]2021.11.09 v2.2.3[CR]+ Added viaplay.lt[CR][CR]2021.10.24 v2.2.2[CR]+ Fixed plot[CR][CR]2021.10.06 v2.2.1[CR]+ Fixed category sport matches abbreviations[CR][CR]2021.09.29 v2.2.0[CR]+ Fixed subtitles[CR][CR]2021.09.27 v2.1.9[CR]+ Fixed product categories[CR][CR]2021.08.17 v2.1.8[CR]+ Fixed html import error[CR][CR]2021.08.11 v2.1.7[CR]+ Fixed M3U playlist generator[CR][CR]2021.08.09 v2.1.6[CR]+ Added M3U playlist generator[CR][CR]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 lt</language>
Expand Down
60 changes: 33 additions & 27 deletions resources/lib/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,51 +168,57 @@ def search():
@plugin.route('/vod')
def vod():
"""List categories and collections from the VOD pages (movies, series, kids, store)."""
from itertools import groupby, chain
from operator import itemgetter

helper.add_item(helper.language(30041), plugin.url_for(categories, url=plugin.args['url'][0]))
collections = helper.vp.get_collections(plugin.args['url'][0])

add_lst = []
collections = helper.vp.get_collections(plugin.args['url'][0])

for i in collections:
if i['type'] == 'list-featurebox': # skip feature box for now
continue

if i['title'] == '':
if 'a6-00' in i['id']:
i['title'] = '3+'
elif 'a6-01' in i['id']:
i['title'] = '7+'
elif 'a6-02' in i['id']:
i['title'] = '12+'
elif 'a6-03' in i['id']:
i['title'] = '16+'
elif 'a6-04' in i['id']:
add_lst.append(i['_links']['self']['href'])
i = None
elif 'cfed1737-7efb-484c-aca9-a851901a6-05' in i['id']:
add_lst.append(i['_links']['self']['href'])
i = None
elif 'cfed1737-7efb-484c-aca9-a851901a6-06' in i['id']:
add_lst.append(i['_links']['self']['href'])
i = None
else:
i['title'] = ''
i = None

try:
helper.add_item(i['title'], plugin.url_for(list_products, url=i['_links']['self']['href']))
except:
pass

"""
add_lst = []
for i in collections:
if 'a6-01' in i['id'] or 'a6-00' in i['id']:
add_lst.append(i['_links']['self']['href'])
add = False
if add_lst:
ordered_lst = ""
for url in add_lst:
ordered_lst += url
helper.add_item('Filmy', plugin.url_for(list_products, url=ordered_lst))
helper.add_item('Seriale', plugin.url_for(list_products, url=ordered_lst))
for i in collections:
add = True
if i['type'] == 'list-featurebox': # skip feature box for now
continue
if i['title'] == '':
for x in i['_embedded']['viaplay:products']:
if x['type'] != 'series':
title = x['content']['title']
url = x['_links']['self']['href']
helper.add_item(title, plugin.url_for(list_products, url=url))
add = False
else:
add = False
if add:
helper.add_item(i['title'], plugin.url_for(list_products, url=i['_links']['self']['href']))
"""

helper.eod()

Expand Down
3 changes: 3 additions & 0 deletions resources/lib/viaplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def get_collections(self, url):
"""Return all available collections."""
data = self.make_request(url=url, method='get')
# return all blocks (collections) with 'list' in type

return [x for x in data['_embedded']['viaplay:blocks'] if 'list' in x['type'].lower()]

def get_products(self, url, filter_event=False, search_query=None):
Expand All @@ -341,6 +342,7 @@ def get_products(self, url, filter_event=False, search_query=None):
# try to collect all products found in viaplay:blocks
products = [p for x in data['_embedded']['viaplay:blocks'] if 'viaplay:products' in x['_embedded'] for p in x['_embedded']['viaplay:products']]


if filter_event:
# filter out and only return products with event_status in filter_event
products = [x for x in products if x['event_status'] in filter_event]
Expand Down Expand Up @@ -463,6 +465,7 @@ def get_next_page(self, data):
break
elif data['type'] == 'product':
data = data['_embedded']['viaplay:product']

if 'next' in data['_links']:
next_page_url = data['_links']['next']['href']
return next_page_url
Expand Down

0 comments on commit f0a7763

Please sign in to comment.