Cleanup, removed comments and logs.
This commit is contained in:
@@ -139,7 +139,6 @@ class Plex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve, reject) => this.cache.get(cacheKey)
|
return new Promise((resolve, reject) => this.cache.get(cacheKey)
|
||||||
.then(resolve) // if found in cache resolve
|
|
||||||
.catch(() => fetch(url, options)) // else fetch fresh data
|
.catch(() => fetch(url, options)) // else fetch fresh data
|
||||||
.then(successfullResponse)
|
.then(successfullResponse)
|
||||||
.then(results => this.cache.set(cacheKey, results, 21600))
|
.then(results => this.cache.set(cacheKey, results, 21600))
|
||||||
@@ -157,7 +156,6 @@ class Plex {
|
|||||||
|
|
||||||
mapResults(response) {
|
mapResults(response) {
|
||||||
if (response == null || response.MediaContainer == null || response.MediaContainer.Hub == null) {
|
if (response == null || response.MediaContainer == null || response.MediaContainer.Hub == null) {
|
||||||
console.log('No results to map in:', response)
|
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +171,6 @@ class Plex {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.filter(result => result !== undefined)
|
.filter(result => result !== undefined)
|
||||||
// .flat()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ const RedisCache = require('src/cache/redis')
|
|||||||
const redisCache = new RedisCache()
|
const redisCache = new RedisCache()
|
||||||
|
|
||||||
const { Movie, Show, Person, Credits, ReleaseDates } = require('src/tmdb/types');
|
const { Movie, Show, Person, Credits, ReleaseDates } = require('src/tmdb/types');
|
||||||
// const { tmdbInfo } = require('src/tmdb/types')
|
|
||||||
|
|
||||||
const tmdbErrorResponse = (error, typeString=undefined) => {
|
const tmdbErrorResponse = (error, typeString=undefined) => {
|
||||||
if (error.status === 404) {
|
if (error.status === 404) {
|
||||||
@@ -225,8 +224,6 @@ class TMDB {
|
|||||||
* @returns {Promise} dict with tmdb results, mapped as movie/show objects.
|
* @returns {Promise} dict with tmdb results, mapped as movie/show objects.
|
||||||
*/
|
*/
|
||||||
mapResults(response, type=undefined) {
|
mapResults(response, type=undefined) {
|
||||||
// console.log(response.results)
|
|
||||||
// response.results.map(te => console.table(te))
|
|
||||||
|
|
||||||
let results = response.results.map(result => {
|
let results = response.results.map(result => {
|
||||||
if (type === 'movie' || result.media_type === 'movie') {
|
if (type === 'movie' || result.media_type === 'movie') {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import Movie from './types/movie.js'
|
const Movie = require('./types/movie.js')
|
||||||
import Show from './types/show.js'
|
const Show = require('./types/show.js')
|
||||||
import Person from './types/person.js'
|
const Person = require('./types/person.js')
|
||||||
import Credits from './types/credits.js'
|
const Credits = require('./types/credits.js')
|
||||||
import ReleaseDates from './types/releaseDates.js'
|
const ReleaseDates = require('./types/releaseDates.js')
|
||||||
|
|
||||||
module.exports = { Movie, Show, Person, Credits, ReleaseDates }
|
module.exports = { Movie, Show, Person, Credits, ReleaseDates }
|
||||||
|
|||||||
Reference in New Issue
Block a user