Converts all the info you get per media item from tmdb to the universal movie class

This commit is contained in:
2017-04-20 22:30:20 +02:00
parent ddda6a3003
commit 3a3799340a

View File

@@ -0,0 +1,16 @@
const Movie = require('src/movie/movie');
function convertTmdbToMovie(tmdbMovie) {
const movie = new Movie();
movie.title = tmdbMovie.title;
movie.type = 'movie';
if (tmdbMovie.release_date !== undefined) {
movie.release_date = new Date(tmdbMovie.release_date);
movie.year = movie.release_date.getFullYear();
}
return movie;
}
module.exports = convertTmdbToMovie;