TagPy

TagPy

TagPy is a set of Python bindings for Scott Wheeler's TagLib. It builds upon Boost.Python, a wrapper generation library which is part of the Boost set of C++ libraries [3].

Just like TagLib, TagPy can:

  • read and write ID3 tags of version 1 and 2, with many supported frame types for version 2 (in MPEG Layer 2 and MPEG Layer 3, FLAC and MPC),
  • access Xiph Comments in Ogg Vorbis Files and Ogg Flac Files,
  • access APE tags in Musepack and MP3 files.

All these features have their own specific interfaces, but TagLib's generic tag reading and writing mechanism is also supported. It comes with a bunch of examples.

TagPy is maintained in its git repository

Download

TagPy 0.94.1

Responding to a patch from Bill Nottingham, I've uploaded TagPy 0.94.1. It fixes building TagPy against TagLib 1.5 and also fixes a mis-wrap of the clear method of the Map type.

In case you were wondering, 0.94 was a dud, but by the time I realized that, I had already uploaded the tarball to the Python Package Index, which made it unchangeable. :(

Additionally, I've decided to only upload new releases of TagPy to its page in the Python Package Index. Easier maintenance, yay! :)

TagPy 0.93

I've pushed out yet another version of TagPy. This time it is to mop up after some rather unhelpful default in TagLib. That is, unless you have the magic lines:

import tagpy.id3v2 as id3v2
id3v2.FrameFactory.instance().setDefaultTextEncoding(tagpy.StringType.UTF8)

in your code, the generic API tag.artist = u"*some funky unicode string*" will write Unicode tags as Latin1 if the previous ID3v2 tag was also Latin1-encoded. This will of course destroy your carefully crafted unicode string. Therefore I urge all users to include these lines in their code, in order to avoid such trouble.

All that's new in 0.93 is the wrappers that make this call possible.

I tought about making the above code the default for TagPy, but I wasn't sure whether that was the right thing to do, seeing as how this default would deviate from TagLib.

TagPy 0.92 released

In order to fix Debian bug #438556 (a crasher that made almost all of the ID3v2 infrastructure useless), I have just release version 0.92 of tagpy. Go get it while it's hot.

Back in Debian

So after madman is currently orphaned in Debian and might get kicked out of the archive along with xmms kicking the bucket, I just noticed that one of my newer pieces of code made it into Debian: tagpy! :) That's awesome.

To everybody who is holding their breath waiting for a madman update: I still use madman for my own music managing needs, as it still (surprise) is exactly what I want in a music manager. But I simply don't have enough time for serious maintenance. I might switch it to audacious in the near future to keep it working for me, but I'm not promising extensive new features...

Version 0.91 of TagPy is out

I've just released version 0.91 of TagPy. Besides some minor fixes, the biggest change is that you don't say any more

tag.setArtist("Fat Boy Slim")

Instead, the (IMO) much more pythonic

tag.artist = "Fat Boy Slim"

is now where it's at. Reading these attributes (and just these) is also changed from tag.artist() to tag.artist. I repeat, this only affects

  • Tag.title
  • Tag.artist
  • Tag.album
  • Tag.genre
  • Tag.year
  • Tag.track
  • AudioProperties.length
  • AudioProperties.bitrate
  • AudioProperties.sampleRate
  • AudioProperties.channels

Since these are so frequent, I saw a compelling reason to change them. Everything else in the API will remain as close as possible to TagLib's C++ conventions.

Sorry for the source-incompatible change, it will not happen again.

Enjoy.

Initial fixes

I have just released Version 0.90.1 of TagPy to fix a few build hiccups that were reported. Keep up the good work! Additionally, and as a cool benefit of me using Drupal for these pages, you can subscribe to the TagPy RSS feed. :)

And of course you may download the new version from the TagPy home page.