use server.agents() mediaType keyword to shorten code

Thanks @jonnywong16
This commit is contained in:
blacktwin 2020-03-16 14:26:01 -04:00
parent 2ab3b61447
commit 98226c044b

View file

@ -407,12 +407,7 @@ class LibrarySection(PlexObject):
def agents(self):
""" Returns a list of available `:class:`~plexapi.media.Agent` for this library section.
"""
results = []
for agent in self._server.agents():
for agentType in agent.mediaTypes:
if agentType.mediaType == utils.searchType(self.type):
results.append(agent)
return results
return self._server.agents(utils.searchType(self.type))
def settings(self):
""" Returns a list of all library settings. """