added shuffle option
This commit is contained in:
parent
ddc8c0918b
commit
81c2c290dd
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user