diff --git a/src/plex/requestRepository.js b/src/plex/requestRepository.js index 0cc27dd..a4f1872 100644 --- a/src/plex/requestRepository.js +++ b/src/plex/requestRepository.js @@ -8,6 +8,8 @@ const tmdb = new TMDB(configuration.get('tmdb', 'apiKey')); var Promise = require('bluebird'); var rp = require('request-promise'); +var pythonShell = require('python-shell'); + class RequestRepository { searchRequest(query, page, type) { @@ -55,6 +57,30 @@ class RequestRepository { }); } + sendRequest(identifier) { + // TODO try a cache hit on the movie item + + console.log(identifier) + tmdb.lookup(identifier).then(movie => { + console.log(movie.title) + + var options = { + args: [movie.title, movie.year, movie.poster] + } + + pythonShell.run('sendRequest.py', options, function (err, results) { + if (err) throw err; + // TODO Add error handling!! RequestRepository.ERROR + // results is an array consisting of messages collected during execution + + console.log('results: %j', results) + }) + return true; + }) + + + } + } module.exports = RequestRepository; \ No newline at end of file