Python: What is the most feature-rich library for

2019-04-09 16:19发布

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.

4条回答
祖国的老花朵
2楼-- · 2019-04-09 16:27

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.

查看更多
仙女界的扛把子
3楼-- · 2019-04-09 16:36

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()
查看更多
走好不送
4楼-- · 2019-04-09 16:38

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.

查看更多
【Aperson】
5楼-- · 2019-04-09 16:46
登录 后发表回答