return user keywords

This commit is contained in:
j 2018-09-21 22:09:45 +02:00
parent a590c0ea2a
commit 0fe5752db3
1 changed files with 14 additions and 2 deletions

View File

@ -178,7 +178,13 @@ class Engine:
rec_list += [(i,{}) for i in stay_same_index]
rec_list = sorted(rec_list, key=lambda k:k[0])
return [e[1] for e in rec_list]
videos_ = [e[1] for e in rec_list]
return {
'user': {
'keywords': user.get('keywords', {})
},
'videos': videos_
}
# NOTE for future improvement: vids_exclude element unit could be clip or in/out time pairs, rather than playlist.
@ -239,12 +245,18 @@ class Engine:
)[:16 - channels['userKeywords'] - channels['globalKeywords']]
# Shuffle playlists (randomize layout) and shift clips (randomize start)
random.shuffle(videos)
return [{
videos_ = [{
'clips': video['clips'],
'position': random.randrange(len(video['clips'])),
'name': video['name'],
'tags': video['tags'],
} for video in videos]
return {
'user': {
'keywords': user.get('keywords', {})
},
'videos': videos_
}
def get_next(self, user, position):