-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Refactor metadata source ID extraction utilities #4633
Conversation
516cb55
to
a348920
Compare
One idea for future use of this "refactoring PR" is #4474, which currently is set back to draft state until I get to rebasing to only include the relevant parts. |
@sampsyo, this one is for you <3, hope you like it. Suggestions on "naming things" and documentation/changelog are very welcome as well as any other thoughts. |
d0e96d8
to
5d85ab1
Compare
Hi @sampsyo, I know this one is probably a low priority one since it actually doesn't change any behaviour, nor does it fix anything (except a little oversight in the currently defunct beatport plugin). Certainly I ultimately did this to get a better view of what #4474 will actually change.
|
6bd8b33
to
155279f
Compare
- We introduce a new submodule of beets.util named id_extractors. - Parts of the ID extraction utilites required by metadata source plugins should live there. - Also this enables future usage of those utilities from the "outside" of metadata source plugins. - Move Discogs ID extractor to the new module and change test_discogs to use the new location. - Add spotify_id_regex variable to the new module.
and put to use in Spotify plugin. - Make _get_id() a staticmethod usable from outside a metadata source plugin. - id_regex now has to be passed as an argument instead of assuming it is accessible via an instance variable (self.id_regex). - In the Spotify plugin, import spotify_id_regex from util.id_extractors
in beets.util package.
from MetadataSourcePlugin and save beatport_id_regex in id_extractors module. This streamlines the Beatport release ID extraction magic with plugins Deezer and Spotify.
- Often discogs release links used to be written as discogs.com/release/<id> - Extend one of the existing regex patterns to support that by making the trailing dash (-) optional. - Save a new test regex on regex101.com and update the link to it.
155279f
to
c48fa0a
Compare
I'm merging this now since:
|
This is a much-needed cleanup @JOJ0 Thanks for your efforts and patience on this. |
Description
Tidy up and streamline ID extraction utilities used by metadata source plugins. Enable the usage of those utilities from everywhere.
beets.util.id_extractors
To Do
Documentation.