Skip to content

Commit

Permalink
0.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bartve committed Feb 25, 2015
1 parent 38c1913 commit 48ad6e4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
0.6.2 / 2015-02-25
==================
* `database().image()` now requires the full image url as the first parameter due to the new Discogs image cluster
* Local request throttling by `disconnect` has been disabled for `database().image()`

0.6.1 / 2015-02-17
==================
* Added setting output format for user, artist and label profiles through `DiscogsClient.setConfig({outputFormat: 'html'})`
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,16 @@ app.get('/identity', function(req, res){
```

### Images
Image requests require authentication and are subject to [rate limiting](http://www.discogs.com/developers/#page:home,header:home-rate-limiting).
Image requests themselves don't require authentication, but obtaining the image URLs through, for example, release data does.
```javascript
var db = new Discogs(accessData).database(), file = 'R-176126-1322456477.jpeg';
db.image(file, function(err, data, rateLimit){
// Data contains the raw binary image data
require('fs').writeFile(file, data, 'binary', function(err){
// See your current limits
console.log(rateLimit);
console.log('Image saved!');
var db = new Discogs(accessData).database();
db.release(176126, function(err, data){
var url = data.images[0].resource_url;
db.image(url, function(err, data, rateLimit){
// Data contains the raw binary image data
require('fs').writeFile(file, data, 'binary', function(err){
console.log('Image saved!');
});
});
});
```
Expand Down
6 changes: 3 additions & 3 deletions lib/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ module.exports = function(client){

/**
* Get an image
* @param {string} file - The image file name
* @param {string} url - The full image url
* @param {function} [callback] - Callback function
*/

database.image = function(file, callback){
client.get({url: '/images/'+file, encoding: 'binary', authLevel: 2, json: false}, callback);
database.image = function(url, callback){
client.get({url: url, encoding: 'binary', queue: false, json: false}, callback);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "disconnect",
"description": "An easy to use client library to connect with the discogs.com API v2.0",
"version": "0.6.1",
"description": "A full featured Discogs API v2.0 client library",
"version": "0.6.2",
"keywords": ["discogs", "api", "client", "oauth"],
"homepage": "https://github.com/bartve/disconnect",
"bugs": "https://github.com/bartve/disconnect/issues",
Expand Down

0 comments on commit 48ad6e4

Please sign in to comment.