Mergingcurrent_track and current_tracklist; Smarter reducers for UI
This commit is contained in:
@ -235,7 +235,7 @@ const MopidyMiddleware = (function(){
|
||||
break;
|
||||
|
||||
case 'MOPIDY_ALBUM':
|
||||
store.dispatch({ type: 'MOPIDY_ALBUM_LOADED', data: false });
|
||||
//store.dispatch({ type: 'MOPIDY_ALBUM_LOADED', data: false });
|
||||
instruct( socket, store, 'library.lookup', action.data )
|
||||
.then( response => {
|
||||
var album = response[0].album;
|
||||
|
||||
@ -34,7 +34,7 @@ export default function reducer(mopidy = {}, action){
|
||||
**/
|
||||
case 'MOPIDY_STATE':
|
||||
return Object.assign({}, mopidy, {
|
||||
state: action.data
|
||||
play_state: action.data
|
||||
});
|
||||
|
||||
case 'MOPIDY_CONSUME':
|
||||
@ -67,26 +67,6 @@ export default function reducer(mopidy = {}, action){
|
||||
* Asset-oriented actions
|
||||
**/
|
||||
|
||||
case 'MOPIDY_TLTRACKS':
|
||||
return Object.assign({}, mopidy, {
|
||||
tracks: action.data
|
||||
});
|
||||
|
||||
case 'MOPIDY_CURRENTTLTRACK':
|
||||
if( !action.data ) return mopidy;
|
||||
|
||||
var tracks = [];
|
||||
Object.assign(tracks, mopidy.tracks);
|
||||
|
||||
for( var i = 0; i < tracks.length; i++ ){
|
||||
Object.assign(tracks[i].track, { playing: ( tracks[i].tlid == action.data.tlid ) });
|
||||
}
|
||||
|
||||
return Object.assign({}, mopidy, {
|
||||
current_tltrack: action.data,
|
||||
tracks: tracks
|
||||
});
|
||||
|
||||
case 'MOPIDY_PLAYLISTS_LOADED':
|
||||
if( !action.data ) return mopidy;
|
||||
return Object.assign({}, mopidy, { playlists: action.data });
|
||||
@ -101,11 +81,6 @@ export default function reducer(mopidy = {}, action){
|
||||
playlist: action.data
|
||||
});
|
||||
|
||||
case 'MOPIDY_ALBUM_LOADED':
|
||||
return Object.assign({}, mopidy, {
|
||||
album: action.data
|
||||
});
|
||||
|
||||
case 'MOPIDY_ARTIST_LOADED':
|
||||
return Object.assign({}, mopidy, {
|
||||
artist: action.data
|
||||
|
||||
Reference in New Issue
Block a user