Created
September 12, 2018 18:51
-
-
Save gate5th/8dad67e4831c103784190cf0aee6f3f1 to your computer and use it in GitHub Desktop.
oldschoolshuffle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getSimpleAlbumTracks(albumId, albumName, albumUri){ | |
//track_number is what track number a song is on the album | |
try { | |
const tracks = await spotifyApi.getAlbumTracks(albumId); | |
const simpleTracks = tracks.items.map((track) => { | |
const artist = track.artists[0]; | |
return { | |
trackId: track.id, | |
trackName: track.name, | |
trackUri: track.uri, | |
trackNumber: track.track_number, | |
albumId: albumId, | |
albumName: albumName, | |
albumUri: albumUri, | |
artistId: artist.id, | |
artistName: artist.name, | |
artistUri: artist.uri, | |
} | |
}) | |
return simpleTracks | |
} | |
catch(err) { | |
console.error('Error: getSimplePlaylistTracks in spotifyFunctions', err); | |
console.error(err.stack); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment