Add extra_tags support to Discogs plugin#6433
Add extra_tags support to Discogs plugin#6433jdoe29103 wants to merge 10 commits intobeetbox:masterfrom
extra_tags support to Discogs plugin#6433Conversation
…, reset config in test
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6433 +/- ##
==========================================
+ Coverage 69.42% 69.54% +0.11%
==========================================
Files 141 141
Lines 18452 18495 +43
Branches 3020 3026 +6
==========================================
+ Hits 12811 12862 +51
+ Misses 5004 4996 -8
Partials 637 637
🚀 New features to boost your workflow:
|
extra_tags support to Discogs plugin
|
Hey, thanks for your contribution! I would suggest having a look at |
Thanks for taking the time @snejus! |
JOJ0
left a comment
There was a problem hiding this comment.
great feature idea! just some questions inline.
| # MusicBrainz "alias" or "tracks" search fields, so we ignore | ||
| # those tags if configured. | ||
| if tag in {"alias", "tracks"}: | ||
| continue |
There was a problem hiding this comment.
why is it required to remove those silently? if we remove that check, would a misconfiguration throw an error and inform the user that they should fix there config?
There was a problem hiding this comment.
I don't think it's required. I went with this approach because I was attempting to mirror the musicbrainz.py implementation and just sort of left it there. I don't see why it couldn't be removed though.
|
|
||
| value = str(most_common) | ||
| if tag == "catalognum": | ||
| value = value.replace(" ", "") |
There was a problem hiding this comment.
aha interesting, so discogs api gives better results if whitespace is removed from queries on that field. did you find this out by trial and error or do discogs api docs state that?
There was a problem hiding this comment.
The catalognum whitespace stripping is copied from the MusicBrainz plugin’s get_album_criteria implementation, which normalizes catalognum by removing spaces before using it in searches.
I did a few manual Discogs queries while working on this and found that removing spaces is generally helpful (users often tag catalog with spaces, while Discogs catno fields are typically stored without them in my testing), but I didn’t see this explicitly documented.
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
Description
Fixes #6412.
This is my first time submitting a PR for an open source project so please point out any mistakes!
Summary
discogs.extra_tagsconfiguration option to narrow Discogs search queries using existing tag values.barcode,catalognum,country,label,media,year) to corresponding Discogs search parameters.Details
The Discogs plugin now mirrors
musicbrainz.extra_tagsby allowing users to specify additional tags that should be used when building Discogs search filters.discogs.extra_tags(default:[]).barcode→barcodecatalognum→catno(whitespace removed)country→countrylabel→labelmedia→formatyear→yearaliasandtracksare recognized but intentionally ignored for Discogs, since the Discogs API does not provide direct equivalents for these MusicBrainz-specific fields.When
extra_tagsare configured, the plugin usesbeets.util.pluralityover the items in the import session to select the most common value for each configured tag and adds the corresponding Discogs filter.Testing
test/plugins/test_discogs.pyto verify:extra_tagsis not set.discogs.extra_tags: [label, catalognum]results inlabelandcatnofilters populated from library items (with catalog number whitespace stripped).pytest test/plugins/test_discogs.pypytest test/plugins/test_musicbrainz.py(...)
To Do