Utilities to retrieve cover and artist images from Discogs.
npm link wg-log
npm link wg-utils
npm install
const Discogs = require('wg-discogs').Discogs;
const utils = require('wg-utils');
Create the Discogs API proxy, passing it your Discogs key and secret
var discogs = new Discogs(key, secret);
Search for releases
return discogs.searchReleases("Benighted", "Psychose", function(err, releases) {
...
Search for artists
return discogs.searchArtists("Benighted", function(err, artists) {
...
Get artist picture
return discogs.searchArtists("Benighted", function(err, artists) {
var thumb = artists[0].thumb;
var ext = utils.getExtension(thumb);
var wstream = fs.createWriteStream('/tmp/artist.' + ext);
return discogs.getAlbumArt(thumb, wstream, function(err) {
...
wstream.end();
Get album covert image
return discogs.searchReleases("Benighted", "Psychose", function(err, releases) {
var thumb = releases[0].thumb;
var ext = utils.getExtension(thumb);
var wstream = fs.createWriteStream('/tmp/album.' + ext);
return discogs.getAlbumArt(thumb, wstream, function(err) {
...
wstream.end();
style | string[] | A list of syles for this release. Ex: ["Black Metal", "Death Metal"], |
thumb | string | The URL to the thumbnail image. Ex: https://api-img.discogs.com/rYq-RDtA503SUrt-y40hUAoofFk=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-679234-1146818572.jpeg.jpg |
format | string[] | The release format. Ex: ["CD", "Album"] |
country | string | The release country. Ex: "France" |
barcode | string[] | Example: ["3700132600549", "DOCdata FRANCE CDAR054"] |
uri | string | The image orientation. 1=TopLeft, 2=TopRight, 3=BottomRight, 4=BottomLeft, 5=LeftTop, 6=RightTop, 7=RightBottom, 8=LeftBottom |
community | Object | |
label | string[] | The release album label. Ex: ["Adipocere Records"] |
catno | string | |
year | string | The release year. Ex: "2002" |
genre | string[] | The release genre(s). Ex: ["Rock"] |
title | string | The release title. Ex: "Benighted - Psychose" |
resource_url | string | The release resource URL. Ex: "https://api.discogs.com/releases/679234" |
type | string | The release type. Ex: "release" |
id | number | The release Discogs identifier |
title | string[] | The artist name |
thumb | string | The URL to the thumbnail image. Ex: https://api-img.discogs.com/rYq-RDtA503SUrt-y40hUAoofFk=/fit-in/150x150/filters:strip_icc():format(jpeg):mode_rgb():quality(40)/discogs-images/R-679234-1146818572.jpeg.jpg |
uri | string[] | |
resource_url | string | |
id | number | The release Discogs identifier |