Birch Street Computing -

about me

John M is a Linux fan in Lowell, MA.

I work at at a local company writing software. I fool around with Free and Open Source software for fun.

I am an avid Last.fm user.

Python TagLib Bindings with SIP

The Python TagLib Bindings (aka python-taglib-bindings, or p-t-b) is a set of bindings for Python, generated using SIP, for TagLib a library for reading and manipulating audio file (ogg,mp3,etc) tags.

I wrote this set of bindings with two goals in mind. 1) To learn how to write bindings with SIP and 2) to get taglib support in python on a system where I couldn't build the python taglib package from the namingmuse team. Of course, they deserve all the kudos in the world for having stable bindings that are well tested. Mine are not. They might eat your dog or cause your house to collapse. This is very alpha stuff.

The software comes in two components, the sip c++ to python bridge, and a pure python module that provides a pythonic class attribute style api. Neither of which are documented yet :-).

Example

>>> import taglib # python style API
>>> tags = taglib.TagFile( '/path/to/my.mp3' )
>>> tags.artist
'Joe Somebody'
>>> tags.title
'My Rainy Day'
>>> tags.bitrate
192
>>> tags.artist = 'Joe Somebody and The Beatniks'
>>> tags.save() # changes won't be saved to the file unless save() is called

Or, using the C++ API directly

>>> import _taglib
>>> ref = _taglib.FileRef( '/path/to/my.mp3' )
>>> ref.tag().artist()
'Joe Somebody and The Beatniks'
>>> ref.tag().title()
'My Rainy Day'
>>> ref.audioProperties().bitrate()
192

Install

  1. Aquire SIP version 4 (on debain install sip4,python-sip4,python-sip4-dev)

  2. Download python-taglib-bindings

  3. $ python setup.py build

  4. # python setup.py install

Details

Current Version
0.1
Language
Python 2.3+
Dependencies
SIP Bindings Generator (v4)
Downloads
Taglib Bindings (0.1)
Downloads
Type hg clone http://invalid.asynchrono.us/hg/python-taglib-bindings at the command prompt to get a copy of the development source code.
Source Code Web View

Every blog page or article on this site is available under the CC-BY-SA license unless otherwise noted.