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: store the Spotify track ID within the Beets DB also for tracks that were matched against Musicbrainz on import #5190

Open
mgoltzsche opened this issue Apr 12, 2024 · 3 comments

Comments

@mgoltzsche
Copy link
Contributor

mgoltzsche commented Apr 12, 2024

Currently the Spotify track ID is persisted within the Beets DB only for songs that have been matched against Spotify on import. Others don't have a Spotify ID.
However, it should be possible to associate each song within the Beets library with a Spotify track and persist that information within the Beets DB, ideally including the audio features.

Background / use-cases that rely on this feature:

  • I'd like to use the Spotify audio features for playlist generation within Beets. (Alternatively this information could be retrieved from the audio data using the xtractor plugin.)
  • I'd like to aggregate the Spotify audio features within my personal playlists in order to discover related song using Spotify's recommendations API endpoint, providing the aggregated features of a playlist as parameters.
  • I'd like to be able to export and sync my personal playlists from my Beets library into Spotify (using the persisted Spotify track ID) and share them with other Spotify users.

Proposed solution

There should be a Beets CLI command to associate each song within the Beets library with a Spotify track by storing the Spotify track ID within a Beets database field, e.g. spotify_id. It could as well be implemented within the existing beet spotify command that the Beets Spotify plugin implements.
Also, allow incremental matching of Spotify songs so that Spotify is queried only for Beets songs that are not yet associated with Spotify.

Correspondingly, the Spotify track should be associated with each song on import, also in case the song was matched against Musicbrainz. In that case the Spotify audio features should also be copied into the Beets DB.

Objective

Associate as many songs within the Beets library as possible with Spotify and persist that information.

Goals

Associate as many songs within the Beets library as possible with Spotify and persist that information.

Non-goals

More prompts, less automation.

Anti-goals

Don't sacrifice/destroy Musicbrainz track associations.

@arsaboo
Copy link
Contributor

arsaboo commented Apr 12, 2024

For all the reasons you indicated, I exclusively use Spotify tag source. Still, I miss out on all the Musicbrainz-related features (e.g., missing), or I cannot obtain Deezer's popularity information. The problem you are referring to is not really a Spotify problem but a broader beets problem (given that it is built around using a single tag source).

I have thought hard about it, and I think a good intermediate solution would be to have some metaimport plugin that would query all the tag sources that a user has configured and allow users to fetch IDs from all sources. We can use the respective plugin features once the IDs are available inside beets. For example, in your case, if you initially imported music using MB, you already have MB information in beets. The plugin will only query the sources configured but not present in the database and then obtain matches. I actually started working on such a metaimport plugin but could not get it going. As the number of tag sources increases, it is one of the "must-have" features in my mind, and I would love to get that feature.

@mgoltzsche
Copy link
Contributor Author

Oh, that's a pity!
Alternatively, can we not simply add an additional spotify_id field and make the beet spotify command establish the association based on that new ID field, accepting that the Spotify association won't be established on import automatically?

@arsaboo
Copy link
Contributor

arsaboo commented Apr 12, 2024

We can only choose one of the tag sources at the time of import. However, you can always reimport with another tag source.

Let's say we use MB on the initial import. This will populate both the mb_albumid and mb_trackid fields. You can then reimport with Spotify, which will add the spotify_album_id and spotify_track_id fields. Now, at this point, you will have identifiers from both sources, and the data_source will be updated to Spotify, and the tags will be from Spotify. Hope that clarifies.

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

No branches or pull requests

2 participants