From 101dc7d5706ab3ae5b808996b3a04a242e1af7f2 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Sat, 2 Sep 2017 20:49:09 +0200 Subject: [PATCH] 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) --- seasoned_api/src/tmdb/tmdb.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/seasoned_api/src/tmdb/tmdb.js b/seasoned_api/src/tmdb/tmdb.js index e3473b8..6d9f18f 100644 --- a/seasoned_api/src/tmdb/tmdb.js +++ b/seasoned_api/src/tmdb/tmdb.js @@ -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.'); }