Skip to content

Commit 1bdba21

Browse files
committed
add arts methods to playlist.Playlist
Playlists currently do not have or expose any art this is to be a place holder for the possible addition from Plex
1 parent 3215856 commit 1bdba21

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

plexapi/playlist.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,23 @@ def uploadPoster(self, url=None, filepath=None):
286286

287287
def setPoster(self, poster):
288288
""" Set . :class:`~plexapi.media.Poster` to :class:`~plexapi.video.Video` """
289-
poster.select()
289+
poster.select()
290+
291+
def arts(self):
292+
""" Returns list of available art objects. :class:`~plexapi.media.Poster`. """
293+
294+
return self.fetchItems('/library/metadata/%s/arts' % self.ratingKey)
295+
296+
def uploadArt(self, url=None, filepath=None):
297+
""" Upload art from url or filepath. :class:`~plexapi.media.Poster` to :class:`~plexapi.video.Video`. """
298+
if url:
299+
key = '/library/metadata/%s/arts?url=%s' % (self.ratingKey, quote_plus(url))
300+
self._server.query(key, method=self._server._session.post)
301+
elif filepath:
302+
key = '/library/metadata/%s/arts?' % self.ratingKey
303+
data = open(filepath, 'rb').read()
304+
self._server.query(key, method=self._server._session.post, data=data)
305+
306+
def setArt(self, art):
307+
""" Set :class:`~plexapi.media.Poster` to :class:`~plexapi.video.Video` """
308+
art.select()

0 commit comments

Comments
 (0)