Skip to content

Commit

Permalink
fix: artist-disco service when album is set to null (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrani authored Jan 2, 2024
1 parent 663031b commit a73b231
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/manifest.chrome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"short_name": "Chorus",
"name": "Chorus - Spotify Enhancer",
"description": "Enhance Spotify with controls to save favourite snips, auto-skip tracks, and set global and custom speed. More to come!",
"version": "1.21.0",
"version": "1.21.1",
"manifest_version": 3,
"author": "cdrani",
"action": {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"short_name": "Chorus",
"name": "Chorus - Spotify Enhancer",
"description": "Enhance Spotify with controls to save favourite snips, auto-skip tracks, and set global and custom speed. More to come!",
"version": "1.21.0",
"version": "1.21.1",
"manifest_version": 3,
"author": "cdrani",
"action": {
Expand Down
8 changes: 3 additions & 5 deletions src/services/artist-disco.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function fetchTrackURIs(albumIds) {
const url = generateURL({ pathType: 'albums', param: albumIdsGroup.join(',') })
const options = await setOptions({})
const albumInfo = await request({ url, options })
const albumGroupsTracks = albumInfo?.albums?.map(({ tracks }) => tracks)
const albumGroupsTracks = albumInfo?.albums?.map(album => album?.tracks ?? null).filter(Boolean)

for (const album of albumGroupsTracks) {
album.items.forEach(({ uri }) => trackURIs.push(uri))
Expand Down Expand Up @@ -82,10 +82,8 @@ async function createArtistDiscoPlaylist({ artist_name, artist_id }) {
const playlist = await createPlaylist(artist_name)
await addTracksToPlaylist({ playlist, trackURIs })
resolve({ artist_name, playlist })
} catch (error) {
reject(error)
}
});
} catch (error) { console.error(error); reject(error) }
})
}

export { createArtistDiscoPlaylist }

0 comments on commit a73b231

Please sign in to comment.