shuffle recommendations, for more variety

This commit is contained in:
Ronald Schaten 2021-03-19 15:10:37 +01:00
parent 646b62a149
commit 4ac68a6db6

View File

@ -73,7 +73,8 @@ class Tmdb:
# get a number of trailers of a certain kind for a list of recommended movies # get a number of trailers of a certain kind for a list of recommended movies
def get_trailers(self, recommendations, cliptype, count): def get_trailers(self, recommendations, cliptype, count):
results = [] results = []
# loop over list of recommendations # loop over ten out of the list of recommendations
random.shuffle(recommendations)
for recommendation in recommendations[:10]: for recommendation in recommendations[:10]:
all_trailers = self.get_movie_trailers(recommendation['movieid']) all_trailers = self.get_movie_trailers(recommendation['movieid'])
# filter to get only a certain kind of trailer # filter to get only a certain kind of trailer