Skip to content

Commit 9758159

Browse files
authored
Add random attribute to Hub (#1513)
* Add `random` attribute to `Hub` * Add test for hub random attribute
1 parent 607166e commit 9758159

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

plexapi/library.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,6 +2211,7 @@ class Hub(PlexObject):
22112211
items (list): List of items in the hub.
22122212
key (str): API URL for the hub.
22132213
more (bool): True if there are more items to load (call reload() to fetch all items).
2214+
random (bool): True if the items in the hub are randomized.
22142215
size (int): The number of items in the hub.
22152216
style (str): The style of the hub.
22162217
title (str): The title of the hub.
@@ -2227,6 +2228,7 @@ def _loadData(self, data):
22272228
self.items = self.findItems(data)
22282229
self.key = data.attrib.get('key')
22292230
self.more = utils.cast(bool, data.attrib.get('more'))
2231+
self.random = utils.cast(bool, data.attrib.get('random', '0'))
22302232
self.size = utils.cast(int, data.attrib.get('size'))
22312233
self.style = data.attrib.get('style')
22322234
self.title = data.attrib.get('title')

tests/test_video.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ def test_video_Movie_hubs(movies):
569569
assert len(hub.items) == hub.size
570570
assert utils.is_metadata(hub.key)
571571
assert hub.more is False
572+
assert hub.random is False
572573
assert hub.size == 1
573574
assert hub.style in (None, "shelf")
574575
assert hub.title == "Related Movies"

0 commit comments

Comments
 (0)