Skip to content

Commit cea4f19

Browse files
committed
add agents method to library
allow the searching for available agents for specific library
1 parent af586fa commit cea4f19

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

plexapi/library.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,16 @@ def all(self, sort=None, **kwargs):
404404
key = '/library/sections/%s/all%s' % (self.key, sortStr)
405405
return self.fetchItems(key, **kwargs)
406406

407+
def agents(self):
408+
""" Returns a list of available `:class:`~plexapi.media.Agent` for this library section.
409+
"""
410+
results = []
411+
for agent in self._server.agents():
412+
for agentType in agent.mediaTypes:
413+
if agentType.mediaType == utils.searchType(self.type):
414+
results.append(agent)
415+
return results
416+
407417
def settings(self):
408418
""" Returns a list of all library settings. """
409419
key = '/library/sections/%s/prefs' % self.key

0 commit comments

Comments
 (0)