Permalink
Browse files

Add Studio search method.

  • Loading branch information...
1 parent 76c8c51 commit c2bb6aee239e1e53ba95da232ed84ee5da21685b @wagnerrp wagnerrp committed Jun 21, 2012
Showing with 26 additions and 7 deletions.
  1. +12 −4 README
  2. +1 −1 setup.py
  3. +2 −2 tmdb3/__init__.py
  4. +11 −0 tmdb3/tmdb_api.py
View
16 README
@@ -79,10 +79,10 @@ This is not yet supported.
## Searching
-There are currently two search methods available for use: movies and people.
-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.
+There are currently three search methods available for use: movies, people,
+and studios. 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')
@@ -104,6 +104,14 @@ out. The people search method behaves similarly.
>>> res[0]
<Person 'Tom Hanks'>
+ >>> from tmdb import searchStudio
+ >>> res = searchStudio('Sony Pictures')
+ >>> res
+ <Search Results: Sony Pictures>
+ >>> res[0]
+ <Studio 'Sony Pictures'>
+
+
## Direct Queries
There are currently four data types that support direct access: collections,
View
@@ -4,7 +4,7 @@
setup(
name='tmdb3',
- version='0.6.2',
+ version='0.6.3',
description='TheMovieDB.org APIv3 interface',
long_description="Object-oriented interface to TheMovieDB.org's v3 API.",
packages=['tmdb3']
View
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-from tmdb_api import Configuration, searchMovie, searchPerson, Person, \
- Movie, Collection, __version__
+from tmdb_api import Configuration, searchMovie, searchPerson, searchStudio, \
+ Studio, Person, Movie, Collection, __version__
from request import set_key, set_cache
from locales import get_locale, set_locale
from tmdb_auth import get_session, set_session
View
@@ -45,6 +45,7 @@
# 0.6.0 Add user authentication support
# 0.6.1 Add adult filtering for people searches
# 0.6.2 Add similar movie search for Movie objects
+# 0.6.3 Add Studio search
from request import set_key, Request
from util import Datapoint, Datalist, Datadict, Element, NameRepr, SearchRepr
@@ -110,6 +111,16 @@ def __init__(self, request):
super(PeopleSearchResult, self).__init__(request,
lambda x: Person(raw=x))
+def searchStudio(query):
+ return StudioSearchResult(Request('search/company', query=query))
+
+class StudioSearchResult( SearchRepr, PagedRequest ):
+ """Stores a list of search matches."""
+ _name = None
+ def __init__(self, request):
+ super(StudioSearchResult, self).__init__(request,
+ lambda x: Studio(raw=x))
+
class Image( Element ):
filename = Datapoint('file_path', initarg=1,
handler=lambda x: x.lstrip('/'))

0 comments on commit c2bb6ae

Please sign in to comment.