Only handle multiple genres in discogs

This commit is contained in:
Šarūnas Nejus 2026-02-09 22:54:24 +00:00
parent 8750191a29
commit ce2000a2cf
No known key found for this signature in database
2 changed files with 17 additions and 22 deletions

View file

@ -352,12 +352,11 @@ class DiscogsPlugin(MetadataSourcePlugin):
mediums = [t["medium"] for t in tracks]
country = result.data.get("country")
data_url = result.data.get("uri")
style = self.format(result.data.get("styles"))
base_genre = self.format(result.data.get("genres"))
styles: list[str] = result.data.get("styles") or []
genres: list[str] = result.data.get("genres") or []
genre = base_genre
if self.config["append_style_genre"] and genre is not None and style:
genre += f"{self.config['separator'].as_str()}{style}"
if self.config["append_style_genre"]:
genres.extend(styles)
discogs_albumid = self._extract_id(result.data.get("uri"))
@ -411,8 +410,8 @@ class DiscogsPlugin(MetadataSourcePlugin):
releasegroup_id=master_id,
catalognum=catalogno,
country=country,
style=style,
genre=genre,
style=self.config["separator"].as_str().join(styles) or None,
genres=genres,
media=media,
original_year=original_year,
data_source=self.data_source,
@ -433,14 +432,6 @@ class DiscogsPlugin(MetadataSourcePlugin):
return None
def format(self, classification: Iterable[str]) -> str | None:
if classification:
return (
self.config["separator"].as_str().join(sorted(classification))
)
else:
return None
def get_tracks(
self,
tracklist: list[Track],

View file

@ -116,17 +116,21 @@ Default
.. conf:: append_style_genre
:default: no
Appends the Discogs style (if found) to the genre tag. This can be useful if
you want more granular genres to categorize your music. For example,
a release in Discogs might have a genre of "Electronic" and a style of
"Techno": enabling this setting would set the genre to be "Electronic,
Techno" (assuming default separator of ``", "``) instead of just
"Electronic".
Appends the Discogs style (if found) to the ``genres`` tag. This can be
useful if you want more granular genres to categorize your music. For
example, a release in Discogs might have a genre of "Electronic" and a style
of "Techno": enabling this setting would append "Techno" to the ``genres``
list.
.. conf:: separator
:default: ", "
How to join multiple genre and style values from Discogs into a string.
How to join multiple style values from Discogs into a string.
.. versionchanged:: 2.7.0
This option now only applies to the ``style`` field as beets now only
handles lists of ``genres``.
.. conf:: strip_disambiguation
:default: yes