Repository navigation
Accessing extended performer metadata from Musicbrainz #7089
|
For classical music, MusicBrainz policy specifies that the Artist tag have the composer and all of the performers are stored in PERFORMER extended metadata. The autotagger doesn't pull that information, but even if I add the metadata to the files using mp3tag, I cannot figure out how to extract that information. PERFORMER: Yo-yo Ma (cello) It seems like I should be able to get this using python and the inline plugin, but alas... Is there a plugin that handles this already? If not, how can I use python code in the inline plugin to get at this data? |
Replies: 2 comments 2 replies
|
For tags you've already added to the files, Add item_fields:
performers: |
import mutagen
from beets.util import syspath
audio = mutagen.File(syspath(path), easy=True)
if audio is None or audio.tags is None:
return ""
values = list(audio.get("performer", []))
for key in sorted(audio.keys()):
if key.startswith("performer:"):
role = key.split(":", 1)[1]
values.extend(f"{name} ({role})" for name in audio[key])
return "; ".join(values)Check it without changing your files: beet ls -f '$title: $performers'Checked on beets 2.14.1 with synthetic files covering FLAC This creates a computed References: inline block syntax, Mutagen musician-credit handling, PERFORMER mapping. |
|
for classical performer roles, the inline plugin is the right tool — it lets you use python expressions in path formats against any field beets knows. first check what beets actually imported: run if the role detail (soloist, conductor, orchestra) isnt in the stock fields, youve got two options: a tiny custom plugin that reads the musicbrainz recording relations during import, or the paste what |
For tags you've already added to the files,
inlinecan read them with Mutagen, which beets already depends on. Inline's normal variables come from the beets item, so an arbitrary file tag such asPERFORMERwon't automatically appear there.Add
inlineto your existing plugins list, then add this top-level config block: