don't reuse playlists

This commit is contained in:
j 2018-05-23 21:29:18 +02:00
parent 691679eb78
commit 8e06af0e2e

View file

@ -96,13 +96,13 @@ class Engine:
playlists = playlists[channels['userKeywords']:] playlists = playlists[channels['userKeywords']:]
# For each playlist, compute global keyword score # For each playlist, compute global keyword score
score = {} score = {}
for playlist in self.playlists: for playlist in playlists:
score[playlist['name']] = random.random() score[playlist['name']] = random.random()
for tag in [tag for tag in playlist['tags'] if tag in sliders]: for tag in [tag for tag in playlist['tags'] if tag in sliders]:
score[playlist['name']] += sliders[tag] score[playlist['name']] += sliders[tag]
# Select highest scoring playlists # Select highest scoring playlists
playlists = sorted( playlists = sorted(
self.playlists, playlists,
key=lambda playlist: -score[playlist['name']] key=lambda playlist: -score[playlist['name']]
) )
videos += playlists[:channels['globalKeywords']] videos += playlists[:channels['globalKeywords']]