return position

This commit is contained in:
j 2018-01-27 15:13:28 +01:00
parent 3602dde95b
commit 994ed75e72

View file

@ -46,10 +46,6 @@ class Engine:
clips[inpoint['index']]['out'] = self.pandora.get(video_id, ['duration'])['duration'] clips[inpoint['index']]['out'] = self.pandora.get(video_id, ['duration'])['duration']
return clips return clips
def _shift_clips(self, clips):
index = random.randrange(len(clips))
return clips[index:] + clips[:index - 1]
def get_videos(self, user): def get_videos(self, user):
channels = {'keywords': 7, 'screenings': 7, 'random': 2} channels = {'keywords': 7, 'screenings': 7, 'random': 2}
sliders = {'dau': -1, 'physics': 0, 'sex': 1} sliders = {'dau': -1, 'physics': 0, 'sex': 1}
@ -83,7 +79,8 @@ class Engine:
# Shuffle playlists (randomize layout) and shift clips (randomize start) # Shuffle playlists (randomize layout) and shift clips (randomize start)
random.shuffle(videos) random.shuffle(videos)
return [{ return [{
'clips': self._shift_clips(video['clips']), 'clips': video['clips'],
'position': random.randrange(len(video['clips'])),
'name': video['name'] 'name': video['name']
} for video in videos] } for video in videos]