adjusted to the variable 'pass' for nextClip and staySame cases in get_videos
This commit is contained in:
parent
4c2cb60d9c
commit
21781747a2
1 changed files with 23 additions and 7 deletions
|
@ -147,24 +147,40 @@ class Engine:
|
|||
stay_same_index = video_indx[nc+np:]
|
||||
|
||||
rec_list = []
|
||||
# select next clip for nextClip pool except when the playlist has only one clip.
|
||||
|
||||
# Make sure the playlist exists for staySame pool; otherwise add it to nextPlaylist pool.
|
||||
for i in stay_same_index:
|
||||
if prev_grid_list[i].get("playlist") not in [playlist["name"] for playlist in playlists]:
|
||||
next_playlist_index.append(stay_same_index)
|
||||
|
||||
# select next clip for nextClip pool except when the playlist has only one clip. It skips the clip with "pass":True when selecting the next clip.
|
||||
for i in next_clip_index:
|
||||
if prev_grid_list[i].get('playlist') is None:
|
||||
# add this to deal with the absence of "playlist" data in old grid event.
|
||||
# If there's no playlist data recorded, add the nextClip pool to nextPlaylist pool.
|
||||
if prev_grid_list[i].get("playlist") not in [playlist["name"] for playlist in playlists]:
|
||||
# add this to deal with the absence of "playlist" data in old grid event or the case where the playlist has been eliminated.
|
||||
next_playlist_index.append(next_clip_index)
|
||||
break
|
||||
else:
|
||||
for playlist in playlists:
|
||||
if playlist.get('name')== prev_grid_list[i].get('playlist'):
|
||||
unwatched_clips_indx = [j for j in range(len(playlist["clips"])) if playlist["clips"][j].get("pass",False)!=True]
|
||||
if len(playlist["clips"]) == 1:
|
||||
next_playlist_index.append(i)
|
||||
break
|
||||
# Discuss how this behavour should be: should it switch to a new playlist if it is the end of the playlist clip sequence already?
|
||||
elif prev_grid_list[i].get('playlistPosition', 0) + 1 == len(playlist['clips']):
|
||||
playlist_pos = 0
|
||||
if unwatched_clips_indx[0] != prev_grid_list[i]['playlistPosition']:
|
||||
playlist_pos = unwatched_clips_indx[0]
|
||||
else:
|
||||
playlist_pos = prev_grid_list[i].get('playlistPosition', 0) + 1
|
||||
next_playlist_index.append(i)
|
||||
else:
|
||||
if len([j for j in unwatched_clips_indx if j > prev_grid_list[i]['playlistPosition']]) == 0:
|
||||
if unwatched_clips_indx[0] != prev_grid_list[i]['playlistPosition']:
|
||||
playlist_pos = unwatched_clips_indx[0]
|
||||
else:
|
||||
next_playlist_index.append(i)
|
||||
else:
|
||||
playlist_pos = [j for j in unwatched_clips_indx if j > prev_grid_list[i]['playlistPosition']][0]
|
||||
|
||||
|
||||
rec_list.append((i, {
|
||||
'clips': playlist['clips'],
|
||||
|
|
Loading…
Reference in a new issue