From 2da4d2bf68ccd9411008939867a54b0d8fa406a2 Mon Sep 17 00:00:00 2001 From: blacktwin Date: Mon, 27 Jan 2020 14:17:23 -0500 Subject: [PATCH] use fetchItem and fetchItems instead of query --- plexapi/server.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/plexapi/server.py b/plexapi/server.py index f84b3a33..b927e0ec 100644 --- a/plexapi/server.py +++ b/plexapi/server.py @@ -366,15 +366,9 @@ class PlexServer(PlexObject): def optimizedItems(self): """ Returns list of all :class:`~plexapi.media.Optimized` objects connected to server. """ - items = [] - backgroundProcessing = self.query('/playlists?type=42') - for elem in backgroundProcessing: - key = elem.attrib.get('key') - for elem in self.query(key): - items.append(Optimized(server=self, data=elem)) - - return items + backgroundProcessing = self.fetchItem('/playlists?type=42') + return self.fetchItems('%s/items' % backgroundProcessing.key, cls=Optimized) def conversions(self): """ Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """