views:

57

answers:

4

I'm looking for a good, feature-rich, library for reading metadata from various audio formats (MP3, FLAC, OGG, WAV, etc.). I have already looked at Mutagen, but the documentation is nearly nonexistent, and it seems incapable of loading basic information such as artist and audio title.

+1  A: 

Are the artist and audio title encoded properly? What particular formats is it failing one - often ID3 information is poorly encoded.

http://wiki.python.org/moin/UsefulModules#ID3Handling (A List of ID3 modules)

I would try ID3Reader, which has support for ID3v1, which Mutagen seems to be missing.

Rizwan Kassim
A: 

see taglib and it's python bindings

Jeremiah Rose
A: 

gstreamer is also an excellent option, if you don't mind the gnome dependency and a bit more effort coding. it supports just about every filetype known to man.

Jeremiah Rose
A: 

another binding based on taglib (maybe the same as python-taglib?) called tagpy by Andreas -- http://mathema.tician.de/software/tagpy . I used it a while ago, and it's not bad... the following rough code should give you an idea how to copy tags from one file to the other (thus any other manipulation)

def copy_tags(src_file, dst_file): # args both strings
    tag0 = tagpy.FileRef(src_file).file().tag()
    file1 = tagpy.FileRef(dst_file)
    tag1 = file1.file().tag()
    for info in ['album', 'artist', 'comment', 'genre', 'title', 'track', 'year']:
        setattr(tag1, info, getattr(tag0, info))
    print file1.save()
gatoatigrado