Merge pull request #390 from pkkid/posters

posters
This commit is contained in:
Steffen Fredriksen 2019-11-06 17:49:28 +01:00 committed by GitHub
commit 4ea81af0ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 0 deletions

View file

@ -467,6 +467,23 @@ class Mood(MediaTag):
FILTER = 'mood'
@utils.registerPlexObject
class Poster(PlexObject):
""" Represents a Poster.
Attributes:
TAG (str): 'Photo'
"""
TAG = 'Photo'
def _loadData(self, data):
self._data = data
self.key = data.attrib.get('key')
self.ratingKey = data.attrib.get('ratingKey')
self.selected = data.attrib.get('selected')
self.thumb = data.attrib.get('thumb')
@utils.registerPlexObject
class Producer(MediaTag):
""" Represents a single Producer media tag.

View file

@ -89,6 +89,11 @@ 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`:"""
return self.fetchItems('%s/posters' % self.key, cls=media.Poster)
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.

View file

@ -101,6 +101,7 @@ def test_video_Movie_attrs(movies):
assert [i.tag for i in movie.directors] == ['Nina Paley']
assert movie.duration >= 160000
assert movie.fields == []
assert movie.posters()
assert sorted([i.tag for i in movie.genres]) == ['Animation', 'Comedy', 'Fantasy', 'Musical', 'Romance']
assert movie.guid == 'com.plexapp.agents.imdb://tt1172203?lang=en'
assert utils.is_metadata(movie._initpath)