Skip to content

Commit 8f37f60

Browse files
committed
the order of ids in the row was such that I was popping off the wrong ones, now that I'm keeping track IDs, so the IDs were the album IDs, not the track IDs. Oops.
1 parent dce30da commit 8f37f60

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

exportify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ let PlaylistExporter = {
200200
if (song.track?.album && song.track.album.id) { album_ids.add(song.track.album.id) }
201201
// Multiple, comma-separated artists can throw off csv, so surround with "". Same for track and album names,
202202
// which may contain commas and even quotation marks! Treat with care. Null checking with question marks!
203-
return [song.track?.id, '"'+song.track?.artists?.map(artist => { return artist ? artist.id : null }).join(',')+'"', song.track?.album?.id,
203+
return ['"'+song.track?.artists?.map(artist => { return artist ? artist.id : null }).join(',')+'"', song.track?.album?.id, song.track?.id,
204204
'"'+song.track?.name?.replace(/"/g,'')+'"', '"'+song.track?.album?.name?.replace(/"/g,'')+'"',
205205
'"'+song.track?.artists?.map(artist => { return artist ? artist.name : null}).join(',')+'"',
206206
song.track?.album?.release_date, song.track?.duration_ms, song.track?.popularity, song.added_by?.id, song.added_at];
@@ -241,7 +241,7 @@ let PlaylistExporter = {
241241
let features_promise = Promise.all([data_promise, genre_promise, album_promise]).then(values => {
242242
let data = values[0]
243243
let songs_promises = data.map((chunk, i) => { // remember data is an array of arrays, each subarray 100 tracks
244-
let ids = chunk.map(song => song[0]).join(','); // the id lives in the first position
244+
let ids = chunk.map(song => song[2]).join(','); // the id lives in the third position
245245
return utils.apiCall('https://api.spotify.com/v1/audio-features?ids='+ids , access_token, 100*i);
246246
})
247247
return Promise.all(songs_promises).then(responses => {

0 commit comments

Comments
 (0)