Skip to content

Extend Spotify plugin to obtain (popularity and audio features) track attributes - #4352

Merged
sampsyo merged 24 commits into
beetbox:masterfrom
arsaboo:spotify_extend
Jun 12, 2022
Merged

Extend Spotify plugin to obtain (popularity and audio features) track attributes#4352
sampsyo merged 24 commits into
beetbox:masterfrom
arsaboo:spotify_extend

Conversation

@arsaboo

@arsaboo arsaboo commented May 13, 2022

Copy link
Copy Markdown
Contributor

This PR extends the spotify plugin to add another 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 command only processes tracks that already have the spotify_track_id (which was introduced in #4348). So, the workflow will be to run beet import to obtain the spotify_track_id. This information can then be used to run beet spotifysync.

Fixes #4347 #3578 #4094

optional config:

spotify:
    client_id: SPOTIFY_CLIENT_ID
    client_secret: SPOTIFY_CLIENT_SECRET

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.)

@arsaboo

arsaboo commented May 13, 2022

Copy link
Copy Markdown
Contributor Author

@sampsyo I was thinking that instead of force, we should have separate overwrite flags. audio_features are static and may not have to be updated, whereas popularity is dynamic and users may want to update them. We don't have to tie them together. In addition, we may want to add other attributes later. Not everyone may want all the attributes, so it may be better to decouple them. Here's the config that I have in mind (with defaults indicated):

spotify:
    client_id: SPOTIFY_CLIENT_ID
    client_secret: SPOTIFY_CLIENT_SECRET
    popularity: yes
    popularity_overwrite: no
    audio_features: no
    audio_features_overwrite: no

@sampsyo sampsyo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome; looking good so far! Here are a few suggestions/questions.

Do you also think you might be able to add to the docs for the plugin to describe the new command? A changelog entry would also be super helpful.

Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
Comment thread beetsplug/spotify.py Outdated
arsaboo and others added 5 commits May 17, 2022 14:50
Co-authored-by: Adrian Sampson <adrian@radbox.org>
Co-authored-by: Adrian Sampson <adrian@radbox.org>
Co-authored-by: Adrian Sampson <adrian@radbox.org>
@arsaboo

arsaboo commented May 17, 2022

Copy link
Copy Markdown
Contributor Author

Thanks for the review @sampsyo. Addressed all the comments and updated the documents/changelog.

@JOJ0

JOJ0 commented Jun 9, 2022

Copy link
Copy Markdown
Member

Just here to say woohoo! Very nice feature! Thanks to the submitter 💣💥

@arsaboo

arsaboo commented Jun 9, 2022

Copy link
Copy Markdown
Contributor Author

Thanks @JOJ0

I have a few additional features in mind once this PR gets merged.

@arsaboo
arsaboo requested a review from sampsyo June 10, 2022 13:22
@wisp3rwind

Copy link
Copy Markdown
Member

Looks good to me! @sampsyo all your previous comments have been addressed, any other concerns? Or can we go ahead and merge this?

@sampsyo sampsyo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!! This looks really great. Thank you for seeing this through!!

@sampsyo
sampsyo merged commit c25e7ad into beetbox:master Jun 12, 2022
@arsaboo
arsaboo deleted the spotify_extend branch June 12, 2022 22:19
@snejus snejus added the spotify spotify plugin label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spotify spotify plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants