Skip to content

Commit

Permalink
Merge branch 'master' of github.com:pavelkomarov/exportify
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelkomarov committed Dec 29, 2024
2 parents af7bd87 + 165725b commit 1ab01c2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions exportify.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ let PlaylistExporter = {
// which may contain commas and even quotation marks! Treat with care. Null checking with question marks!
return ['"'+song.track?.artists?.map(artist => { return artist ? artist.id : null }).join(',')+'"', song.track?.album?.id, song.track?.id,
'"'+song.track?.name?.replace(/"/g,'')+'"', '"'+song.track?.album?.name?.replace(/"/g,'')+'"',
'"'+song.track?.artists?.map(artist => { return artist ? artist.name : null}).join(',')+'"',
'"'+song.track?.artists?.map(artist => { return artist ? artist.name?.replace(/"/g,'') : null}).join(',')+'"',
song.track?.album?.release_date, song.track?.duration_ms, song.track?.popularity, song.added_by?.id, song.added_at];
})
})
Expand Down Expand Up @@ -272,8 +272,7 @@ let PlaylistExporter = {
features = features.flat() // get rid of the batch dimension (only 100 songs per call)
data.forEach((row, i) => features[i]?.forEach(feat => row.push(feat)))
// make a string
let csv = "Track ID,Track Name,Album Name,Artist Name(s),Release Date,Duration (ms),Popularity,Added By,Added At,Genres,Record Label,\
Danceability,Energy,Key,Loudness,Mode,Speechiness,Acousticness,Instrumentalness,Liveness,Valence,Tempo,Time Signature\n"
let csv = "Track ID,Track Name,Album Name,Artist Name(s),Release Date,Duration (ms),Popularity,Added By,Added At,Genres,Record Label,Danceability,Energy,Key,Loudness,Mode,Speechiness,Acousticness,Instrumentalness,Liveness,Valence,Tempo,Time Signature\n"
data.forEach(row => { csv += row.join(",") + "\n" })
return csv
})
Expand Down

0 comments on commit 1ab01c2

Please # to comment.