diff --git a/beets/autotag/match.py b/beets/autotag/match.py index b3df1304f..843e3d696 100644 --- a/beets/autotag/match.py +++ b/beets/autotag/match.py @@ -539,12 +539,6 @@ def tag_album( search_artist, search_album = cur_artist, cur_album log.debug("Search terms: {0} - {1}", search_artist, search_album) - extra_tags = None - if config["musicbrainz"]["extra_tags"]: - tag_list = config["musicbrainz"]["extra_tags"].get() - extra_tags = {k: v for (k, v) in likelies.items() if k in tag_list} - log.debug("Additional search terms: {0}", extra_tags) - # Is this album likely to be a "various artist" release? va_likely = ( (not consensus["artist"]) diff --git a/beetsplug/musicbrainz.py b/beetsplug/musicbrainz.py index fdbdf1598..6f991fae5 100644 --- a/beetsplug/musicbrainz.py +++ b/beetsplug/musicbrainz.py @@ -783,15 +783,16 @@ class MusicBrainzPlugin(BeetsPlugin): if track_count := len(items): criteria["tracks"] = str(track_count) - # Additional search cues from existing metadata. - if extra_tags: - for tag, value in extra_tags.items(): - key = FIELDS_TO_MB_KEYS[tag] - value = str(value).lower().strip() - if key == "catno": - value = value.replace(" ", "") - if value: - criteria[key] = value + if self.config["extra_tags"]: + tag_list = self.config["extra_tags"].get() + self._log.debug("Additional search terms: {0}", tag_list) + for tag, value in tag_list.items(): + if key := FIELDS_TO_MB_KEYS.get(tag): + value = str(value).lower().strip() + if key == "catno": + value = value.replace(" ", "") + if value: + criteria[key] = value # Abort if we have no search terms. if not any(criteria.values()):