diff --git a/README b/README index 7a4ee2d3e72..b21837fbce7 100644 --- a/README +++ b/README @@ -80,9 +80,10 @@ This is not yet supported. ## Searching There are currently three search methods available for use: movies, people, -studios, and lists. Search results from TheMovieDb are sent iteratively, -twenty results per page. The search methods provided by the PyTMDB3 module -return list-like structures that will automatically grab new pages as needed. +studios, lists, and collections. Search results from TheMovieDb are sent +iteratively, twenty results per page. The search methods provided by the +PyTMDB3 module return list-like structures that will automatically grab new +pages as needed. >>> from tmdb3 import searchMovie >>> res = searchMovie('A New Hope') diff --git a/setup.py b/setup.py index 5646e704fa3..4181136889c 100755 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='tmdb3', - version='0.6.14', + version='0.6.15', description='TheMovieDB.org APIv3 interface', long_description="Object-oriented interface to TheMovieDB.org's v3 API.", packages=['tmdb3'] diff --git a/tmdb3/__init__.py b/tmdb3/__init__.py index b7043eba5f7..92ca5510403 100644 --- a/tmdb3/__init__.py +++ b/tmdb3/__init__.py @@ -1,8 +1,8 @@ #!/usr/bin/env python from tmdb_api import Configuration, searchMovie, searchMovieWithYear, \ - searchPerson, searchStudio, searchList, Person, \ - Movie, Collection, Genre, List, __version__ + searchPerson, searchStudio, searchList, searchCollection, \ + Person, Movie, Collection, Genre, List, __version__ from request import set_key, set_cache from locales import get_locale, set_locale from tmdb_auth import get_session, set_session diff --git a/tmdb3/tmdb_api.py b/tmdb3/tmdb_api.py index 5319b45ea48..1b4b15b07f8 100644 --- a/tmdb3/tmdb_api.py +++ b/tmdb3/tmdb_api.py @@ -22,7 +22,7 @@ Preliminary API specifications can be found at http://help.themoviedb.org/kb/api/about-3""" -__version__="v0.6.14" +__version__="v0.6.15" # 0.1.0 Initial development # 0.2.0 Add caching mechanism for API queries # 0.2.1 Temporary work around for broken search paging @@ -57,6 +57,7 @@ # 0.6.12 Add support for Movie watchlist query and editing # 0.6.13 Fix URL for rating Movies # 0.6.14 Add support for Lists +# 0.6.15 Add ability to search Collections from request import set_key, Request from util import Datapoint, Datalist, Datadict, Element, NameRepr, SearchRepr @@ -164,8 +165,8 @@ def __init__(self, request): super(StudioSearchResult, self).__init__(request, lambda x: Studio(raw=x)) -def searchList(query): - ListSearchResult(Request('search/list', query=query)) +def searchList(query, adult=False): + ListSearchResult(Request('search/list', query=query, include_adult=adult)) class ListSearchResult( SearchRepr, PagedRequest ): """Stores a list of search matches.""" @@ -174,6 +175,20 @@ def __init__(self, request): super(ListSearchResult, self).__init__(request, lambda x: List(raw=x)) +def searchCollection(query, locale=None): + return CollectionSearchResult(Request('search/collection', query=query), + locale=locale) + +class CollectionSearchResult( SearchRepr, PagedRequest ): + """Stores a list of search matches.""" + _name=None + def __init__(self, request, locale=None): + if locale is None: + locale = get_locale() + super(CollectionSearchResult, self).__init__( + request.new(language=locale.language), + lambda x: Collection(raw=x, locale=locale)) + class Image( Element ): filename = Datapoint('file_path', initarg=1, handler=lambda x: x.lstrip('/'))