Skip to content

Commit bc316a6

Browse files
committed
add removeAll option to optimiziedItems
1 parent 0a6a6d0 commit bc316a6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

plexapi/server.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,14 @@ def playlist(self, title):
373373
"""
374374
return self.fetchItem('/playlists', title=title)
375375

376-
def optimizedItems(self):
376+
def optimizedItems(self, removeAll=None):
377377
""" Returns list of all :class:`~plexapi.media.Optimized` objects connected to server. """
378-
379-
backgroundProcessing = self.fetchItem('/playlists?type=42')
380-
return self.fetchItems('%s/items' % backgroundProcessing.key, cls=Optimized)
378+
if removeAll is True:
379+
key = '/playlists/generators?type=42'
380+
self.query(key, method=self._server._session.delete)
381+
else:
382+
backgroundProcessing = self.fetchItem('/playlists?type=42')
383+
return self.fetchItems('%s/items' % backgroundProcessing.key, cls=Optimized)
381384

382385
def conversions(self):
383386
""" Returns list of all :class:`~plexapi.media.Conversion` objects connected to server. """

0 commit comments

Comments
 (0)