Skip to content

Commit b22e87f

Browse files
committed
Add support for query media-section-with-show
1 parent c1e004f commit b22e87f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/srgssr.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ def build_menu_apiv3(self, queries, mode=1000, page=1, page_hash=None,
347347
data = json.loads(self.open_url(self.apiv3_url + query))
348348
if data:
349349
data = utils.try_get(data, ['data', 'data'], list, []) or \
350+
utils.try_get(data, ['data', 'medias'], list, []) or \
350351
utils.try_get(data, ['data', 'results'], list, []) or \
351352
utils.try_get(data, 'data', list, [])
352353
for item in data:
@@ -379,6 +380,7 @@ def build_menu_apiv3(self, queries, mode=1000, page=1, page_hash=None,
379380
return
380381

381382
items = utils.try_get(data, 'data', list, []) or \
383+
utils.try_get(data, 'medias', list, []) or \
382384
utils.try_get(data, 'results', list, []) or data
383385

384386
for item in items:
@@ -505,9 +507,8 @@ def build_menu_from_page(self, url, path):
505507
id = elem['id']
506508
section_type = elem['sectionType']
507509
title = utils.try_get(elem, ('representation', 'title'))
508-
# TODO: Are there more section types to consider?
509-
# there is 'MediaSectionWithShow'
510-
if section_type in ('MediaSection', 'ShowSection'):
510+
if section_type in (
511+
'MediaSection', 'ShowSection', 'MediaSectionWithShow'):
511512
if section_type == 'MediaSection' and not title and \
512513
utils.try_get(
513514
elem, ('representation', 'name')
@@ -524,6 +525,8 @@ def build_menu_from_page(self, url, path):
524525
name = f'media-section?sectionId={id}'
525526
elif section_type == 'ShowSection':
526527
name = f'show-section?sectionId={id}'
528+
elif section_type == 'MediaSectionWithShow':
529+
name = f'media-section-with-show?sectionId={id}'
527530
url = self.build_url(mode=1000, name=name, page=1)
528531
xbmcplugin.addDirectoryItem(
529532
self.handle, url, list_item, isFolder=True)

0 commit comments

Comments
 (0)