From 8014f01766d0b50eba1dd00df66a3ed6867d5ad9 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Wed, 27 Sep 2017 00:28:41 +0200 Subject: [PATCH] Added stricter handling for selecting what mediaType to convert to when searching tmdb and converting to seasoned object. --- seasoned_api/src/tmdb/convertTmdbToSeasoned.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/seasoned_api/src/tmdb/convertTmdbToSeasoned.js b/seasoned_api/src/tmdb/convertTmdbToSeasoned.js index 7379610..739e2d0 100644 --- a/seasoned_api/src/tmdb/convertTmdbToSeasoned.js +++ b/seasoned_api/src/tmdb/convertTmdbToSeasoned.js @@ -2,7 +2,13 @@ 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; + // TODO create a default fallback class to set the when falls to else as both are undefined + if (tmdbObject.media_type !== undefined) + var mediaType = tmdbObject.media_type; + else if (strictType !== undefined) + var mediaType = strictType; + else + var mediaType = 'movie'; // There are many diff types of content, we only want to look at movies and tv shows if (mediaType === 'movie') {