Loading artwork with getImages

This commit is contained in:
James Barnsley
2017-01-25 08:55:18 +13:00
parent e01e444e70
commit 57c8a75df1
4 changed files with 125 additions and 15 deletions

View File

@ -547,14 +547,39 @@ const MopidyMiddleware = (function(){
case 'MOPIDY_GET_ALBUMS':
instruct( socket, store, 'library.browse', { uri: 'local:directory?type=album' } )
.then( response => {
store.dispatch({
type: 'ALBUMS_LOADED',
albums: response
});
store.dispatch({
type: 'LOCAL_ALBUMS_LOADED',
uris: helpers.asURIs(response)
});
// fetch album artwork
instruct( socket, store, 'library.getImages', { uris: helpers.asURIs(response) } )
.then(response => {
var albums = []
for (var uri in response){
if (response.hasOwnProperty(uri)){
albums.push({
uri: uri,
images: response[uri]
})
}
}
console.log(albums)
store.dispatch({
type: 'ALBUMS_LOADED',
albums: albums
});
})
})
break;