Added popularity and vote_count to movie and show object and added a new check for name and title of movie

This commit is contained in:
2017-09-02 22:51:49 +02:00
parent 17dd66e9ac
commit 84a897da6e
2 changed files with 14 additions and 3 deletions

View File

@@ -28,7 +28,7 @@ class RequestRepository {
return Promise.each(plexMedia, function(plexMovie) {
if (tmdbMovie.title == plexMovie.title && tmdbMovie.year == plexMovie.year) {
tmdbMovie.matchedInPlex = true;
console.log(tmdbMovie.title + ' : ' + tmdbMovie.year);
// console.log('Matched: ' + tmdbMovie.title + ' : ' + tmdbMovie.year);
}
return tmdbMovie;
})
@@ -41,7 +41,6 @@ class RequestRepository {
})
})
.catch((error) => {
console.log(error);
return error;
});
}

View File

@@ -10,7 +10,13 @@ function convertTmdbToSeasoned(tmdbObject) {
if (mediaType === 'movie') {
const year = new Date(tmdbObject.release_date).getFullYear();
const movie = new Movie(tmdbObject.title, year, mediaType);
if (tmdbObject.title !== undefined) {
var title = tmdbObject.title;
} else if (tmdbObject.name !== undefined) {
var title = tmdbObject.name;
}
const movie = new Movie(title, year, mediaType);
movie.summary = tmdbObject.overview;
movie.rating = tmdbObject.vote_average;
@@ -18,6 +24,9 @@ function convertTmdbToSeasoned(tmdbObject) {
movie.background = tmdbObject.backdrop_path;
movie.genre = tmdbObject.genre_ids;
movie.popularity = tmdbObject.popularity;
movie.vote_count = tmdbObject.vote_count;
return movie;
}
else if (mediaType === 'tv') {
@@ -31,6 +40,9 @@ function convertTmdbToSeasoned(tmdbObject) {
show.background = tmdbObject.backdrop_path;
show.genre = tmdbObject.genre_ids;
show.popularity = tmdbObject.popularity;
show.vote_count = tmdbObject.vote_count;
return show;
}
}