Timer on full player

This commit is contained in:
James Barnsley
2016-11-09 22:02:01 +13:00
parent 52d95fd74b
commit 62fcb3add6
8 changed files with 1824 additions and 1791 deletions

View File

@ -300,25 +300,26 @@ export function getAlbum( uri ){
sendRequest( dispatch, getState, 'albums/'+ helpers.getFromUri('albumid', uri) )
.then( response => {
var album = response
// now get all the artists for this album (full objects)
var artist_uris = [];
for( var i = 0; i < response.artists.length; i++ ){
artist_uris.push( response.artists[i].uri )
}
dispatch(getArtists(artist_uris));
// inject the parent album object into each track for consistent track objects
for( var i = 0; i < response.tracks.items.length; i++ ){
response.tracks.items[i].album = {
name: response.name,
uri: response.uri
}
// we do this to get the artist artwork
var artist_ids = [];
for( var i = 0; i < album.artists.length; i++ ){
artist_ids.push( helpers.getFromUri( 'artistid', album.artists[i].uri ) )
}
dispatch({
type: 'SPOTIFY_ALBUM_LOADED',
data: response
});
sendRequest( dispatch, getState, 'artists/?ids='+artist_ids )
.then( response => {
var artists = response.artists
// finally dispatch the loaded action
dispatch({
type: 'SPOTIFY_ALBUM_LOADED',
data: Object.assign({}, album, {artists: artists})
});
});
});
}
}