Play shuffled playlist, fixes #302

This commit is contained in:
James Barnsley
2018-06-26 08:51:11 +12:00
parent 1d492bbfef
commit 8ede56d876
11 changed files with 22918 additions and 20901 deletions

View File

@ -1655,14 +1655,15 @@ export function getLibraryTracksAndPlayProcessor(data){
* Recursively get .next until we have all tracks
**/
export function getPlaylistTracksAndPlay(uri){
export function getPlaylistTracksAndPlay(uri, shuffle){
return (dispatch, getState) => {
dispatch(uiActions.startProcess(
'SPOTIFY_GET_PLAYLIST_TRACKS_AND_PLAY_PROCESSOR',
'Loading playlist tracks',
{
uri: uri,
next: 'users/'+ helpers.getFromUri('userid',uri) +'/playlists/'+ helpers.getFromUri('playlistid',uri) +'/tracks?market='+getState().spotify.country
next: 'users/'+ helpers.getFromUri('userid',uri) +'/playlists/'+ helpers.getFromUri('playlistid',uri) +'/tracks?market='+getState().spotify.country,
shuffle: shuffle
}
))
}
@ -1704,17 +1705,24 @@ export function getPlaylistTracksAndPlayProcessor(data){
{
next: response.next,
total: response.total,
remaining: response.total - uris.length
remaining: response.total - uris.length,
shuffle: data.shuffle
}
))
dispatch(uiActions.runProcess(
'SPOTIFY_GET_PLAYLIST_TRACKS_AND_PLAY_PROCESSOR',
{
next: response.next,
uris: uris
uris: uris,
shuffle: data.shuffle
}
))
} else {
if (data.shuffle){
uris = helpers.shuffle(uris);
}
dispatch(mopidyActions.playURIs(uris, data.uri))
dispatch(uiActions.processFinishing('SPOTIFY_GET_PLAYLIST_TRACKS_AND_PLAY_PROCESSOR'))
}