removing unmatch/match methods from video:Movie and video:Show classes

matching can be done for artists, albums, shows, movies
This commit is contained in:
blacktwin 2020-03-13 22:20:26 -04:00
parent 1f743684c5
commit c2c13fbfe2

View file

@ -260,49 +260,6 @@ class Movie(Playable, Video):
# This is just for compat.
return self.title
def unmatch(self):
""" Unmatches movie object. """
key = '/library/metadata/%s/unmatch' % self.ratingKey
return self._server.query(key, method=self._server._session.put)
def matches(self, auto=True, agent=None, title=None, year=None, lang=None):
""" Return list of movie metadata matches from library agent. """
key = '/library/metadata/%s/matches' % self.ratingKey
if not auto:
key += '?manual=%s' % 1
if title:
key += '&title=%s' % quote(title)
if agent:
agents = {ag.shortIdentifier: ag for ag in self._server.agents()}
if agents.get(agent):
agent = agents.get(agent)
key += '&agent=%s' % agent.identifier
else:
raise NotFound('Couldnt find "%s" in agents list (%s)' %
(agent, ','.join(agents.keys())))
else:
sectionAgent = self.section().agent
key += '&agent=%s' % sectionAgent
if year:
key += '&year=%s' % year
if lang:
key += '&language=%s' % lang
else:
sectionLang = self.section().language
key += '&language=%s' % sectionLang
data = self._server.query(key, method=self._server._session.get)
return self.findItems(data)
def fixMatch(self, searchResult):
""" Use match result to update movie 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 download(self, savepath=None, keep_original_name=False, **kwargs):
""" Download video files to specified directory.
@ -453,49 +410,6 @@ 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, auto=True, agent=None, title=None, year=None, lang=None):
""" Return list of show metadata matches from library agent. """
key = '/library/metadata/%s/matches' % self.ratingKey
if not auto:
key += '?manual=%s' % 1
if title:
key += '&title=%s' % quote(title)
if agent:
agents = {ag.shortIdentifier: ag for ag in self._server.agents()}
if agents.get(agent):
agent = agents.get(agent)
key += '&agent=%s' % agent.identifier
else:
raise NotFound('Couldnt find "%s" in agents list (%s)' %
(agent, ','.join(agents.keys())))
else:
sectionAgent = self.section().agent
key += '&agent=%s' % sectionAgent
if year:
key += '&year=%s' % year
if lang:
key += '&language=%s' % lang
else:
sectionLang = self.section().language
key += '&language=%s' % sectionLang
data = self._server.query(key, method=self._server._session.get)
return self.findItems(data)
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)