Skip to content

Add BPSyncPlugin - #3389

Merged
sampsyo merged 18 commits into
beetbox:masterfrom
rhlahuja:add-bpsync-plugin
Oct 6, 2019
Merged

Add BPSyncPlugin#3389
sampsyo merged 18 commits into
beetbox:masterfrom
rhlahuja:add-bpsync-plugin

Conversation

@rhlahuja

@rhlahuja rhlahuja commented Oct 4, 2019

Copy link
Copy Markdown
Contributor

This is a proof-of-concept for a bpsync plugin, Beatport's equivalent of mbsync. It allows users to sync changes to Beatport metadata and "backfill" new fields recently added in #3372.

I'm considering abstracting this functionality into a SyncMetadataSourcePlugin base class (similar to MetadataSourcePlugin introduced in #3355) which can also be leveraged for Spotify/Deezer/MusicBrainz, although that requires some larger refactors of BeatportPlugin and MBSyncPlugin, perhaps better suited for a separate PR?

@sampsyo, what do you think? Is it worth putting the finishing touches on this Beatport-specific plugin, or investing time in a SyncMetadataSourcePlugin to future-proof?

This PR also closes #3387 by properly assigning genre and renaming musical_key to initial_key.

Note: I had to run

UPDATE item_attributes SET key='initial_key' WHERE key='musical_key'

on my database to avoid raising AttributeError: 'TrackInfo' object has no attribute 'musical_key' when autotag.apply_metadata(album_info, mapping) is called.

@sampsyo

sampsyo commented Oct 4, 2019

Copy link
Copy Markdown
Member

Nice!! This looks great. I do think it would be a good idea to land this self-contained version—and then consider factoring out another base class, if that makes sense, in a second pass.

@rhlahuja rhlahuja changed the title [WIP] Add BPSyncPlugin Add BPSyncPlugin Oct 4, 2019
@rhlahuja

rhlahuja commented Oct 5, 2019

Copy link
Copy Markdown
Contributor Author

@sampsyo, this is ready for a review whenever you're free!

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

Looks great so far! Here are a few suggestions.

Comment thread beets/library.py Outdated
Comment thread beets/plugins.py
Comment thread beets/plugins.py Outdated
Comment thread docs/plugins/bpsync.rst Outdated
Comment thread docs/plugins/bpsync.rst
Comment thread docs/plugins/bpsync.rst Outdated
Comment thread beets/plugins.py
return [self.album_for_id(album_id=a['id']) for a in albums]
results = self._search_api(query_type='album', filters=query_filters)
albums = [self.album_for_id(album_id=r['id']) for r in results]
return [a for a in albums if a is not None]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This bit logic along with this early return were added to exclude "empty" (0-track) albums I encountered such as https://www.deezer.com/us/album/6979394.

@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; this looks great! Thanks for all your work on both the new plugin and some refactoring.

@sampsyo
sampsyo merged commit 61a56f1 into beetbox:master Oct 6, 2019
@snejus snejus added the bpsync bpsync plugin label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bpsync bpsync plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Beatport plugin does not apply tags to file

3 participants