Correctly handling spotify playlist play/queue actions

This commit is contained in:
James Barnsley
2019-03-30 17:28:44 +13:00
parent 2a0cb74ca7
commit 66e445dc2a
3 changed files with 25 additions and 7 deletions

View File

@ -58487,9 +58487,18 @@ var MopidyMiddleware = function () {
// We have the playlist loaded already, and we've got at least 1 track to start playing // We have the playlist loaded already, and we've got at least 1 track to start playing
if (playlist && playlist.tracks_uris && playlist.tracks_uris.length > 0) { if (playlist && playlist.tracks_uris && playlist.tracks_uris.length > 0) {
// Spotify-provied playlists need to be handled by the Spotify service // We've got all of the tracks, so just play those; no further action required
// We only need to load them if we haven't already got all the tracks if (playlist.tracks_total == playlist.tracks_uris.length) {
if (playlist.provider == 'spotify' && playlist.tracks_total != playlist.tracks_uris.length) { var tracks_uris = Object.assign([], playlist.tracks_uris);
if (action.shuffle) {
tracks_uris = helpers.shuffle(tracks_uris);
}
store.dispatch(mopidyActions.enqueueURIs(tracks_uris, action.uri, action.play_next, action.at_position, action.offset));
break;
}
// Spotify-provided playlists need to be handled by the Spotify service
if (playlist.provider == 'spotify') {
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue', action.play_next)); store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue', action.play_next));
break; break;
} }

File diff suppressed because one or more lines are too long

View File

@ -650,9 +650,18 @@ const MopidyMiddleware = (function(){
// We have the playlist loaded already, and we've got at least 1 track to start playing // We have the playlist loaded already, and we've got at least 1 track to start playing
if (playlist && playlist.tracks_uris && playlist.tracks_uris.length > 0){ if (playlist && playlist.tracks_uris && playlist.tracks_uris.length > 0){
// Spotify-provied playlists need to be handled by the Spotify service // We've got all of the tracks, so just play those; no further action required
// We only need to load them if we haven't already got all the tracks if (playlist.tracks_total == playlist.tracks_uris.length){
if (playlist.provider == 'spotify' && playlist.tracks_total != playlist.tracks_uris.length){ var tracks_uris = Object.assign([], playlist.tracks_uris);
if (action.shuffle){
tracks_uris = helpers.shuffle(tracks_uris);
}
store.dispatch(mopidyActions.enqueueURIs(tracks_uris, action.uri, action.play_next, action.at_position, action.offset))
break;
}
// Spotify-provided playlists need to be handled by the Spotify service
if (playlist.provider == 'spotify'){
store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue', action.play_next)); store.dispatch(spotifyActions.getAllPlaylistTracks(action.uri, action.shuffle, 'enqueue', action.play_next));
break; break;
} }