return position
This commit is contained in:
parent
3602dde95b
commit
994ed75e72
1 changed files with 2 additions and 5 deletions
|
@ -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]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue