Skip to content

rkstar/meteor-tmdb

Repository files navigation

TMDB

A wrapper for the TMDB (TheMovieDataBase.org) API (v3)

Package Dependencies

  • underscore
  • http
  • a valid API key from TMDB

Usage

  1. meteor add rkstar:tmdb
  2. Use inside Meteor.method() calls only! Future versions may allow you to make calls directly from the client, but this is server only for now.

This library uses the service-configuration package to store your api key. You can configure this api like this: in /server/lib/tmdb-configuration.js

ServiceConfiguration.configurations.update({
  service: 'tmdb'
},{$set: {
  apiKey: '<your-tmdb-api-key>'
}},{
  upsert: true
})

Methods (server)

let promise = TMDB.API.search(path, query)

  • path => eg. "person"
  • query => eg. "brad pitt"

let promise = TMDB.API.findById(id, external_source)

  • id => eg. nm0000093
  • external_source => eg. 'IMDB'

let promise = TMDB.API.person(id, searchFor) let promise = TMDB.API.movies(id, searchFor) let promise = TMDB.API.tv(id, searchFor)

  • id => a valid TMDB id
  • searchFor => can be any of the options under the various paths here, here, and here. if you pass popular or latest, pass null for id The searchFor path in /person/{id}/movie_credits would therefore be movie_credits

Methods (client)

You can access the TMDB API Configuration by using the var TMDB.Client.config.data You will be able to see the last time that data was reloaded via TMDB.Client.config.loaded and you can choose to force reload via the API when you instantiate with new TMDB.API({reload:true})

let imageSrc = TMDB.Client.imagePath(poster_path, size)

poster_path => eg. the "poster_path" property returned by the TMDB api for a person, movie, tv, or credit

size => eg. the index of the size of the image you want. TMDB api provides 4 different sizes, increasing with the index. indexes are 0-3

Reading

The Movie Database TMDB Apiary Documentation

About

A wrapper for the TMDB (TheMovieDataBase.org) API (v3)

Resources

Stars

Watchers

Forks

Packages

No packages published