From 5c41bf01acd0af3addb401f4b0314bc46a19326a Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Mon, 25 Jan 2021 09:14:25 -0800 Subject: [PATCH 1/2] Add thumbUrl and artUrl properties to collections --- plexapi/library.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plexapi/library.py b/plexapi/library.py index e27df9876..ce0e0ec61 100644 --- a/plexapi/library.py +++ b/plexapi/library.py @@ -1595,7 +1595,17 @@ def _loadData(self, data): @deprecated('use "items" instead') def children(self): return self.fetchItems(self.key) - + + @property + def thumbUrl(self): + """ Return the thumbnail url for the collection.""" + return self._server.url(self.thumb, includeToken=True) if self.thumb else None + + @property + def artUrl(self): + """ Return the art url for the collection.""" + return self._server.url(self.art, includeToken=True) if self.art else None + def item(self, title): """ Returns the item in the collection that matches the specified title. From 688bca92ac6c7e4ad3d7a6e7ca7703dff253958e Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Mon, 25 Jan 2021 09:20:19 -0800 Subject: [PATCH 2/2] Add tests for collection thumbUrl and artUrl --- tests/test_library.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_library.py b/tests/test_library.py index 3958a8e32..b081df14e 100644 --- a/tests/test_library.py +++ b/tests/test_library.py @@ -313,6 +313,16 @@ def test_library_Collection_items(collection): assert len(items) == 1 +def test_library_Collection_thumbUrl(collection): + assert utils.SERVER_BASEURL in collection.thumbUrl + assert "/library/collections/" in collection.thumbUrl + assert "/composite/" in collection.thumbUrl + + +def test_library_Collection_artUrl(collection): + assert collection.artUrl is None # Collections don't have default art + + def test_search_with_weird_a(plex): ep_title = "Coup de GrĂ¢ce" result_root = plex.search(ep_title)