Conversation
There was a problem hiding this comment.
Pull request overview
PR swap Discogs genre/style mapping so beets fields match Discogs meaning: Discogs genres are broad, Discogs styles are specific.
Changes:
- In Discogs plugin, read beets
genresfrom Discogsstyles, and beetsstylefrom Discogsgenres. - Update Discogs plugin tests to cover the swapped mapping.
- Update Discogs plugin docs + changelog entry for new mapping.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
beetsplug/discogs/__init__.py |
Swap Discogs genres/styles inputs when building AlbumInfo.style and AlbumInfo.genres. |
test/plugins/test_discogs.py |
Adjust release fixture + assertions for swapped mapping; rename one test. |
docs/plugins/discogs.rst |
Update append_style_genre + separator docs to describe new semantics. |
docs/changelog.rst |
Add changelog entry describing the Discogs mapping change. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6478 +/- ##
=======================================
Coverage 70.01% 70.01%
=======================================
Files 146 146
Lines 18505 18505
Branches 3010 3010
=======================================
Hits 12957 12957
Misses 4920 4920
Partials 628 628
🚀 New features to boost your workflow:
|
ddf7cce to
69af3cc
Compare
| def test_append_style_to_genre_no_styles(self): | ||
| """Test nothing appended to genre if style is empty""" | ||
| config["discogs"]["append_style_genre"] = True | ||
| release = self._make_release_from_positions(["1", "2"]) | ||
| release.data["styles"] = [] | ||
| release.data["genres"] = [] | ||
|
|
There was a problem hiding this comment.
grug see docstring talk about "style is empty" but test now empties release.data["genres"] (since beets style reads Discogs genres). please align names (either change wording or change which field emptied) so test not confuse.
| How to join the broader Discogs style values into the ``style`` field | ||
| string. |
There was a problem hiding this comment.
grug see separator docs still say "broader Discogs style values" but style field now built from Discogs genres (broader). please update sentence to say Discogs genre values (or just values stored in style).
| How to join the broader Discogs style values into the ``style`` field | |
| string. | |
| How to join the Discogs genre values stored in the ``style`` field into a | |
| single string. |
| styles: list[str] = result.data.get("genres") or [] | ||
| genres: list[str] = result.data.get("styles") or [] |
There was a problem hiding this comment.
grug see genres and styles variables point at lists inside result.data. genres.extend(styles) will mutate result.data["styles"] in-place when option on. that make weird side effect and can duplicate if get_album_info called twice on same Release. safer: copy lists (ex list(...)) before extend.
| styles: list[str] = result.data.get("genres") or [] | |
| genres: list[str] = result.data.get("styles") or [] | |
| raw_styles = result.data.get("genres") or [] | |
| raw_genres = result.data.get("styles") or [] | |
| styles: list[str] = list(raw_styles) | |
| genres: list[str] = list(raw_genres) |
discogs: Swap genre and style field mappingFixes #6390
Fixes the semantic mismatch between Discogs' taxonomy and beets' fields. In Discogs, genres are broad (e.g. "Electronic") and styles are specific (e.g. "Techno"). Previously, beets stored them the wrong way around.
What changed
In
get_album_info, the source fields are swapped:genres(beets) now reads from Discogsstyles— the specific valuesstyle(beets) now reads from Discogsgenres— the broader valuesThe
append_style_genreconfig option retains its original intent: append broader style values togenreswhen enabled. Only the data source for each field changed, not the logic.