Rewrote every function for searching and looking up items from tmdb library. Now there are separate functions for the four categories of search and three for info (multi, movie, show & person). Each function now has its own endpoint and matching controller. Converting tmdb results into a class has been alterted from using three classes; movie, show & person, and each have each their own convertTmdbTo function. Now the structure of the three types are more structured and no longer a single "seasoned" class object.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
const configuration = require('src/config/configuration').getInstance();
|
||||
const Cache = require('src/tmdb/cache');
|
||||
const TMDB = require('src/tmdb/tmdb');
|
||||
const Plex = require('src/plex/plex');
|
||||
const cache = new Cache();
|
||||
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
|
||||
const plex = new Plex(configuration.get('plex', 'ip'));
|
||||
|
||||
/**
|
||||
* Controller: Retrieve information for a movie
|
||||
@@ -10,10 +12,10 @@ const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
|
||||
* @param {Response} res
|
||||
* @returns {Callback}
|
||||
*/
|
||||
|
||||
function movieInfoController(req, res) {
|
||||
const movieId = req.params.id;
|
||||
tmdb.movieInfo(movieId)
|
||||
.then((movie) => plex.existsInPlex(movie))
|
||||
.then((movie) => {
|
||||
res.send(movie);
|
||||
}).catch((error) => {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
const configuration = require('src/config/configuration').getInstance();
|
||||
const Cache = require('src/tmdb/cache');
|
||||
const TMDB = require('src/tmdb/tmdb');
|
||||
const Plex = require('src/plex/plex');
|
||||
const cache = new Cache();
|
||||
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
|
||||
const plex = new Plex(configuration.get('plex', 'ip'));
|
||||
|
||||
/**
|
||||
* Controller: Retrieve information for a show
|
||||
@@ -14,6 +16,7 @@ const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
|
||||
function showInfoController(req, res) {
|
||||
const showId = req.params.id;
|
||||
tmdb.showInfo(showId)
|
||||
.then((show) => plex.existsInPlex(show))
|
||||
.then((show) => {
|
||||
res.send(show);
|
||||
}).catch((error) => {
|
||||
|
||||
Reference in New Issue
Block a user