Change of plan - use playlist uri and load all tracks on demand

This commit is contained in:
James Barnsley
2017-04-06 21:24:21 +12:00
parent 62ed217021
commit b052cd09f5
2 changed files with 20 additions and 3 deletions

View File

@ -304,8 +304,26 @@ const MopidyMiddleware = (function(){
store.dispatch( pusherActions.stopRadio() )
}
var first_uri = action.uris[0]
// spotify playlist and albums are handled differently
if (helpers.uriSource(first_uri) == 'spotify'){
switch (helpers.uriType(first_uri)){
case 'playlist':
// TODO
// trigger loading of all the playlist tracks
// once loaded, re-run play uris
// maybe create new play_album play_playlist actions to handle
// as we'd then reuse play_uris for the loaded track uris
break
case 'album':
break
}
}
// add our first track
instruct( socket, store, 'tracklist.add', { uri: action.uris[0], at_position: 0 } )
instruct( socket, store, 'tracklist.add', { uri: first_uri, at_position: 0 } )
.then( response => {
// treat empty response as a failed lookup

View File

@ -70,8 +70,7 @@ class Playlist extends React.Component{
play(){
ReactGA.event({ category: 'Playlist', action: 'Play', label: this.props.playlist.uri })
var tracks_uris = helpers.asURIs(this.props.playlist.tracks)
this.props.mopidyActions.playURIs(tracks_uris, this.props.params.uri)
this.props.mopidyActions.playURIs([this.props.playlist.uri], this.props.params.uri)
}
follow(){