Skip to content

Instantly share code, notes, and snippets.

@martindale
Created September 13, 2014 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martindale/e3a14d9cae46c364feb1 to your computer and use it in GitHub Desktop.
Save martindale/e3a14d9cae46c364feb1 to your computer and use it in GitHub Desktop.
add all currently queued tracks to a specific playlist
var username = 'martindale';
var playlistID = '5414c5fadda8bb926e0017e4';
$.getJSON('/playlist.json', function(tracks) {
tracks.map(function(x) {
return x._id;
}).forEach(function(trackID) {
$.post('/' + username + '/playlists/' + playlistID, {
trackID: trackID
}, function(res) {
console.log( trackID + ' added successfully');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment