Add art and thumb url to plexapi collections

This commit is contained in:
JonnyWong16
2020-09-20 21:03:05 -07:00
parent 7eedb14834
commit 75cdc2c5e8

View File

@@ -1092,6 +1092,7 @@ class Collections(PlexObject):
def _loadData(self, data):
self.ratingKey = utils.cast(int, data.attrib.get('ratingKey'))
self._details_key = "/library/metadata/%s%s" % (self.ratingKey, self._include)
self.art = data.attrib.get('art')
self.contentRating = data.attrib.get('contentRating')
self.guid = data.attrib.get('guid')
self.key = data.attrib.get('key')
@@ -1118,6 +1119,16 @@ class Collections(PlexObject):
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 __len__(self):
return self.childCount