Starting radio process fired the _STARTED inadvertantly

This commit is contained in:
James Barnsley
2017-08-22 08:09:35 +12:00
parent a0a58b0cd8
commit a4e935ce17
4 changed files with 36 additions and 12 deletions

View File

@ -1012,6 +1012,33 @@ const MopidyMiddleware = (function(){
* ======================================================================================
**/
case 'MOPIDY_GET_LIBRARY_ARTISTS':
instruct( socket, store, 'library.browse', { uri: 'local:directory?type=artist' } )
.then( response => {
if (response.length <= 0) return
var uris = helpers.arrayOf('uri',response)
store.dispatch({
type: 'ARTISTS_LOADED',
artists: response
})
store.dispatch({
type: 'MOPIDY_LIBRARY_ARTISTS_LOADED',
uris: uris
})
})
break;
/**
* TODO: Fetch and process library artists
*
* We can't get specific artist artwork from Mopidy. Perhaps we fetch additional
* artist metadata via LastFM? Their API limits will make this quite slow.
*
case 'MOPIDY_GET_LIBRARY_ARTISTS':
var last_run = store.getState().ui.processes.MOPIDY_LIBRARY_ARTISTS_PROCESSOR
@ -1062,6 +1089,8 @@ const MopidyMiddleware = (function(){
break
*/
case 'MOPIDY_GET_ARTIST':
instruct( socket, store, 'library.lookup', action.data )
.then( response => {

View File

@ -256,9 +256,9 @@ const PusherMiddleware = (function(){
// start our UI process notification
if (action.type == 'PUSHER_UPDATE_RADIO'){
store.dispatch(uiActions.startProcess('PUSHER_RADIO', 'Updating radio'))
store.dispatch(uiActions.startProcess('PUSHER_RADIO_PROCESS', 'Updating radio'))
} else {
store.dispatch(uiActions.startProcess('PUSHER_RADIO', 'Starting radio'))
store.dispatch(uiActions.startProcess('PUSHER_RADIO_PROCESS', 'Starting radio'))
}
var data = {
@ -287,7 +287,7 @@ const PusherMiddleware = (function(){
if (response.status == 0){
store.dispatch(uiActions.createNotification(response.message, 'bad'))
}
store.dispatch(uiActions.stopProcess('PUSHER_RADIO'))
store.dispatch(uiActions.processFinished('PUSHER_RADIO_PROCESS'))
})
break
@ -307,7 +307,7 @@ const PusherMiddleware = (function(){
case 'PUSHER_RADIO_STARTED':
case 'PUSHER_RADIO_CHANGED':
if (action.radio.enabled && store.getState().spotify.enabled){
if (action.radio && action.radio.enabled && store.getState().spotify.enabled){
store.dispatch(spotifyActions.resolveRadioSeeds(action.radio))
}
next(action)

View File

@ -138,7 +138,6 @@ const UIMiddleware = (function(){
type: action.key,
data: store.getState().ui.processes[action.key].data
})
console.log('resuming',store.getState().ui.processes[action.key].data)
next(action)
break

View File

@ -39,11 +39,7 @@ class Discover extends React.Component{
// BAU
} else {
if (this.props.authorized){
this.props.spotifyActions.getFavorites()
} else {
this.getRecommendations()
}
this.props.spotifyActions.getFavorites()
}
}
@ -240,8 +236,8 @@ class Discover extends React.Component{
<div className="liner">
<h1>Explore new music</h1>
<h2 className="grey-text">
Add seeds below to build your sound. Let's start with
{this.props.authorized ? " two of your favorite artists" : " the chill genre"}.
Add seeds below to build your sound
{!this.props.params.seeds ? ". Let's start with two of your favorite artists." : null}
</h2>
{this.renderSeeds()}
</div>