added shuffle option
This commit is contained in:
parent
ddc8c0918b
commit
81c2c290dd
@ -37,6 +37,13 @@ if __name__ == '__main__':
|
||||
else:
|
||||
log.log("requested playlist {} not found".format(part))
|
||||
|
||||
if 'shuffle' in tomake:
|
||||
if tomake['shuffle'] is True:
|
||||
import random
|
||||
random.shuffle(tracks)
|
||||
else:
|
||||
tracks.sort(key=lambda x: x['track']['album']['release_date'], reverse=True)
|
||||
else:
|
||||
tracks.sort(key=lambda x: x['track']['album']['release_date'], reverse=True)
|
||||
|
||||
net.replacePlaylistTracks(tomake['id'], [i['track']['uri'] for i in tracks])
|
||||
|
Loading…
Reference in New Issue
Block a user