Search code examples
pythonmp3id3

What is the best library for reading ID3 tags?


What library is presently the most thorough and capable ID3 tag reading library available? Preferably something I can compile as a shared library and wrap with Python's ctypes library, or even a Python package.


Solution

  • I've had a good time using mutagen (tutorial: http://code.google.com/p/mutagen/wiki/Tutorial) - it's quite simple to get the info. Note that you should use the Easy ID3 option.

    >>> from glob import glob
    >>> from mutagen.easyid3 import EasyID3
    >>> for filename in glob('/home/jon/Downloads/*.mp3'):
        mp3info = EasyID3(filename)
        print mp3info.items()
    
    
    [('artist', [u"James O'Brien's Mystery Hour"]), ('title', [u"James O'Brien's Mystery Hour - 7 Dec 12"])]