File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -465,14 +465,32 @@ def get(self, title):
465465
466466 def getGuid (self , guid ):
467467 """ Returns the media item with the specified external IMDB, TMDB, or TVDB ID.
468- Note: This search uses a PlexAPI operator so performance may be slow.
468+ Note: This search uses a PlexAPI operator so performance may be slow. All items from the
469+ entire Plex library need to be retrieved for each guid search. It is recommended to create
470+ your own lookup dictionary if you are searching for a lot of external guids.
469471
470472 Parameters:
471473 guid (str): The external guid of the item to return.
472474 Examples: IMDB ``imdb://tt0944947``, TMDB ``tmdb://1399``, TVDB ``tvdb://121361``.
473475
474476 Raises:
475477 :exc:`~plexapi.exceptions.NotFound`: The guid is not found in the library.
478+
479+ Example:
480+
481+ .. code-block:: python
482+
483+ # This will retrieve all items in the entire library 3 times
484+ result1 = library.getGuid('imdb://tt0944947')
485+ result2 = library.getGuid('tmdb://1399')
486+ result3 = library.getGuid('tvdb://121361')
487+
488+ # This will only retrieve all items in the library once to create a lookup dictionary
489+ guidLookup = {guid.id: item for item in library.all() for guid in item.guids}
490+ result1 = guidLookup['imdb://tt0944947']
491+ result2 = guidLookup['tmdb://1399']
492+ result3 = guidLookup['tvdb://121361']
493+
476494 """
477495 key = '/library/sections/%s/all?includeGuids=1' % self .key
478496 return self .fetchItem (key , Guid__id__iexact = guid )
You can’t perform that action at this time.
0 commit comments