Skip to content

Commit

Permalink
add searchProviders parameter to searchDiscover method (#1437)
Browse files Browse the repository at this point in the history
* add searchProviders parameter to searchDiscover method

* fix trailing whitespace

* rename parameter
  • Loading branch information
mdinicola authored Jul 6, 2024
1 parent ec969a1 commit c7f4388
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plexapi/myplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,14 +1049,17 @@ def markUnplayed(self, item):
self.query(key, params=params)
return self

def searchDiscover(self, query, limit=30, libtype=None):
def searchDiscover(self, query, limit=30, libtype=None, providers='discover'):
""" Search for movies and TV shows in Discover.
Returns a list of :class:`~plexapi.video.Movie` and :class:`~plexapi.video.Show` objects.
Parameters:
query (str): Search query.
limit (int, optional): Limit to the specified number of results. Default 30.
libtype (str, optional): 'movie' or 'show' to only return movies or shows, otherwise return all items.
providers (str, optional): 'discover' for default behavior
or 'discover,PLEXAVOD' to also include the Plex ad-suported video service
or 'discover,PLEXAVOD,PLEXTVOD' to also include the Plex video rental service
"""
libtypes = {'movie': 'movies', 'show': 'tv'}
libtype = libtypes.get(libtype, 'movies,tv')
Expand All @@ -1068,6 +1071,7 @@ def searchDiscover(self, query, limit=30, libtype=None):
'query': query,
'limit': limit,
'searchTypes': libtype,
'searchProviders': providers,
'includeMetadata': 1
}

Expand Down

0 comments on commit c7f4388

Please sign in to comment.