Skip to content

Commit 56779f0

Browse files
committed
Handle empty whitelist ids correctly (closes #11)
1 parent 63acde8 commit 56779f0

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

lib/srgssr.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,16 +315,18 @@ def build_folder_menu(self, folders):
315315
listitem=list_item, isFolder=True)
316316

317317
def build_menu_apiv3(self, queries, mode, page=None, page_hash=None,
318-
name='', whitelist_ids=[]):
318+
name='', whitelist_ids=None):
319319
"""
320320
Builds a menu based on the API v3, which is supposed to be more stable
321321
322322
Keyword arguments:
323-
queries -- the query string or a list of several queries
324-
mode -- mode for the URL of the next folder
325-
page -- current page
326-
page_hash -- cursor for fetching the next items
327-
name -- name of the list
323+
queries -- the query string or a list of several queries
324+
mode -- mode for the URL of the next folder
325+
page -- current page
326+
page_hash -- cursor for fetching the next items
327+
name -- name of the list
328+
whitelist_ids -- list of ids that should be displayed, if it is set
329+
to `None` it will be ignored
328330
"""
329331
if isinstance(queries, list):
330332
# Build a combined and sorted list for several queries
@@ -580,12 +582,13 @@ def build_episode_menu(self, video_id, include_segments=True,
580582
# Generate a simple playable item for the video
581583
self.build_entry(json_segment, banner)
582584

583-
def build_entry_apiv3(self, data, whitelist_ids=[]):
585+
# TODO: docstring
586+
def build_entry_apiv3(self, data, whitelist_ids=None):
584587
self.log('build_entry_apiv3: urn = %s' % utils.try_get(data, 'urn'))
585588
urn = data['urn']
586589
title = utils.try_get(data, 'title')
587590
media_id = utils.try_get(data, 'id')
588-
if whitelist_ids and media_id not in whitelist_ids:
591+
if whitelist_ids is not None and media_id not in whitelist_ids:
589592
return
590593
description = utils.try_get(data, 'description')
591594
lead = utils.try_get(data, 'lead')

0 commit comments

Comments
 (0)