[ogg-dev] Extracting Ogg metadata from File-like python objects

Salim Fadhley salimfadhley at gmail.com
Sun Jun 19 15:13:15 PDT 2005

Dear Ogg-dev list;

I'm having some difficulty with the python libraries for extracting
comment/header info out of Ogg files... Would somebody more
experienced than me offer some advice?

I'm working on expanding a Python/Zope product for dealing with MP3
files so that it can also handle a spectrum of other file-formats
including Ogg-Vorbis. Initially we will be storing all of our media
files on a local filesystem which is just fine for the python ogg 
libraries, but soon we will want to start using the ZODB to store all
our data, including media.

The upshot of this is that all our data will be stored as file-like
objects, which implement all of the classic file object's behavior but
have no traditional existence in the file system. In order to read or
write Ogg comment/header information from these files, the only way I
have found is to dump the files to a local file system (on the
server), use the python ogg tools on that file and then re-pickle any
changes back into the database.

We would rather not do that for a number of reasons; firstly it's a
hassle and it seems inelegant. Secondly, the ZODB has some great
features I can use to prevent me from having to unpickle the whole of
a file. If the header info I am interested in is at the start or end
of the file, then the bits in the middle need not be woken up. The
ZODB can do a whole load of cool things that I shall not go into at
this point.

The problem with the python ogg libraries is that they seem to expect
the file in question to be a regular file system file. The libs dont
expect that other kinds of file-like entity may exist, or be simulated
(a very common pythonic idiom).

Does anybody know of an alternative lib or tool that will allow me to
query ogg-files? Ideally this tool would take the form of something
that I can mix-in with any kind of file-like object.

Best regards and invitations to RTFM graciously accepted.


More information about the ogg-dev mailing list