Skip to content

Commit

Permalink
spotify: use number instead of strings for Catalogue
Browse files Browse the repository at this point in the history
The `isTrackAvailable()` function wasn't working properly
anymore due to a server-side change in the response format.
  • Loading branch information
TooTallNate committed Jun 18, 2015
1 parent 0f16a6a commit 91efc0b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/spotify.js
Expand Up @@ -945,17 +945,17 @@ Spotify.prototype.isTrackAvailable = function (track, country) {

// guessing at names here, corrections welcome...
var accountTypeMap = {
premium: 'SUBSCRIPTION',
unlimited: 'SUBSCRIPTION',

This comment has been minimized.

Copy link
@LinusU

LinusU Jun 29, 2016

Contributor

Care to elaborate? What do you mean "Bug"?

free: 'AD'
premium: 1,
unlimited: 1,
free: 0
};

if (has(allowed, country) && has(forbidden, country)) {
isAllowed = true;
isForbidden = false;
}

var type = accountTypeMap[this.accountType] || 'AD';
var type = accountTypeMap[this.accountType] || 0;
var applicable = has(restriction.catalogue, type);

available = isAllowed && !isForbidden && applicable;
Expand Down

1 comment on commit 91efc0b

@lucbernard
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @TooTallNate,

I'm using your lib in a project of mine and I still get the old restrictions values (AD & SUBSCRIPTION). Playback of tracks therefore fails since they all end up being seen as unavailable.

Do you have any idea why I'm still seeing the old restrictions format? Is there something else I need to update on my end? Perhaps a US-specific account issue (I have a CA account)? Any info would be greatly appreciated!

I reverted this commit in my fork and everything started working again but I'm not comfortable living with this kind of issue hanging over my head! ;)

Thanks Nathan and keep up the cool work!

Please sign in to comment.