File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -716,10 +716,12 @@ def hubs(self, **kwargs):
716716 Parameters:
717717 **kwargs (dict): Optional query parameters to add to the request
718718 (e.g. ``count=10`` to limit the number of items per hub or
719- ``includeMyMixes=1`` to include the personalized "Mixes For You" hub).
720- ``includeStations=1`` is included by default and may be overridden.
719+ ``includeMyMixes=True`` to include the personalized "Mixes For You" hub).
720+ ``includeStations`` is included by default and may be overridden
721+ with ``includeStations=False``.
721722 """
722723 kwargs .setdefault ('includeStations' , 1 )
724+ kwargs = {k : 1 if v is True else 0 if v is False else v for k , v in kwargs .items ()}
723725 key = self ._buildQueryKey (f'/hubs/sections/{ self .key } ' , ** kwargs )
724726 return self .fetchItems (key )
725727
Original file line number Diff line number Diff line change @@ -396,6 +396,8 @@ def test_library_MusicSection_hubs_kwargs(music):
396396 assert hubs
397397 for hub in hubs :
398398 assert len (hub ._partialItems ) <= 5
399+ hubs = music .hubs (includeStations = False )
400+ assert not any (h .context == "hub.music.stations" for h in hubs )
399401
400402
401403def test_library_ShowSection_all (tvshows ):
Original file line number Diff line number Diff line change @@ -38,8 +38,8 @@ def test_Playlist_attrs(playlist):
3838def test_Playlist_centroid (plex , music , requests_mock ):
3939 # 'Mix For You' playlists cannot be generated on the bootstrap server,
4040 # so serve a representative hubs response and parse it through the normal path.
41- requests_mock .get (plex .url (f"/hubs/sections/{ music .key } " ), text = MUSIC_MIXES_HUB )
42- hubs = music .hubs (includeMyMixes = 1 )
41+ requests_mock .get (plex .url (f"/hubs/sections/{ music .key } ?includeMyMixes=1 " ), text = MUSIC_MIXES_HUB )
42+ hubs = music .hubs (includeMyMixes = True )
4343 mix = next (h for h in hubs if h .context == "hub.music.mixes" ).items ()[0 ]
4444 assert mix .smart is True
4545 centroid = mix .centroid
You can’t perform that action at this time.
0 commit comments