Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
export async function byAlbumNoDiscography(state){
//receives this.state from playlistChooser and extract what you need
const {chosenPlaylistId: playlistId, chosenPlaylistName:playlistName} = state;
try {
let tracks = await getSimplePlaylistTracks(playlistId);
const albumIds = identifyAlbumsInPlaylist(tracks);
const playlistObject = convertPlaylistToObjectByProperty(tracks, 'albumId');
let tracksByAlbum = => {
return playlistObject[albumId]
const sortedByAlbumAndTrack = flatten(tracksByAlbum);
await createPlaylist(sortedByAlbumAndTrack, playlistName, true);
catch(err) {
console.error('Error: in byAlbumNoDiscography in spotifyFunctions', err);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.