POC for playlist queueing

This commit is contained in:
James Barnsley
2019-03-18 16:26:16 +13:00
parent f824cca396
commit 5aa932d045
10 changed files with 5492 additions and 5372 deletions

View File

@ -231,48 +231,6 @@ export function removeFromIndex(index_name, key, new_key = null){
/**
* Playing of assetse
**/
/**
* Play one or many URIs
*
* @param uri = String (when playing just one URI, eg playlist)
* @param uris = Array (when playing several URIs, eg tracks)
* @param origin = String (URI from which these URIs came)
* @param shuffle = Boolean (shuffle the order of URIs)
**/
export function playURIs(uri = null, uris = [], origin = null, shuffle = false){
return {
type: 'PLAY_URIS',
uri: uri,
uris: uris,
origin: origin,
shuffle: shuffle
}
}
/**
* Enqueue one or many URIs
*
* @param uris = Array
* @param position = Int (position in track_list in which to insert these URIs)
* @param origin = String (URI from which these URIs came)
* @param shuffle = Boolean (shuffle the order of URIs)
**/
export function enqueueURIs(uris = [], position = null, origin = null, shuffle = false){
return {
type: 'ENQUEUE_URIS',
position: position,
uris: uris,
origin: origin,
shuffle: shuffle
}
}
/**
* Playlist manipulation
**/

View File

@ -176,21 +176,6 @@ const CoreMiddleware = (function(){
break
case 'PLAYLIST_TRACKS_ADDED':
store.dispatch(uiActions.createNotification({type: 'info', content: 'Added '+action.tracks_uris.length+' tracks to playlist'}))
switch(helpers.uriSource(action.key)){
case 'spotify':
store.dispatch(spotifyActions.getPlaylist(action.key));
break
case 'm3u':
if (store.getState().mopidy.connected ) store.dispatch(mopidyActions.getPlaylist(action.key));
break
}
next(action)
break
// Get assets from all of our providers
case 'GET_LIBRARY_PLAYLISTS':
if (store.getState().spotify.connected){
@ -245,6 +230,21 @@ const CoreMiddleware = (function(){
next(action);
break;
case 'PLAYLIST_TRACKS_ADDED':
store.dispatch(uiActions.createNotification({type: 'info', content: 'Added '+action.tracks_uris.length+' tracks to playlist'}))
switch(helpers.uriSource(action.key)){
case 'spotify':
store.dispatch(spotifyActions.getPlaylist(action.key));
break
case 'm3u':
if (store.getState().mopidy.connected ) store.dispatch(mopidyActions.getPlaylist(action.key));
break
}
next(action)
break
case 'PLAYLIST_TRACKS_REORDERED':
var playlists = Object.assign({}, core.playlists);
var playlist = Object.assign({}, playlists[action.key]);