Skip to content

Instantly share code, notes, and snippets.

@benkaiser
Created January 4, 2016 02:27
Show Gist options
  • Save benkaiser/f7837de872ea1f7318fa to your computer and use it in GitHub Desktop.
Save benkaiser/f7837de872ea1f7318fa to your computer and use it in GitHub Desktop.
find music brainz metadata by fingerprint and then try fetch coverart
var acoustid = require('acoustid');
var CA = require('coverart');
var ca = new CA({userAgent:'test/0.0.1 ( http://github.com/user/test )'});
acoustid(process.argv[2], { key: '8XaBELgH' }, callback);
function callback(err, results) {
if (err)
throw err;
var artist = results[0].recordings[0].artists[0].name;
console.log(JSON.stringify(results, null, 2));
for (var x = 0; x < results[0].recordings[0].releasegroups[0].releases.length; x++) {
var item = results[0].recordings[0].releasegroups[0].releases[x];
console.log('finding coverart for: ' + item.title + ' - ' + item.id);
ca.release(item.id, function(err, response) {
console.log(JSON.stringify(response, null, 2));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment