Changed the filter cutoff to be based on, if the show/movie has popularity over 2, vote_count over 20 and has a defined release_date/first_air_date. Also changed so that it now uses the new convertTmdbToSeaonsed insted of the old (convertTmdbToMovie)

This commit is contained in:
2017-09-02 20:49:09 +02:00
parent 3bf646483d
commit 101dc7d570

View File

@@ -1,5 +1,5 @@
const moviedb = require('moviedb');
const convertTmdbToMovie = require('src/tmdb/convertTmdbToMovie');
const convertTmdbToSeasoned = require('src/tmdb/convertTmdbToSeasoned');
var methodTypes = { 'movie': 'searchMovie', 'tv': 'searchTv', 'multi': 'searchMulti', 'movieInfo': 'movieInfo',
'tvInfo': 'tvInfo' };
@@ -16,8 +16,8 @@ class TMDB {
.then((reponse) => {
try {
return reponse.results.filter(function(item) {
return (item.popularity >= 1.15)
}).map(convertTmdbToMovie);
return ((item.vote_count >= 20 || item.popularity > 2) && (item.release_date !== undefined || item.first_air_date !== undefined))
}).map(convertTmdbToSeasoned);
} catch (parseError) {
throw new Error('Could not parse result.');
}
@@ -39,7 +39,7 @@ class TMDB {
.catch(() => { throw new Error('Could not find a movie with that id.'); })
.then((response) => {
try {
return convertTmdbToMovie(response);
return convertTmdbToSeasoned(response);
} catch (parseError) {
throw new Error('Could not parse movie.');
}