update comments

This commit is contained in:
rlx 2017-11-02 11:12:56 +00:00
parent 8c2c090794
commit 703133129e

View file

@ -43,6 +43,7 @@ class Engine:
score[playlist['name']] = random.random() score[playlist['name']] = random.random()
for tag in playlist['tags']: for tag in playlist['tags']:
score[playlist['name']] += count.get(tag, 0) score[playlist['name']] += count.get(tag, 0)
# Select 16 highest scoring playlists
playlists = sorted( playlists = sorted(
self.playlists, self.playlists,
key=lambda playlist: -score[playlist['name']] key=lambda playlist: -score[playlist['name']]
@ -106,11 +107,6 @@ class Engine:
'in': clip['in'], 'in': clip['in'],
'out': clip['out'] 'out': clip['out']
} for clip in clips if clip['value'] == storyline['name']] } for clip in clips if clip['value'] == storyline['name']]
#'clips': [
# '{}_{:.3f}-{:.3f}'.format(
# clip['id'].split('/')[0], clip['in'], clip['out']
# ) for clip in clips if clip['value'] == storyline['name']
#]
} for storyline in storylines] if playlist['clips']] } for storyline in storylines] if playlist['clips']]
with open(os.path.join(self.path, 'playlists.json'), 'w') as f: with open(os.path.join(self.path, 'playlists.json'), 'w') as f:
f.write(json.dumps(self.playlists, indent=4, sort_keys=True)) f.write(json.dumps(self.playlists, indent=4, sort_keys=True))
@ -118,6 +114,8 @@ class Engine:
class Pandora: class Pandora:
# pan.do/ra API wrapper
def __init__(self, url, username, password): def __init__(self, url, username, password):
self.api = ox.API(url) self.api = ox.API(url)
self.api.signin(username=username, password=password) self.api.signin(username=username, password=password)