Monday 19 January 2004

CD-ROM Access in Python

Quite some time ago I had the idea of writing a Python program to access the CDDB. This didn’t get very far, but the code samples I came up with might be useful to someone else.

If you’re looking for other software like this, Ben Gertzfield has his own CDDB modules for Python.

There are three files for download here:

  • is a small module to calculate the CDDB ID for a CD-ROM, given the track lengths.
  • is some example code that uses the ioctl functions in Python to retrieve the track lengths from a CD-ROM, at least under x86 Linux.
  • is an automatically generated file from the Linux cdrom.h header, that provides constants needed by