random-record-sleeve
v0.0.7
Published
Gets a random record sleeve from Discogs.
Downloads
2
Maintainers
Readme
random-record-sleeve
Gets a random record sleeve from Discogs. Mostly just a try at making my first npm module 🎉
To use in any web project.
You need a Discogs API access since image consuming is not publicly available.
Works both in Node.js and in the browser thanks to axios
Usage
// Require the module
var randomRecordSleeve = require('random-record-sleeve');
// Set your Discogs API credentials (mandatory)
randomRecordSleeve.setCredentials('k3y', 's3cr3t');
// Get a random sleeve from https://www.discogs.com/lists/Discogs-Most-Popular-Albums/2056
var sleeve = randomRecordSleeve.getSleeve();
console.log(sleeve.url); // The sleeve picture
console.log(sleeve.title); // The record title
console.log(sleeve.year); // The record year
// Options (default values)
var sleeve = randomRecordSleeve.getSleeve({
listId: 2056, // List ID to get a sleeve from
size150: false // Gets the small sized (150x150) image if true
});