Skip to content

Instantly share code, notes, and snippets.

@andreisebastianc
Created March 18, 2016 10:34
Show Gist options
  • Save andreisebastianc/b3217457c3ec9a543b9c to your computer and use it in GitHub Desktop.
Save andreisebastianc/b3217457c3ec9a543b9c to your computer and use it in GitHub Desktop.
Create random playlists from a list of songs read from a google spreadsheet
request('https://spreadsheets.google.com/feeds/list/1rlv-9lSYBvY9Do-KAof8vkG89iLnsGz1_-NpEm1tOe8/od6/public/values?alt=json-in-script', (err, resp, body) => {
if (!err && resp.statusCode == 200) {
console.log('songs read from google drive');
// let b = body.replace('gdata.io.handleScriptLoaded(', '');
// b = b.slice(0, -2);
body = stripGDriveBody(body);
const songs = JSON.parse(body).feed.entry;
const playlists = [];
const numberOFPlaylists = Math.random() * 10;
let i = 0;
while (i < numberOFPlaylists) {
playlists[i] = songs.filter(song => Math.random() > 0.5);
i++;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment