Skip to content

Commit 222fe04

Browse files
committed
Add method to get media item using a guid
1 parent 842ec8a commit 222fe04

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

plexapi/library.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,17 @@ def get(self, title):
460460
key = '/library/sections/%s/all?includeGuids=1&title=%s' % (self.key, quote(title, safe=''))
461461
return self.fetchItem(key, title__iexact=title)
462462

463+
def getGuid(self, guid):
464+
""" Returns the media item with the specified external IMDB, TMDB, or TVDB ID.
465+
Note: This search uses a PlexAPI operator so performance may be slow.
466+
467+
Parameters:
468+
guid (str): The external guid of the item to return.
469+
Examples: IMDB ``imdb://tt0944947``, TMDB ``tmdb://1399``, TVDB ``tvdb://121361``.
470+
"""
471+
key = '/library/sections/%s/all?includeGuids=1' % self.key
472+
return self.fetchItem(key, Guid__id__iexact=guid)
473+
463474
def all(self, libtype=None, **kwargs):
464475
""" Returns a list of all items from this library section.
465476
See description of :func:`~plexapi.library.LibrarySection.search()` for details about filtering / sorting.

0 commit comments

Comments
 (0)