Skip to content

Commit

Permalink
Add method to search for an external guid
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyWong16 committed Sep 15, 2021
1 parent eced94f commit 7f70f9f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plexapi/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,17 @@ def search(self, title=None, sort=None, maxresults=None, libtype=None,
title=title, sort=sort, libtype=libtype, limit=limit, filters=filters, returnKwargs=True, **kwargs)
return self._search(key, maxresults, container_start, container_size, **kwargs)

def searchGuid(self, guid):
""" Search the library for an external IMDB, TMDB, or TVDB ID.
Note: This search uses a PlexAPI operator so performance may be slow.
See :func:`~plexapi.library.LibrarySection.search`.
Parameters:
guid (str): The external guid to search for.
Examples: IMDB ``imdb://tt0944947``, TMDB ``tmdb://1399``, TVDB ``tvdb://121361``.
"""
return self.search(guid__id__iexact=guid)

def _search(self, key, maxresults, container_start, container_size, **kwargs):
""" Perform the actual library search and return the results. """
results = []
Expand Down

0 comments on commit 7f70f9f

Please sign in to comment.