Skip to content

Commit 4c9aef2

Browse files
committed
add unmatch, matches, and fixMatches methods for movies
matches will need additional work for manual matches
1 parent 95114c4 commit 4c9aef2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

plexapi/video.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,30 @@ def _prettyfilename(self):
260260
# This is just for compat.
261261
return self.title
262262

263+
def unmatch(self):
264+
""" Unmatches movie object"""
265+
key = '/library/metadata/%s/unmatch' % self.ratingKey
266+
return self._server.query(key, method=self._server._session.put)
267+
268+
def matches(self):
269+
""" Return list of movie metadata matches from library agent"""
270+
results = []
271+
key = '/library/metadata/%s/matches' % self.ratingKey
272+
data = self._server.query(key, method=self._server._session.get)
273+
274+
for elem in data:
275+
results.append(media.SearchResult(data=elem, server=self._server))
276+
return results
277+
278+
def fixMatch(self, searchResult):
279+
""" Use match result to update movie metadata. """
280+
key = '/library/metadata/%s/match' % self.ratingKey
281+
params = {'guid': searchResult.guid,
282+
'name': searchResult.name}
283+
284+
data = key + '?' + urlencode(params)
285+
self._server.query(data, method=self._server._session.put)
286+
263287
def download(self, savepath=None, keep_original_name=False, **kwargs):
264288
""" Download video files to specified directory.
265289

0 commit comments

Comments
 (0)