From e9889ae32fa920726e2478a99807f4ebf0590efe Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Tue, 8 Apr 2025 21:13:11 -0700 Subject: [PATCH 1/2] Add `random` attribute to `Hub` --- plexapi/library.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plexapi/library.py b/plexapi/library.py index 93801a1d7..4f85f63c8 100644 --- a/plexapi/library.py +++ b/plexapi/library.py @@ -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. @@ -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') From 8da051f5fc80ed56a358f3566a7f478f2f0be8fd Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Tue, 8 Apr 2025 22:12:22 -0700 Subject: [PATCH 2/2] Add test for hub random attribute --- tests/test_video.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_video.py b/tests/test_video.py index e7f9c8dbe..fb1f0bc09 100644 --- a/tests/test_video.py +++ b/tests/test_video.py @@ -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"