mirror of
https://github.com/pkkid/python-plexapi
synced 2024-09-21 06:11:56 +00:00
update matches method to operate more closely to webui
thanks @jonnywong16
This commit is contained in:
parent
54c871fc01
commit
e44513c44d
1 changed files with 17 additions and 13 deletions
|
@ -447,21 +447,25 @@ class PlexPartialObject(PlexObject):
|
|||
language (str) : Language of item to search in
|
||||
"""
|
||||
key = '/library/metadata/%s/matches' % self.ratingKey
|
||||
if not auto:
|
||||
params = {'manual': 1,
|
||||
'title': title or self.title,
|
||||
'year': year or self.year if self.section().type != 'artist' else '',
|
||||
'language': language or self.section().language}
|
||||
if agent:
|
||||
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
|
||||
params = {'manual': 1}
|
||||
|
||||
if any([agent, title, year, language]):
|
||||
if title is None:
|
||||
params['title'] = self.title
|
||||
else:
|
||||
raise NotFound('Couldnt find "%s" in agents list (%s)' %
|
||||
(agent, ', '.join([a.shortIdentifier for a in agents])))
|
||||
params['title'] = title
|
||||
|
||||
if year is None:
|
||||
params['year'] = self.year
|
||||
else:
|
||||
params['year'] = year
|
||||
|
||||
params['language'] = language or self.section().language
|
||||
|
||||
if agent is None:
|
||||
params['agent'] = self.section().agent
|
||||
else:
|
||||
params['agent'] = utils.getAgentIdentifier(self.section(), agent)
|
||||
|
||||
key = key + '?' + urlencode(params)
|
||||
data = self._server.query(key, method=self._server._session.get)
|
||||
|
|
Loading…
Reference in a new issue