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

spotify: Authenticate API requests #2694

Open
dtvu opened this issue Sep 22, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@dtvu
Copy link

commented Sep 22, 2017

Problem

I was playing around with the Spotify plugin and I noticed that none of my tracks matched a Spotify ID. I wondered if this was potentially related to Spotify removing unauthenticated calls to the web API.

Setup

  • OS: Ubuntu 16.04
  • Python version: Python 3.5.2
  • beets version: 1.4.5
  • Turning off plugins made problem go away (yes/no): no
@sampsyo

This comment has been minimized.

Copy link
Member

commented Sep 22, 2017

Hmm; interesting. Could you perhaps include some verbose output?

@sampsyo sampsyo added the needinfo label Sep 22, 2017

@dtvu

This comment has been minimized.

Copy link
Author

commented Sep 22, 2017

Sorry, I should have included that before:

$ beet -vv
user configuration: /home/tony/.config/beets/config.yaml
data directory: /home/tony/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/tony/.config/beets/library.db
library directory: /media/archive/music
Sending event: library_opened
Usage: 
  beet COMMAND [ARGS...]
  beet help COMMAND

Options:
  --format-item=FORMAT_ITEM
                        print with custom format
  --format-album=FORMAT_ALBUM
                        print with custom format
  -l LIBRARY, --library=LIBRARY
                        library database file to use
  -d DIRECTORY, --directory=DIRECTORY
                        destination music directory
  -v, --verbose         log more details (use twice for even more)
  -c CONFIG, --config=CONFIG
                        path to configuration file
  -h, --help            show this help message and exit

Commands:
  clearart          remove images from file metadata
  config            show or edit the user configuration
  embedart          embed image files into file metadata
  extractart        extract an image from file metadata
  fetchart          download album art
  fields            show fields available for queries and format strings
  gmusic-songs      list of songs in Google Play Music library
  gmusic-upload     upload your tracks to Google Play Music
  help (?)          give detailed help on a specific sub-command
  import (imp, im)  import new music
  list (ls)         query the library
  mbsync            update metadata from musicbrainz
  modify (mod)      change metadata fields
  move (mv)         move or copy items
  remove (rm)       remove matching items from the library
  spotify           build a Spotify playlist
  stats             show statistics about the library or a query
  update (upd, up)  update the library
  version           output version information
  write             write tag information to files
Sending event: cli_exit
@sampsyo

This comment has been minimized.

Copy link
Member

commented Sep 22, 2017

Thanks! Just seeing the setup output is useful in itself, but what would be really helpful is a verbose log from a situation where the problem actually came up. That might include messages that show failed requests to the Spotify API, for example.

@dtvu

This comment has been minimized.

Copy link
Author

commented Sep 22, 2017

Can do!

$ beet -vv spotify "Andrew Belle"
user configuration: /home/tony/.config/beets/config.yaml
data directory: /home/tony/.config/beets
plugin paths: 
Sending event: pluginload
library database: /home/tony/.config/beets/library.db
library directory: /media/archive/music
Sending event: library_opened
spotify: Processing 10 tracks...
spotify: https://api.spotify.com/v1/search?q=Dark+Matter+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Pieces+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Sister+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Black+Bear+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Wants+What+It+Wants+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Details+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Santa+Fe+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=The+Enemy+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=Many+Lives+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: https://api.spotify.com/v1/search?q=I+Won%27t+Fight+It+album%3ABlack+Bear+artist%3AAndrew+Belle&type=track
spotify: URL returned a 401 error
spotify: 10 track(s) did not match a Spotify ID:
spotify: track: Dark Matter album:Black Bear artist:Andrew Belle
spotify: track: Pieces album:Black Bear artist:Andrew Belle
spotify: track: Sister album:Black Bear artist:Andrew Belle
spotify: track: Black Bear album:Black Bear artist:Andrew Belle
spotify: track: Wants What It Wants album:Black Bear artist:Andrew Belle
spotify: track: Details album:Black Bear artist:Andrew Belle
spotify: track: Santa Fe album:Black Bear artist:Andrew Belle
spotify: track: The Enemy album:Black Bear artist:Andrew Belle
spotify: track: Many Lives album:Black Bear artist:Andrew Belle
spotify: track: I Won't Fight It album:Black Bear artist:Andrew Belle
spotify: 
spotify: No Spotify tracks found from beets query
Sending event: cli_exit
@jackwilsdon

This comment has been minimized.

Copy link
Member

commented Sep 22, 2017

Looks like it is related to the removal of unauthorised calls, as visiting one of those URLs gives this response;

{
  "error": {
    "status": 401,
    "message": "No token provided"
  }
}
@sampsyo

This comment has been minimized.

Copy link
Member

commented Sep 23, 2017

Thanks for investigating, @jackwilsdon! That does indeed look like the explanation. It looks like this plugin will need to authenticate its API requests.

@sampsyo sampsyo changed the title Plugin: Spotify spotify: Authenticate API requests Sep 23, 2017

@sampsyo sampsyo added bug and removed needinfo labels Sep 23, 2017

@plittlefield

This comment has been minimized.

Copy link
Contributor

commented Nov 22, 2017

Same here. I have created an app here - https://developer.spotify.com/my-applications/#!/applications so just needs a config setting to make it work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.