use fetchItem and fetchItems instead of query

This commit is contained in:
blacktwin 2020-01-27 14:17:23 -05:00
parent ad2de7c9a6
commit 2da4d2bf68

View file

@ -366,15 +366,9 @@ class PlexServer(PlexObject):
def optimizedItems(self): def optimizedItems(self):
""" Returns list of all :class:`~plexapi.media.Optimized` objects connected to server. """ """ Returns list of all :class:`~plexapi.media.Optimized` objects connected to server. """
items = []
backgroundProcessing = self.query('/playlists?type=42') backgroundProcessing = self.fetchItem('/playlists?type=42')
for elem in backgroundProcessing: return self.fetchItems('%s/items' % backgroundProcessing.key, cls=Optimized)
key = elem.attrib.get('key')
for elem in self.query(key):
items.append(Optimized(server=self, data=elem))
return items
def conversions(self): def conversions(self):
""" Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """ """ Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """