Mopidy artist
This commit is contained in:
@ -199,6 +199,7 @@ const MopidyMiddleware = (function(){
|
||||
instruct( socket, store, 'library.lookup', action.data )
|
||||
.then( response => {
|
||||
var album = response[0].album;
|
||||
album.artists = response[0].artists;
|
||||
album.tracks = {
|
||||
items: response,
|
||||
total: response.length
|
||||
@ -236,6 +237,32 @@ const MopidyMiddleware = (function(){
|
||||
})
|
||||
break;
|
||||
|
||||
case 'MOPIDY_ARTIST':
|
||||
instruct( socket, store, 'library.lookup', action.data )
|
||||
.then( response => {
|
||||
var artist = {
|
||||
name: 'yeah',
|
||||
images: [],
|
||||
albums: [],
|
||||
tracks: response.slice(0,10)
|
||||
}
|
||||
|
||||
for( var i = 0; i < response.length; i++ ){
|
||||
var album = response[i].album;
|
||||
|
||||
function getByURI( albumToCheck ){
|
||||
return album.uri == albumToCheck.uri
|
||||
}
|
||||
var existingAlbum = artist.albums.find(getByURI);
|
||||
if( !existingAlbum ){
|
||||
artist.albums.push(album)
|
||||
}
|
||||
}
|
||||
|
||||
store.dispatch({ type: 'MOPIDY_ARTIST_LOADED', data: artist });
|
||||
})
|
||||
break;
|
||||
|
||||
// This action is irrelevant to us, pass it on to the next middleware
|
||||
default:
|
||||
return next(action);
|
||||
|
||||
Reference in New Issue
Block a user