Playing album; PLAY_URIS is closer to what it actually does

This commit is contained in:
James Barnsley
2016-11-18 08:29:13 +13:00
parent b72eabcbbc
commit 1ffa5b62c6
8 changed files with 65 additions and 15 deletions

View File

@ -41,9 +41,9 @@ export function changeTrack( tlid ){
}
}
export function playTracks( uris ){
export function playURIs( uris ){
return {
type: 'MOPIDY_PLAY_TRACKS',
type: 'MOPIDY_PLAY_URIS',
uris: uris
}
}

View File

@ -180,17 +180,18 @@ const MopidyMiddleware = (function(){
store.dispatch({ type: 'MOPIDY_URISCHEMES_FILTERED', data: uri_schemes });
break;
case 'MOPIDY_PLAY_TRACKS':
case 'MOPIDY_PLAY_URIS':
// add our first track
instruct( socket, store, 'tracklist.add', { uri: action.uris[0], at_position: 0 } )
.then( response => {
// play it
store.dispatch( mopidyActions.changeTrack( response[0].tlid ) );
// TODO: perhaps force update of currentTlTrack before we proceed?
// this will make the UI feel snappier...
if( !response || response.length <= 0 ){
console.error('Could not add URI to tracklist', action.uris[0])
}else{
// play it
store.dispatch( mopidyActions.changeTrack( response[0].tlid ) );
}
// add the rest of our uris (if any)
action.uris.shift();