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

Obtain Spotify track (popularity and audio features) attributes #4351

Closed
wants to merge 58 commits into from

Conversation

arsaboo
Copy link
Contributor

@arsaboo arsaboo commented May 12, 2022

This PR introduces a new command beet spotifysync to obtain all the audio features available for a track. This includes the popularity information and audio_features. The following audio_features are included: acousticness, danceability, energy, instrumentalness, key, liveness, loudness, mode, speechiness, tempo, time_signature, valence. See details here.

This features only processes tracks that already have the spotify_track_id (which was introduced in #4348). So, the workflow will be to run beet import which will populate the spotify_track_id. This information can then be used to run beet spotifysync.

Fixes #4347 #3578 #4094

Config required:

spotifysync:
    client_id: SPOTIFY_CLIENT_ID
    client_secret: SPOTIFY_CLIENT_SECRET
    force: no

My hope is that we get the initial PR so that folks can start using it and improve upon it.

To Do

  • Documentation. (If you've add a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst near the top of the document.)
  • Tests. (Encouraged but not strictly required.)

@sampsyo
Copy link
Member

sampsyo commented May 12, 2022

Nice; thanks for getting this started! What do you think about rolling this new command directly into the existing Spotify plugin? That could avoid a bunch of the duplicated code and allow users to share the token between the two bits of functionality, for example.

@arsaboo
Copy link
Contributor Author

arsaboo commented May 12, 2022

I am not 100% versed with the existing Spotify plugin. It may be possible to combine the features, but I am a little hesitant. The existing plugin is written for the auto-tagger and serves the basic purpose of getting the tag information from Spotify.

Also, not everyone may require all these features (although that can be addressed with a config option). Unless you are completely opposed to this idea, it may be a good idea to keep it separate so that additional features can be added here.

@arsaboo
Copy link
Contributor Author

arsaboo commented May 12, 2022

Also note that it will make the importer significantly slow due to the timeouts and the additional processing required.

@sampsyo
Copy link
Member

sampsyo commented May 12, 2022

Ah, to be clear, I just meant adding this command to the Spotify plugin. That would mean you'd still have to run the command explicitly to fetch the new data; it would not run as part of the import. In the code, this is just a matter of defining the commands method of the existing plugin appropriately.

I don't have a strong opinion about whether it's one or two plugins per se, but I do strongly prefer not to duplicate code... and keeping it in one plugin seems most likely to avoid that duplication.

@arsaboo
Copy link
Contributor Author

arsaboo commented May 12, 2022

Is there any plugin template that I can follow?

@arsaboo
Copy link
Contributor Author

arsaboo commented May 13, 2022

closing in favor of #4352

@arsaboo arsaboo closed this May 13, 2022
@arsaboo arsaboo deleted the spotify_sync branch March 23, 2023 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants