Skip to content

Commit

Permalink
Add method to search for movies similar to current.
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnerrp committed May 3, 2012
1 parent 676cbb1 commit 30a0d39
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README
Expand Up @@ -170,7 +170,7 @@ trailers offer multiple sizes.

## List of Available Data

type name
type name

Collection:
integer id
Expand Down Expand Up @@ -210,6 +210,7 @@ Movie:
list(Keyword) keywords
dict(Release) releases (indexed by country)
list(Translation) translations
list(Movie) getSimilar()

Movie classmethods
Movie fromIMDB(imdbid) special constructor for use with IMDb codes
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -4,7 +4,7 @@

setup(
name='tmdb3',
version='0.6.1',
version='0.6.2',
description='TheMovieDB.org APIv3 interface',
long_description="Object-oriented interface to TheMovieDB.org's v3 API.",
packages=['tmdb3']
Expand Down
10 changes: 9 additions & 1 deletion tmdb3/tmdb_api.py
Expand Up @@ -22,7 +22,7 @@
Preliminary API specifications can be found at
http://help.themoviedb.org/kb/api/about-3"""

__version__="v0.6.1"
__version__="v0.6.2"
# 0.1.0 Initial development
# 0.2.0 Add caching mechanism for API queries
# 0.2.1 Temporary work around for broken search paging
Expand All @@ -44,6 +44,7 @@
# 0.5.0 Rework cache framework and improve file cache performance
# 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

from request import set_key, Request
from util import Datapoint, Datalist, Datadict, Element, NameRepr, SearchRepr
Expand Down Expand Up @@ -460,6 +461,13 @@ def setRating(self, value):
req.add_data({'value':value})
req.readJSON()

def getSimilar(self):
res = MovieSearchResult(Request('movie/{0}/similar_movies'\
.format(self.id)),
locale=self._locale)
res._name = 'Similar to {0}'.format(self._printable_name())
return res

def _printable_name(self):
if self.title is not None:
s = u"'{0}'".format(self.title)
Expand Down

0 comments on commit 30a0d39

Please sign in to comment.