Merge pull request #31 from KevinMidboe/fix/seasonedApiSearch
Fix/seasoned api search
This commit is contained in:
@@ -2,7 +2,10 @@ const Movie = require('src/media_classes/movie');
|
|||||||
const Show = require('src/media_classes/show');
|
const Show = require('src/media_classes/show');
|
||||||
|
|
||||||
function convertTmdbToSeasoned(tmdbObject, strictType=undefined) {
|
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
|
// There are many diff types of content, we only want to look at movies and tv shows
|
||||||
if (mediaType === 'movie') {
|
if (mediaType === 'movie') {
|
||||||
@@ -48,3 +51,4 @@ function convertTmdbToSeasoned(tmdbObject, strictType=undefined) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = convertTmdbToSeasoned;
|
module.exports = convertTmdbToSeasoned;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ class TMDB {
|
|||||||
|
|
||||||
// Here we convert the filtered result from the tmdb api to seaonsed objects
|
// Here we convert the filtered result from the tmdb api to seaonsed objects
|
||||||
let seasonedItems = filteredTmdbItems.map((tmdbItem) => {
|
let seasonedItems = filteredTmdbItems.map((tmdbItem) => {
|
||||||
|
if (type === 'movie')
|
||||||
|
return convertTmdbToSeasoned(tmdbItem, 'movie');
|
||||||
|
else if (type === 'show')
|
||||||
|
return convertTmdbToSeaosned(tmdbItem, 'show');
|
||||||
|
else
|
||||||
return convertTmdbToSeasoned(tmdbItem);
|
return convertTmdbToSeasoned(tmdbItem);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user