Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions beetsplug/musicbrainz.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
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

Expand All @@ -55,6 +59,27 @@
"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/")


Expand Down Expand Up @@ -367,6 +392,7 @@ def __init__(self):
from the beets configuration. This should be called at startup.
"""
super().__init__()
_extend_reimport_fresh_fields()
self.config.add(
{
"host": "musicbrainz.org",
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ New features:

Bug fixes:

- :doc:`plugins/musicbrainz` Refresh flexible MusicBrainz metadata on reimport
so format changes are applied. :bug:`6036`
- :doc:`plugins/spotify` Ensure ``spotifysync`` keeps popularity, ISRC, and
related fields current even when audio features requests fail. :bug:`6061`
- :doc:`plugins/spotify` Fixed an issue where track matching and lookups could
Expand Down