Trakt.tv Images
Extends https://github.com/vankasteelj/trakt.tv node module, in order to get images for a given episode/show/movie.
Image sources:
- fanart.tv
- tmdb (movies only)
- tvdb (series/episodes only)
- omdbapi
trakt.tv
module.
Install:
```bash npm install trakt.tv trakt.tv-images --save ```Load the plugin:
```js Trakt = require('trakt.tv'); trakt = new Trakt({client_id: <trakt client id>,
client_secret: <trakt client secret>,
plugins: {
images: require('trakt.tv-images')
},
options: {
images: {
fanartApiKey: <fanart api key>, // optional
tvdbApiKey: <tvdb api key>, // optional
tmdbApiKey: <tmdb api key>, // optional
smallerImages: true // reduce image size, save bandwidth. defaults to false.
cached: true // requires trakt.tv-cached
}
}
}, true);
```
Log in with trakt.tv, then call "images":
```js trakt.images.get({tmdb: <a tmdb id>, // optional, recommended
imdb: <an imdb id>, // starts with 'tt' prefix, recommended
tvdb: <a tvdb id>, // optional, recommended
type: 'movie' // can be 'movie', 'show' or 'episode', person
})
.then(console.log)
.catch(console.log);
```
Note: the object argument used can be a raw object from trakt api too, like {title:'something', ids:{imdb:'tt000'}}
Example response
```js Object {background: "http://assets.fanart.tv/fanart/tv/121361/showbackground/game-of-thrones-4fd5fa8ed5e1b.jpg"
poster: "http://thetvdb.com/banners/posters/121361-1.jpg"
}
```