only allow sections available agents to be used.

This commit is contained in:
blacktwin 2020-03-16 14:05:45 -04:00
parent cea4f1944e
commit b54f61d1cf

View file

@ -453,13 +453,13 @@ class PlexPartialObject(PlexObject):
'year': year or self.year if self.section().type != 'artist' else '',
'language': language or self.section().language}
if agent:
agents = self._server.agents()
agents = self.section().agents()
match_agent = next((ag for ag in agents if ag.shortIdentifier == agent), None)
if match_agent:
params['agent'] = match_agent.identifier
else:
raise NotFound('Couldnt find "%s" in agents list (%s)' %
(agent, ','.join(agents.keys())))
(agent, ', '.join([a.shortIdentifier for a in agents])))
else:
params['agent'] = self.section().agent