Now a plex ip address is dynamically passed into the plexrepository, fetched from the config
This commit is contained in:
@@ -3,6 +3,10 @@ const convertPlexToStream = require('src/plex/convertPlexToStream');
|
|||||||
const rp = require('request-promise');
|
const rp = require('request-promise');
|
||||||
|
|
||||||
class PlexRepository {
|
class PlexRepository {
|
||||||
|
constructor(plexIP) {
|
||||||
|
this.plexIP = plexIP;
|
||||||
|
}
|
||||||
|
|
||||||
inPlex(tmdbResult) {
|
inPlex(tmdbResult) {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() => this.search(tmdbResult.title))
|
.then(() => this.search(tmdbResult.title))
|
||||||
@@ -17,7 +21,7 @@ class PlexRepository {
|
|||||||
search(query) {
|
search(query) {
|
||||||
console.log('searching:', query)
|
console.log('searching:', query)
|
||||||
const options = {
|
const options = {
|
||||||
uri: `http://10.0.0.44:32400/search?query=${query}`,
|
uri: `http://${plexIP}:32400/search?query=${query}`,
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
},
|
},
|
||||||
@@ -65,7 +69,7 @@ class PlexRepository {
|
|||||||
|
|
||||||
nowPlaying() {
|
nowPlaying() {
|
||||||
const options = {
|
const options = {
|
||||||
uri: 'http://10.0.0.44:32400/status/sessions',
|
uri: `http://${plexIP}:32400/status/sessions`,
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const configuration = require('src/config/configuration').getInstance();
|
|||||||
const TMDB = require('src/tmdb/tmdb');
|
const TMDB = require('src/tmdb/tmdb');
|
||||||
const establishedDatabase = require('src/database/database');
|
const establishedDatabase = require('src/database/database');
|
||||||
|
|
||||||
const plexRepository = new PlexRepository();
|
const plexRepository = new PlexRepository(configuration.get('plex', 'ip'));
|
||||||
const cache = new Cache();
|
const cache = new Cache();
|
||||||
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
|
const tmdb = new TMDB(cache, configuration.get('tmdb', 'apiKey'));
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const PlexRepository = require('src/plex/plexRepository');
|
const PlexRepository = require('src/plex/plexRepository');
|
||||||
|
const configuration = require('src/config/configuration').getInstance();
|
||||||
|
|
||||||
const plexRepository = new PlexRepository();
|
const plexRepository = new PlexRepository(onfiguration.get('plex', 'ip'));
|
||||||
|
|
||||||
function playingController(req, res) {
|
function playingController(req, res) {
|
||||||
plexRepository.nowPlaying()
|
plexRepository.nowPlaying()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const PlexRepository = require('src/plex/plexRepository');
|
const PlexRepository = require('src/plex/plexRepository');
|
||||||
|
const configuration = require('src/config/configuration').getInstance();
|
||||||
|
|
||||||
const plexRepository = new PlexRepository();
|
const plexRepository = new PlexRepository(onfiguration.get('plex', 'ip'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller: Search for media and check existence
|
* Controller: Search for media and check existence
|
||||||
|
|||||||
Reference in New Issue
Block a user