Created
April 6, 2015 02:01
-
-
Save beaugunderson/d29560af5d725c1c20f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var fs = require('fs'); | |
var parse = require('csv-parse'); | |
// from https://www.amazon.com/clientbuddy/compartments/playlists/handlers/syncPlaylists | |
// post-processed with jq: | |
// jq .playlists[0].tracks[].trackId.objectId < ./syncPlaylists.json | |
var playlistTracks = require('./track-ids.json'); | |
// from https://www.amazon.com/cirrus/v3/getTracksById | |
var someTracks = require('./getTracksById.json').trackList; | |
// from https://cirrus-full-snapshots-track-csv-v1-0-na-prod.s3.amazonaws.com/ | |
var csvData = fs.readFileSync('./tracks.csv'); | |
parse(csvData, {columns: true}, function (err, csvTracks) { | |
if (err) { | |
return console.log('Error:', err); | |
} | |
playlistTracks.forEach(function (a) { | |
var found = false; | |
someTracks.forEach(function (b) { | |
if (a === b.trackId) { | |
found = true; | |
console.log(b.metadata.artistName + ' - ' + b.metadata.title); | |
} | |
}); | |
csvTracks.forEach(function (b) { | |
if (a === b.objectId) { | |
found = true; | |
console.log(b.artistName + ' - ' + b.title); | |
} | |
}); | |
if (!found) { | |
console.log('Not found:', a); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment