Skip to content

Commit 45df6b5

Browse files
committed
import new Conversion class and return active Conversions
1 parent c295636 commit 45df6b5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

plexapi/server.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from plexapi.playlist import Playlist
1414
from plexapi.playqueue import PlayQueue
1515
from plexapi.utils import cast
16-
from plexapi.media import Optimized
16+
from plexapi.media import Optimized, Conversion
1717

1818
# Need these imports to populate utils.PLEXOBJECTS
1919
from plexapi import (audio as _audio, video as _video, # noqa: F401
@@ -376,6 +376,18 @@ def optimizedItems(self):
376376

377377
return items
378378

379+
def conversions(self):
380+
""" Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """
381+
items = []
382+
383+
backgroundProcessing = self.query('/playQueues?type=42')
384+
for elem in backgroundProcessing:
385+
key = elem.attrib.get('id')
386+
for elem in self.query('/playQueues/%s' % key):
387+
items.append(Conversion(server=self, data=elem))
388+
389+
return items
390+
379391
def query(self, key, method=None, headers=None, timeout=None, **kwargs):
380392
""" Main method used to handle HTTPS requests to the Plex server. This method helps
381393
by encoding the response to utf-8 and parsing the returned XML into and

0 commit comments

Comments
 (0)