From 994ed75e72684aae12b10d7ab45273c8f493e319 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 27 Jan 2018 15:13:28 +0100 Subject: [PATCH] return position --- recommendation_engine.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/recommendation_engine.py b/recommendation_engine.py index a8d9542..90ab662 100644 --- a/recommendation_engine.py +++ b/recommendation_engine.py @@ -46,10 +46,6 @@ class Engine: clips[inpoint['index']]['out'] = self.pandora.get(video_id, ['duration'])['duration'] return clips - def _shift_clips(self, clips): - index = random.randrange(len(clips)) - return clips[index:] + clips[:index - 1] - def get_videos(self, user): channels = {'keywords': 7, 'screenings': 7, 'random': 2} sliders = {'dau': -1, 'physics': 0, 'sex': 1} @@ -83,7 +79,8 @@ class Engine: # Shuffle playlists (randomize layout) and shift clips (randomize start) random.shuffle(videos) return [{ - 'clips': self._shift_clips(video['clips']), + 'clips': video['clips'], + 'position': random.randrange(len(video['clips'])), 'name': video['name'] } for video in videos]