From c857feb52c6991a08bd9101252be6159c7092f4a Mon Sep 17 00:00:00 2001 From: blacktwin Date: Wed, 9 Oct 2019 10:45:48 -0400 Subject: [PATCH] add _posters function and poster attribute to video class docstring updated --- plexapi/video.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plexapi/video.py b/plexapi/video.py index 008ef5c4..9ebaf7d2 100644 --- a/plexapi/video.py +++ b/plexapi/video.py @@ -24,6 +24,7 @@ class Video(PlexPartialObject): type (str): 'artist', 'album', or 'track'. updatedAt (datatime): Datetime this item was updated. viewCount (int): Count of times this item was accessed. + posters (List<:class:`~plexapi.media.Poster`>): List of poster objects. """ def _loadData(self, data): @@ -42,6 +43,7 @@ class Video(PlexPartialObject): self.type = data.attrib.get('type') self.updatedAt = utils.toDatetime(data.attrib.get('updatedAt')) self.viewCount = utils.cast(int, data.attrib.get('viewCount', 0)) + self.posters = self._posters() @property def isWatched(self): @@ -89,6 +91,14 @@ class Video(PlexPartialObject): """ Returns str, default title for a new syncItem. """ return self.title + def _posters(self): + """ Returns list of available poster objects. :class:`~plexapi.media.Poster`:""" + items = [] + for elem in self._server.query('%s/posters' % self.key): + items.append(media.Poster(server=self._server, data=elem)) + + return items + def sync(self, videoQuality, client=None, clientId=None, limit=None, unwatched=False, title=None): """ Add current video (movie, tv-show, season or episode) as sync item for specified device. See :func:`plexapi.myplex.MyPlexAccount.sync()` for possible exceptions.