Added the MusicBrainz flex fields directly to the importer

This commit is contained in:
Alok Saboo 2025-10-07 18:02:04 -04:00
parent c5f5ffc027
commit c59aff9e27
2 changed files with 6 additions and 27 deletions

View file

@ -58,8 +58,13 @@ REIMPORT_FRESH_FIELDS_ALBUM = [
"deezer_album_id",
"beatport_album_id",
"tidal_album_id",
"media",
"releasegroup_id",
"data_url",
]
REIMPORT_FRESH_FIELDS_ITEM = [
field for field in REIMPORT_FRESH_FIELDS_ALBUM if field != "media"
]
REIMPORT_FRESH_FIELDS_ITEM = list(REIMPORT_FRESH_FIELDS_ALBUM)
# Global logger.
log = logging.getLogger("beets")

View file

@ -30,10 +30,6 @@ from confuse.exceptions import NotFoundError
import beets
import beets.autotag.hooks
from beets import config, plugins, util
from beets.importer.tasks import (
REIMPORT_FRESH_FIELDS_ALBUM,
REIMPORT_FRESH_FIELDS_ITEM,
)
from beets.metadata_plugins import MetadataSourcePlugin
from beets.util.id_extractors import extract_release_id
@ -59,27 +55,6 @@ FIELDS_TO_MB_KEYS = {
"year": "date",
}
_MB_REIMPORT_FRESH_FIELDS_ALBUM = [
"media",
"releasegroup_id",
"data_url",
]
_MB_REIMPORT_FRESH_FIELDS_ITEM = [
"data_url",
"releasegroup_id",
]
def _extend_reimport_fresh_fields() -> None:
"""Ensure MusicBrainz fields stored as flex attrs refresh on reimport."""
for field in _MB_REIMPORT_FRESH_FIELDS_ALBUM:
if field not in REIMPORT_FRESH_FIELDS_ALBUM:
REIMPORT_FRESH_FIELDS_ALBUM.append(field)
for field in _MB_REIMPORT_FRESH_FIELDS_ITEM:
if field not in REIMPORT_FRESH_FIELDS_ITEM:
REIMPORT_FRESH_FIELDS_ITEM.append(field)
musicbrainzngs.set_useragent("beets", beets.__version__, "https://beets.io/")
@ -392,7 +367,6 @@ class MusicBrainzPlugin(MetadataSourcePlugin):
from the beets configuration. This should be called at startup.
"""
super().__init__()
_extend_reimport_fresh_fields()
self.config.add(
{
"host": "musicbrainz.org",