mirror of
https://github.com/beetbox/beets.git
synced 2025-12-07 00:53:08 +01:00
Added the MusicBrainz flex fields directly to the importer
This commit is contained in:
parent
c5f5ffc027
commit
c59aff9e27
2 changed files with 6 additions and 27 deletions
|
|
@ -58,8 +58,13 @@ REIMPORT_FRESH_FIELDS_ALBUM = [
|
||||||
"deezer_album_id",
|
"deezer_album_id",
|
||||||
"beatport_album_id",
|
"beatport_album_id",
|
||||||
"tidal_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.
|
# Global logger.
|
||||||
log = logging.getLogger("beets")
|
log = logging.getLogger("beets")
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,6 @@ from confuse.exceptions import NotFoundError
|
||||||
import beets
|
import beets
|
||||||
import beets.autotag.hooks
|
import beets.autotag.hooks
|
||||||
from beets import config, plugins, util
|
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.metadata_plugins import MetadataSourcePlugin
|
||||||
from beets.util.id_extractors import extract_release_id
|
from beets.util.id_extractors import extract_release_id
|
||||||
|
|
||||||
|
|
@ -59,27 +55,6 @@ FIELDS_TO_MB_KEYS = {
|
||||||
"year": "date",
|
"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/")
|
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.
|
from the beets configuration. This should be called at startup.
|
||||||
"""
|
"""
|
||||||
super().__init__()
|
super().__init__()
|
||||||
_extend_reimport_fresh_fields()
|
|
||||||
self.config.add(
|
self.config.add(
|
||||||
{
|
{
|
||||||
"host": "musicbrainz.org",
|
"host": "musicbrainz.org",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue