import Conversion and create conversions function

This commit is contained in:
blacktwin 2019-10-08 23:27:23 -04:00
parent 63024025ce
commit a9f341169f

View file

@ -13,6 +13,7 @@ from plexapi.settings import Settings
from plexapi.playlist import Playlist
from plexapi.playqueue import PlayQueue
from plexapi.utils import cast
from plexapi.media import Conversion
# Need these imports to populate utils.PLEXOBJECTS
from plexapi import (audio as _audio, video as _video, # noqa: F401
@ -363,6 +364,14 @@ class PlexServer(PlexObject):
"""
return self.fetchItem('/playlists', title=title)
def conversions(self):
""" Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """
items = []
for elem in self.query('/playlists/1111/items'):
items.append(Conversion(server=self, data=elem))
return items
def query(self, key, method=None, headers=None, timeout=None, **kwargs):
""" Main method used to handle HTTPS requests to the Plex server. This method helps
by encoding the response to utf-8 and parsing the returned XML into and