return user keywords

This commit is contained in:
j 2018-09-21 22:09:45 +02:00
parent a590c0ea2a
commit 0fe5752db3

View file

@ -178,7 +178,13 @@ class Engine:
rec_list += [(i,{}) for i in stay_same_index] rec_list += [(i,{}) for i in stay_same_index]
rec_list = sorted(rec_list, key=lambda k:k[0]) 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. # 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']] )[:16 - channels['userKeywords'] - channels['globalKeywords']]
# 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 [{ videos_ = [{
'clips': video['clips'], 'clips': video['clips'],
'position': random.randrange(len(video['clips'])), 'position': random.randrange(len(video['clips'])),
'name': video['name'], 'name': video['name'],
'tags': video['tags'], 'tags': video['tags'],
} for video in videos] } for video in videos]
return {
'user': {
'keywords': user.get('keywords', {})
},
'videos': videos_
}
def get_next(self, user, position): def get_next(self, user, position):