mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-26 13:40:22 +00:00
add unmatch, matches, and fixMatches methods for shows
matches will need additional work for manual matches
This commit is contained in:
parent
4c9aef21c7
commit
39bb93f35b
1 changed files with 24 additions and 0 deletions
|
@ -434,6 +434,30 @@ class Show(Video):
|
|||
""" Returns list of unwatched :class:`~plexapi.video.Episode` objects. """
|
||||
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):
|
||||
""" Alias to :func:`~plexapi.video.Show.episode()`. """
|
||||
return self.episode(title, season, episode)
|
||||
|
|
Loading…
Reference in a new issue