add agents method to library

allow the searching for available agents for specific library
This commit is contained in:
blacktwin 2020-03-16 13:54:16 -04:00
parent af586fa55d
commit cea4f1944e

View file

@ -404,6 +404,16 @@ class LibrarySection(PlexObject):
key = '/library/sections/%s/all%s' % (self.key, sortStr)
return self.fetchItems(key, **kwargs)
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
def settings(self):
""" Returns a list of all library settings. """
key = '/library/sections/%s/prefs' % self.key