I am working on an algorithm that uses AcousticBrainz API. Part of the process is assigning an audio file with a specific UUID that refers to a file in a database. The tag is added via Picard and is present among other tags when checking e.g. via VLC Media Player:
Is there any way to access these 'custom' tags? I tried to use eyeD3 and mutagen, however, I think they only enable accessing specific tags like artist or length of the file.
Can I use eyed3 or mutagen to accomplish the goal? Is there any other tool that enables such operation?
Yes, you can use either one. These custom tags are stored as user text frames, with the frame ID "TXXX".
Here's some example code with eyeD3:
import eyed3
file = eyed3.load("test.mp3")
for frame in file.tag.frameiter(["TXXX"]):
print(f"{frame.description}: {frame.text}")
# get a specific tag
artist_id = file.tag.user_text_frames.get("MusicBrainz Artist Id").text
And with mutagen (it supports multiple values in each frame, but this seems to violates the ID3 spec; see this picard PR for the gory details):
from mutagen.id3 import ID3
audio = ID3("test.mp3")
for frame in audio.getall("TXXX"):
print(f"{frame.desc}: {frame.text}")
# get a specific tag
artist_id = audio["TXXX:MusicBrainz Artist Id"].text[0]
You can see how Picard uses mutagen to read these tags here: https://github.com/metabrainz/picard/blob/ee06ed20f3b6ec17d16292045724921773dde597/picard/formats/id3.py#L314-L336