Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search is returning unavailable tracks #97

Closed
crgpww opened this issue Feb 19, 2016 · 6 comments
Closed

Search is returning unavailable tracks #97

crgpww opened this issue Feb 19, 2016 · 6 comments
Assignees
Labels
C-bug Category: This is a bug
Milestone

Comments

@crgpww
Copy link

crgpww commented Feb 19, 2016

With the migration to the spotify web api, the search results contains tracks that are not available in the user's country.

I found the @trygveaa comment on #94 about this, but we need a way to specify the desired market as a parameter or at least have the 'available_markets' array on the track/album returned object so we can filter it later.

An exemple, as I'm living in Brazil (BR), https://api.spotify.com/v1/search?q=%22Menina+da+saia+verde%22&type=album%2Cartist%2Ctrack&limit=50

@trygveaa
Copy link
Member

I can think of three possible solutions to this (well, one of them I'm not sure if is possible, and that's the only one I like...):

  1. Add a new config option for specifying the market you want.
  2. Add login for the Web API, so we can use the users market. This is tricky, since the login method is completely different than for libspotify, and it would complicate config for users.
  3. Get the users market from libspotify. This is my preferred option, but I don't know if it is possible. @jodal: Do you know if this info is available from libspotify?

@jodal
Copy link
Member

jodal commented Feb 24, 2016

No, I don't think that is available through libspotify. You can get toplists for the region of the current user, but there's nothing telling you what region that is.

@kingosticks
Copy link
Member

'4'. Filter the track results using track.availability ? (how on earth do you start numbering from something other than 1?!)

@kingosticks
Copy link
Member

Actually, cancel that, availability is seemingly for online/offline availability and not what I first thought.

EDIT: Wrong again! It is what I first thought:

SP_TRACK_AVAILABILITY_UNAVAILABLE   
Track is not available.

SP_TRACK_AVAILABILITY_AVAILABLE     
Track is available and can be played.

SP_TRACK_AVAILABILITY_NOT_STREAMABLE    
Track can not be streamed using this account.

SP_TRACK_AVAILABILITY_BANNED_BY_ARTIST  
Track not available on artist's reqeust. 

@wiibaker
Copy link

wiibaker commented Jul 17, 2016

I created a simple pull request #109 to add the market into the search query if it is specified. I do not have proper Python environment to compile/build/test the code, but the code is simple enough do such a change "blind". Some tweaks might be needed though. Please, check if you find it useful.

@kingosticks
Copy link
Member

I'm not sure how we missed it before... but libspotify does have sp_session_user_country!

@kingosticks kingosticks added C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal C-bug Category: This is a bug and removed C-enhancement Category: A PR with an enhancement or an issue with an enhancement proposal labels Feb 1, 2017
kingosticks pushed a commit to kingosticks/mopidy-spotify that referenced this issue Feb 3, 2017
kingosticks pushed a commit to kingosticks/mopidy-spotify that referenced this issue Feb 3, 2017
kingosticks pushed a commit to kingosticks/mopidy-spotify that referenced this issue Feb 3, 2017
kingosticks pushed a commit to kingosticks/mopidy-spotify that referenced this issue Feb 3, 2017
kingosticks pushed a commit to kingosticks/mopidy-spotify that referenced this issue Jun 8, 2017
kingosticks pushed a commit to kingosticks/mopidy-spotify that referenced this issue Jun 8, 2017
@jodal jodal added this to the v3.2 milestone Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

5 participants