This commit is contained in:
Hellowlol 2017-10-26 00:01:42 +02:00
parent 389cc5a30a
commit 26bf4ca010
3 changed files with 6 additions and 7 deletions

View file

@ -58,7 +58,6 @@ class Photoalbum(PlexPartialObject):
return album return album
raise NotFound('Unable to find album: %s' % title) raise NotFound('Unable to find album: %s' % title)
def photos(self, **kwargs): def photos(self, **kwargs):
""" Returns a list of :class:`~plexapi.photo.Photo` objects in this album. """ """ Returns a list of :class:`~plexapi.photo.Photo` objects in this album. """
key = '/library/metadata/%s/children' % self.ratingKey key = '/library/metadata/%s/children' % self.ratingKey

View file

@ -34,13 +34,13 @@ class Playlist(PlexPartialObject, Playable):
self.updatedAt = toDatetime(data.attrib.get('updatedAt')) self.updatedAt = toDatetime(data.attrib.get('updatedAt'))
self._items = None # cache for self.items self._items = None # cache for self.items
def __len__(self): def __len__(self): # pragma: no cover
return len(self.items()) return len(self.items())
def __contains__(self, other): def __contains__(self, other): # pragma: no cover
return any(i.key == other.key for i in self.items()) return any(i.key == other.key for i in self.items())
def __getitem__(self, key): def __getitem__(self, key): # pragma: no cover
return self.items()[key] return self.items()[key]
def items(self): def items(self):
@ -57,7 +57,7 @@ class Playlist(PlexPartialObject, Playable):
items = [items] items = [items]
ratingKeys = [] ratingKeys = []
for item in items: for item in items:
if item.listType != self.playlistType: if item.listType != self.playlistType: # pragma: no cover
raise BadRequest('Can not mix media types when building a playlist: %s and %s' % raise BadRequest('Can not mix media types when building a playlist: %s and %s' %
(self.playlistType, item.listType)) (self.playlistType, item.listType))
ratingKeys.append(str(item.ratingKey)) ratingKeys.append(str(item.ratingKey))
@ -108,7 +108,7 @@ class Playlist(PlexPartialObject, Playable):
items = [items] items = [items]
ratingKeys = [] ratingKeys = []
for item in items: for item in items:
if item.listType != items[0].listType: if item.listType != items[0].listType: # pragma: no cover
raise BadRequest('Can not mix media types when building a playlist') raise BadRequest('Can not mix media types when building a playlist')
ratingKeys.append(str(item.ratingKey)) ratingKeys.append(str(item.ratingKey))
ratingKeys = ','.join(ratingKeys) ratingKeys = ','.join(ratingKeys)