Merge pull request #31 from KevinMidboe/fix/seasonedApiSearch

Fix/seasoned api search
This commit is contained in:
2017-09-21 16:39:00 +02:00
committed by GitHub
2 changed files with 13 additions and 4 deletions

View File

@@ -2,7 +2,10 @@ const Movie = require('src/media_classes/movie');
const Show = require('src/media_classes/show');
function convertTmdbToSeasoned(tmdbObject, strictType=undefined) {
const mediaType = strictType || tmdbObject.media_type;
if (strictType === undefined)
var mediaType = tmdbObject.media_type;
else
var mediaType = strictType;
// There are many diff types of content, we only want to look at movies and tv shows
if (mediaType === 'movie') {
@@ -48,3 +51,4 @@ function convertTmdbToSeasoned(tmdbObject, strictType=undefined) {
}
module.exports = convertTmdbToSeasoned;

View File

@@ -31,6 +31,11 @@ class TMDB {
// Here we convert the filtered result from the tmdb api to seaonsed objects
let seasonedItems = filteredTmdbItems.map((tmdbItem) => {
if (type === 'movie')
return convertTmdbToSeasoned(tmdbItem, 'movie');
else if (type === 'show')
return convertTmdbToSeaosned(tmdbItem, 'show');
else
return convertTmdbToSeasoned(tmdbItem);
});