Skip to content

Commit 044818a

Browse files
authored
Fix musicbrainz genres fetching (#5609)
- genres are now called tags - tags needs to be in "mb fetch includes" - release-group has them - release has them - and recording as well but we don't use them - not sure what this outdated check was doing, it looked at "recordings" in the valid list even though genre fetching is only included in the `album_info` code and not `track_info` 🤷 - see musicbrainz.VALID_INCLUDES for reference
2 parents 4e7b054 + 795545c commit 044818a

File tree

1 file changed

+34
-23
lines changed

1 file changed

+34
-23
lines changed

beets/autotag/mb.py

+34-23
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,38 @@ def get_message(self):
7474

7575
log = logging.getLogger("beets")
7676

77-
RELEASE_INCLUDES = [
78-
"artists",
79-
"media",
80-
"recordings",
81-
"release-groups",
82-
"labels",
83-
"artist-credits",
84-
"aliases",
85-
"recording-level-rels",
86-
"work-rels",
87-
"work-level-rels",
88-
"artist-rels",
89-
"isrcs",
90-
"url-rels",
91-
"release-rels",
92-
]
77+
RELEASE_INCLUDES = list(
78+
{
79+
"artists",
80+
"media",
81+
"recordings",
82+
"release-groups",
83+
"labels",
84+
"artist-credits",
85+
"aliases",
86+
"recording-level-rels",
87+
"work-rels",
88+
"work-level-rels",
89+
"artist-rels",
90+
"isrcs",
91+
"url-rels",
92+
"release-rels",
93+
"tags",
94+
}
95+
& set(musicbrainzngs.VALID_INCLUDES["release"])
96+
)
97+
98+
TRACK_INCLUDES = list(
99+
{
100+
"artists",
101+
"aliases",
102+
"isrcs",
103+
"work-level-rels",
104+
"artist-rels",
105+
}
106+
& set(musicbrainzngs.VALID_INCLUDES["recording"])
107+
)
108+
93109
BROWSE_INCLUDES = [
94110
"artist-credits",
95111
"work-rels",
@@ -101,11 +117,6 @@ def get_message(self):
101117
BROWSE_INCLUDES.append("work-level-rels")
102118
BROWSE_CHUNKSIZE = 100
103119
BROWSE_MAXTRACKS = 500
104-
TRACK_INCLUDES = ["artists", "aliases", "isrcs"]
105-
if "work-level-rels" in musicbrainzngs.VALID_INCLUDES["recording"]:
106-
TRACK_INCLUDES += ["work-level-rels", "artist-rels"]
107-
if "genres" in musicbrainzngs.VALID_INCLUDES["recording"]:
108-
RELEASE_INCLUDES += ["genres"]
109120

110121

111122
def track_url(trackid: str) -> str:
@@ -607,8 +618,8 @@ def album_info(release: dict) -> beets.autotag.hooks.AlbumInfo:
607618

608619
if config["musicbrainz"]["genres"]:
609620
sources = [
610-
release["release-group"].get("genre-list", []),
611-
release.get("genre-list", []),
621+
release["release-group"].get("tag-list", []),
622+
release.get("tag-list", []),
612623
]
613624
genres: Counter[str] = Counter()
614625
for source in sources:

0 commit comments

Comments
 (0)