Python's way of reading ID3 information in mp3

  • 2020-04-02 14:34:47
  • OfStack

This article illustrates how Python can read ID3 information in mp3. Share with you for your reference. Specific analysis is as follows:

Pyid3 is not easy to use and is often not recognized.
Mutagen is good, but by default easyid3 doesn't read comments and needs to be hacked manually

The Python code is as follows:


from mutagen.mp3 import MP3
import mutagen.id3
from mutagen.easyid3 import EasyID3
EasyID3.valid_keys["comment"]="COMM::'XXX'"
id3info = MP3("xxx.mp3", ID3=EasyID3)
for k, v in id3info.items():
  print k,v

I hope this article has helped you with your Python programming.


Related articles: