diff --git a/src/js/components/ContextMenu.js b/src/js/components/ContextMenu.js index 65297a4b..20c1e673 100755 --- a/src/js/components/ContextMenu.js +++ b/src/js/components/ContextMenu.js @@ -356,10 +356,10 @@ class ContextMenu extends React.Component{ this.setState({submenu_expanded: expanded}) if (expanded){ - if (!this.props.spotify_library_playlists){ + if (!this.props.spotify_library_playlists_loaded_all){ this.props.spotifyActions.getLibraryPlaylists() } - if (!this.props.mopidy_library_playlists){ + if (!this.props.mopidy_library_playlists_loaded_all){ this.props.mopidyActions.getLibraryPlaylists() } } @@ -633,7 +633,9 @@ const mapStateToProps = (state, ownProps) => { current_track: state.core.current_track, current_tracklist: state.core.current_tracklist, spotify_library_playlists: state.spotify.library_playlists, + spotify_library_playlists_loaded_all: state.spotify.library_playlists_loaded_all, mopidy_library_playlists: state.mopidy.library_playlists, + mopidy_library_playlists_loaded_all: state.mopidy.library_playlists_loaded_all, spotify_library_artists: state.spotify.library_artists, mopidy_library_artists: state.mopidy.library_artists, spotify_library_albums: state.spotify.library_albums, diff --git a/src/js/services/mopidy/middleware.js b/src/js/services/mopidy/middleware.js index e622a6e8..d7eb1316 100755 --- a/src/js/services/mopidy/middleware.js +++ b/src/js/services/mopidy/middleware.js @@ -313,7 +313,7 @@ const MopidyMiddleware = (function(){ } }) break - +/* case 'SPOTIFY_ALL_PLAYLIST_TRACKS_LOADED_FOR_PLAYING': var uris = [] for (var i = 0; i < action.tracks.length; i++){ @@ -321,6 +321,7 @@ const MopidyMiddleware = (function(){ } store.dispatch(mopidyActions.playURIs(uris, action.uri)) break + */ case 'MOPIDY_ENQUEUE_URIS': @@ -952,6 +953,7 @@ const MopidyMiddleware = (function(){ } store.dispatch({ type: 'MOPIDY_LIBRARY_PLAYLISTS_LOADED', uris: playlist_uris_filtered }); + store.dispatch({ type: 'MOPIDY_LIBRARY_PLAYLISTS_LOADED_ALL' }); // get the full playlist objects for (var i = 0; i < playlist_uris_filtered.length; i++ ){ diff --git a/src/js/services/mopidy/reducer.js b/src/js/services/mopidy/reducer.js index 5a3bbc98..1956fdbd 100755 --- a/src/js/services/mopidy/reducer.js +++ b/src/js/services/mopidy/reducer.js @@ -109,6 +109,9 @@ export default function reducer(mopidy = {}, action){ } return Object.assign({}, mopidy, { library_playlists: helpers.removeDuplicates(uris) }) + case 'MOPIDY_LIBRARY_PLAYLISTS_LOADED_ALL': + return Object.assign({}, mopidy, { library_playlists_loaded_all: true }) + case 'MOPIDY_LIBRARY_PLAYLIST_CREATED': var library_playlists = [] if (mopidy.library_playlists){ diff --git a/src/js/services/spotify/actions.js b/src/js/services/spotify/actions.js index d3eea7d8..dada2a3e 100755 --- a/src/js/services/spotify/actions.js +++ b/src/js/services/spotify/actions.js @@ -1243,6 +1243,7 @@ export function getPlaylistTracksForPlaying(uri){ 'SPOTIFY_GET_PLAYLIST_TRACKS_FOR_PLAYING_PROCESSOR', 'Loading playlist tracks', { + uri: uri, next: 'users/'+ helpers.getFromUri('userid',uri) +'/playlists/'+ helpers.getFromUri('playlistid',uri) +'/tracks?market='+getState().core.country } )) @@ -1295,7 +1296,7 @@ export function getPlaylistTracksForPlayingProcessor(data){ } )) } else { - dispatch(mopidyActions.playURIs(uris)) + dispatch(mopidyActions.playURIs(uris, data.uri)) dispatch(uiActions.processFinished('SPOTIFY_GET_PLAYLIST_TRACKS_FOR_PLAYING_PROCESSOR')) } }); @@ -1425,6 +1426,7 @@ export function getLibraryPlaylistsProcessor(data){ dispatch(uiActions.runProcess('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR', {next: response.next})) } else { dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR')) + dispatch({type: 'SPOTIFY_LIBRARY_PLAYLISTS_LOADED_ALL'}) } }); } diff --git a/src/js/services/spotify/reducer.js b/src/js/services/spotify/reducer.js index 5c45f34e..70a86293 100755 --- a/src/js/services/spotify/reducer.js +++ b/src/js/services/spotify/reducer.js @@ -200,6 +200,9 @@ export default function reducer(spotify = {}, action){ }) + case 'SPOTIFY_LIBRARY_PLAYLISTS_LOADED_ALL': + return Object.assign({}, spotify, { library_playlists_loaded_all: true }) + case 'SPOTIFY_LIBRARY_PLAYLISTS_CLEAR': return Object.assign({}, spotify, { library_playlists: [] })