nicfit / eyeD3

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
http://eyed3.nicfit.net/
GNU General Public License v3.0
546 stars 58 forks source link

How to read Musicbrainz Picard field from eyed3.id3.tag.Tag object? #473

Closed actuallyaswin closed 3 years ago

actuallyaswin commented 4 years ago

As the issue title suggests, I'm trying to programmatically read the MUSICBRAINZ_ALBUMSTATUS field from an eyed3.id3.tag.Tag object. As the Musicbrainz Picard documentation shows (https://picard-docs.musicbrainz.org/en/technical/tag_mapping.html#id53), this field has a TXXX frame ID, but it's not just TXXX, there's also that text after the colon.

My first guess was to use the getTextFrame function, but I've tried every possible combination I can think of.

>>> import eyed3
>>> t = eyed3.load("path/to/my/song.mp3")
>>> type(t.tag)
<class 'eyed3.id3.tag.Tag'>
>>> t.tag.artist
'Busta Rhymes'
>>> t.tag.getTextFrame("TXXX")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\eyed3\id3\tag.py", line 235, in getTextFrame
    raise ValueError("Invalid frame-id for text frame")
ValueError: Invalid frame-id for text frame
>>> t.tag.getTextFrame("TXXX:MUSICBRAINZ ALBUM TYPE")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\eyed3\id3\tag.py", line 235, in getTextFrame
    raise ValueError("Invalid frame-id for text frame")
ValueError: Invalid frame-id for text frame
>>> t.tag.getTextFrame("TXXX:MUSICBRAINZALBUMTYPE")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\eyed3\id3\tag.py", line 235, in getTextFrame
    raise ValueError("Invalid frame-id for text frame")
ValueError: Invalid frame-id for text frame
>>> t.tag.getTextFrame("XDOR")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python38\lib\site-packages\eyed3\id3\tag.py", line 235, in getTextFrame
    raise ValueError("Invalid frame-id for text frame")
ValueError: Invalid frame-id for text frame

So what's the proper way to read Musicbrainz Picard tags from eyed3 objects? I am using the eyeD3 python module, version 0.9.5.

Appreciate all the the help, thanks! 😄

nicfit commented 4 years ago

getTextFrame requires a bytes argument. The TXXX:desc is not the true frame name, rather it is b'TXXX' of which there man be many, each with a different description (e.g. MUSICBRAINZALBUMTYPE)

nicfit commented 3 years ago

Closing, re-open if still having problems with getTextFrame