Skip to content

Add random attribute to Hub #1513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plexapi/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,7 @@ class Hub(PlexObject):
items (list): List of items in the hub.
key (str): API URL for the hub.
more (bool): True if there are more items to load (call reload() to fetch all items).
random (bool): True if the items in the hub are randomized.
size (int): The number of items in the hub.
style (str): The style of the hub.
title (str): The title of the hub.
Expand All @@ -2227,6 +2228,7 @@ def _loadData(self, data):
self.items = self.findItems(data)
self.key = data.attrib.get('key')
self.more = utils.cast(bool, data.attrib.get('more'))
self.random = utils.cast(bool, data.attrib.get('random', '0'))
self.size = utils.cast(int, data.attrib.get('size'))
self.style = data.attrib.get('style')
self.title = data.attrib.get('title')
Expand Down
1 change: 1 addition & 0 deletions tests/test_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ def test_video_Movie_hubs(movies):
assert len(hub.items) == hub.size
assert utils.is_metadata(hub.key)
assert hub.more is False
assert hub.random is False
assert hub.size == 1
assert hub.style in (None, "shelf")
assert hub.title == "Related Movies"
Expand Down
Loading