This module allows one to read and manipulate so-called ID3 informational tags on MP3 files through an object-oriented Python interface. Note that this is the first thing I've ever written in Python, so please bear with me if I've done something atrociously wrong.
This module is hosted on SourceForge.net. Please visit the project page there.
Fetch the source (current version 1.2) or browse the source. You can also browse the CVS repository.
Here is a simple example of using the ID3 module. See the module itself for more documentation. This example sets the title and artist fields on an MP3 file.
from ID3 import * try: id3info = ID3('/some/file/moxy.mp3') print id3info id3info['TITLE'] = "Green Eggs and Ham" id3info['ARTIST'] = "Moxy Früvous" for k, v in id3info.items(): print k, ":", v except InvalidTagError, message: print "Invalid ID3 tag:", message
I have written another small example program, id3-tagger.py, which can print out the ID3 tags, formatted nicely, of all the files specified as arguments to the program. It can also set any field on the MP3 file, including the genre field, which can be set either by number or by name. It's included in the main distribution.
Debian GNU/Linux packages of ID3.py are available in the main Debian distribution.
Jeff Abbott has kindly provided some RPMs. (You can also get the source RPMs.)