Fixed issue with types not being upheld when converting from tmdb objects.

This commit is contained in:
2018-02-07 15:40:39 +01:00
parent 28a731efbf
commit ad4fa9d95a
2 changed files with 10 additions and 4 deletions

View File

@@ -9,10 +9,15 @@ function translateGenre(tmdbGenres) {
return tmdbGenres.map(genre => genre.name);
}
function convertType(tmdbType) {
if (tmdbType === 'tv') return 'show';
return undefined;
}
function convertTmdbToSeasoned(tmdb, manualType = undefined) {
const title = tmdb.title || tmdb.name;
const year = translateYear(tmdb.release_date || tmdb.first_air_date);
const type = tmdb.media_type || manualType;
const type = manualType || convertType(tmdb.media_type) || 'movie';
const id = tmdb.id;
const summary = tmdb.overview;