Adding mopidy connection delay to prevent components needing to handle it
This commit is contained in:
@ -176,44 +176,30 @@ const CoreMiddleware = (function () {
|
||||
}
|
||||
|
||||
// backend searching (mopidy)
|
||||
if (mopidy.connected) {
|
||||
store.dispatch(
|
||||
mopidyActions.getSearchResults(action.search_type, action.query, 100, full_uri_schemes),
|
||||
);
|
||||
}
|
||||
store.dispatch(
|
||||
mopidyActions.getSearchResults(action.search_type, action.query, 100, full_uri_schemes),
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
// Get assets from all of our providers
|
||||
case 'GET_LIBRARY_PLAYLISTS':
|
||||
if (spotify.connected) {
|
||||
store.dispatch(spotifyActions.getLibraryPlaylists());
|
||||
}
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getLibraryPlaylists());
|
||||
}
|
||||
store.dispatch(spotifyActions.getLibraryPlaylists());
|
||||
store.dispatch(mopidyActions.getLibraryPlaylists());
|
||||
next(action);
|
||||
break;
|
||||
|
||||
// Get assets from all of our providers
|
||||
case 'GET_LIBRARY_ALBUMS':
|
||||
if (spotify.connected) {
|
||||
store.dispatch(spotifyActions.getLibraryAlbums());
|
||||
}
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getLibraryAlbums());
|
||||
}
|
||||
store.dispatch(spotifyActions.getLibraryAlbums());
|
||||
store.dispatch(mopidyActions.getLibraryAlbums());
|
||||
next(action);
|
||||
break;
|
||||
|
||||
// Get assets from all of our providers
|
||||
case 'GET_LIBRARY_ARTISTS':
|
||||
if (spotify.connected) {
|
||||
store.dispatch(spotifyActions.getLibraryArtists());
|
||||
}
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getLibraryArtists());
|
||||
}
|
||||
store.dispatch(spotifyActions.getLibraryArtists());
|
||||
store.dispatch(mopidyActions.getLibraryArtists());
|
||||
next(action);
|
||||
break;
|
||||
|
||||
@ -245,7 +231,7 @@ const CoreMiddleware = (function () {
|
||||
store.dispatch(spotifyActions.getPlaylist(action.key));
|
||||
break;
|
||||
case 'm3u':
|
||||
if (store.getState().mopidy.connected) store.dispatch(mopidyActions.getPlaylist(action.key));
|
||||
store.dispatch(mopidyActions.getPlaylist(action.key));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -323,10 +309,11 @@ const CoreMiddleware = (function () {
|
||||
* */
|
||||
case 'LOAD_ITEMS':
|
||||
action.uris.forEach((uri) => {
|
||||
store.dispatch(coreActions[`load${titleCase(uriType(uri))}`](
|
||||
store.dispatch({
|
||||
type: `LOAD_${uriType(uri).toUpperCase()}`,
|
||||
uri,
|
||||
action.force_reload,
|
||||
));
|
||||
force_reload: action.force_reload,
|
||||
});
|
||||
});
|
||||
break;
|
||||
|
||||
@ -348,9 +335,7 @@ const CoreMiddleware = (function () {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getTrack(action.uri));
|
||||
}
|
||||
store.dispatch(mopidyActions.getTrack(action.uri));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -376,9 +361,7 @@ const CoreMiddleware = (function () {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getAlbum(action.uri));
|
||||
}
|
||||
store.dispatch(mopidyActions.getAlbum(action.uri));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -405,9 +388,7 @@ const CoreMiddleware = (function () {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getArtist(action.uri));
|
||||
}
|
||||
store.dispatch(mopidyActions.getArtist(action.uri));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -434,9 +415,7 @@ const CoreMiddleware = (function () {
|
||||
break;
|
||||
|
||||
default:
|
||||
if (store.getState().mopidy.connected) {
|
||||
store.dispatch(mopidyActions.getPlaylist(action.uri));
|
||||
}
|
||||
store.dispatch(mopidyActions.getPlaylist(action.uri));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -493,9 +472,9 @@ const CoreMiddleware = (function () {
|
||||
|
||||
|
||||
/**
|
||||
* Index actions
|
||||
* These modify our asset indexes, which are used globally
|
||||
* */
|
||||
* Index actions
|
||||
* These modify our asset indexes, which are used globally
|
||||
* */
|
||||
|
||||
case 'CURRENT_TRACK_LOADED':
|
||||
store.dispatch(coreActions.trackLoaded(action.track));
|
||||
|
||||
Reference in New Issue
Block a user