added shuffle option

This commit is contained in:
aj 2019-05-15 14:31:16 +01:00
parent ddc8c0918b
commit 81c2c290dd

View File

@ -37,7 +37,14 @@ if __name__ == '__main__':
else: else:
log.log("requested playlist {} not found".format(part)) log.log("requested playlist {} not found".format(part))
tracks.sort(key=lambda x: x['track']['album']['release_date'], reverse=True) 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]) net.replacePlaylistTracks(tomake['id'], [i['track']['uri'] for i in tracks])
else: else: