Browse files

Added similar movies function

  • Loading branch information...
1 parent 292a708 commit cda60c07449bcddd174d44535c1ca4334f2afe4f @raqqa committed May 7, 2012
Showing with 12 additions and 1 deletion.
  1. +1 −1 README.md
  2. +11 −0 lib/tmdb.js
View
2 README.md
@@ -28,7 +28,7 @@ tmdb.person.info(109, function(err,res) {
```
etc.
-All methods live right now (2012-04-15) implemented.
+All methods live right now (2012-05-08) implemented.
Testing is done by mocha.
View
11 lib/tmdb.js
@@ -30,6 +30,7 @@ var tmdb = function(api_key) {
movie_releases: this.base+'/movie/{0}/releases?api_key='+this.api_key,
movie_trailers: this.base+'/movie/{0}/trailers?api_key='+this.api_key,
movie_translations: this.base+'/movie/{0}/translations?api_key='+this.api_key,
+ movie_similar: this.base+'/movie/{0}/similar_movies?page={1}&api_key='+this.api_key,
person_info: this.base+'/person/{0}?api_key='+this.api_key,
person_credits: this.base+'/person/{0}/credits?api_key='+this.api_key,
person_images: this.base+'/person/{0}/images?api_key='+this.api_key,
@@ -150,6 +151,16 @@ tmdb.prototype.movie = {
var url = me.api_urls.movie_translations.format(q);
executeQuery({url:url}, callback);
},
+ similar: function(q, p, callback) {
+ if(arguments.length === 2) {
+ callback = p;
+ p = 1;
+ } else {
+ if (typeof p !== 'number') { p = 1; }
+ }
+ var url = me.api_urls.movie_similar.format(q,p);
+ executeQuery({url:url}, callback);
+ }
};
/**

0 comments on commit cda60c0

Please sign in to comment.