add unmatch, matches, and fixMatches methods for shows

matches will need additional work for manual matches
This commit is contained in:
blacktwin 2020-03-04 16:22:49 -05:00
parent 4c9aef21c7
commit 39bb93f35b

View file

@ -434,6 +434,30 @@ class Show(Video):
""" Returns list of unwatched :class:`~plexapi.video.Episode` objects. """ """ Returns list of unwatched :class:`~plexapi.video.Episode` objects. """
return self.episodes(viewCount=0) return self.episodes(viewCount=0)
def unmatch(self):
""" Unmatches show object. """
key = '/library/metadata/%s/unmatch' % self.ratingKey
self._server.query(key, method=self._server._session.put)
def matches(self):
""" Return list of show metadata matches from library agent. """
results = []
key = '/library/metadata/%s/matches' % self.ratingKey
data = self._server.query(key, method=self._server._session.get)
for elem in data:
results.append(media.SearchResult(data=elem, server=self._server))
return results
def fixMatch(self, searchResult):
""" Use match result to update show metadata. """
key = '/library/metadata/%s/match' % self.ratingKey
params = {'guid': searchResult.guid,
'name': searchResult.name}
data = key + '?' + urlencode(params)
self._server.query(data, method=self._server._session.put)
def get(self, title=None, season=None, episode=None): def get(self, title=None, season=None, episode=None):
""" Alias to :func:`~plexapi.video.Show.episode()`. """ """ Alias to :func:`~plexapi.video.Show.episode()`. """
return self.episode(title, season, episode) return self.episode(title, season, episode)