mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 06:04:15 +00:00
import new Conversion class and return active Conversions
This commit is contained in:
parent
c29563632b
commit
45df6b57cf
1 changed files with 13 additions and 1 deletions
|
@ -13,7 +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 Optimized
|
||||
from plexapi.media import Optimized, Conversion
|
||||
|
||||
# Need these imports to populate utils.PLEXOBJECTS
|
||||
from plexapi import (audio as _audio, video as _video, # noqa: F401
|
||||
|
@ -376,6 +376,18 @@ class PlexServer(PlexObject):
|
|||
|
||||
return items
|
||||
|
||||
def conversions(self):
|
||||
""" Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """
|
||||
items = []
|
||||
|
||||
backgroundProcessing = self.query('/playQueues?type=42')
|
||||
for elem in backgroundProcessing:
|
||||
key = elem.attrib.get('id')
|
||||
for elem in self.query('/playQueues/%s' % key):
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue