Skip to content

Commit dc5d147

Browse files
committed
update fixMatch to allow for auto fixmatch
auto will select the first searchResult from matches
1 parent 38b0fee commit dc5d147

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plexapi/base.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,16 @@ def matches(self, auto=True, agent=None, title=None, year=None, language=None):
457457
data = self._server.query(key, method=self._server._session.get)
458458
return self.findItems(data)
459459

460-
def fixMatch(self, searchResult):
460+
def fixMatch(self, searchResult=None, auto=False):
461461
""" Use match result to update show metadata. """
462462
key = '/library/metadata/%s/match' % self.ratingKey
463+
if not auto:
464+
if not searchResult:
465+
raise NotFound('fixMatch() requires either auto=True or '
466+
'searchResult=:class:`~plexapi.media.SearchResult.')
467+
else:
468+
searchResult = self.matches()[0]
469+
463470
params = {'guid': searchResult.guid,
464471
'name': searchResult.name}
465472

0 commit comments

Comments
 (0)