From 4ac68a6db6a43e033f1b6b5c233493c806be4064 Mon Sep 17 00:00:00 2001 From: Ronald Schaten Date: Fri, 19 Mar 2021 15:10:37 +0100 Subject: [PATCH] shuffle recommendations, for more variety --- tmdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmdb.py b/tmdb.py index 39686f2..e6bb9f8 100644 --- a/tmdb.py +++ b/tmdb.py @@ -73,7 +73,8 @@ class Tmdb: # get a number of trailers of a certain kind for a list of recommended movies def get_trailers(self, recommendations, cliptype, count): results = [] - # loop over list of recommendations + # loop over ten out of the list of recommendations + random.shuffle(recommendations) for recommendation in recommendations[:10]: all_trailers = self.get_movie_trailers(recommendation['movieid']) # filter to get only a certain kind of trailer