Saturday, February 20, 2010

Mutagen has a well thought out API

So I was working on how uctui was going to be able to read all the different kinds of metadata that a standard music library contained. As far as metadata reading in python, I knew about Mutagen, notably as it's used by Picard to do it's tagging. So I started learning about Mutagen and found that it was quite capable for doing each of the individual file formats metadata quite nicely. So my next problem was getting a function together that would be able to determine which file format was currently being used and then call the proper function on the file to retrieve the metadata. As it turns out, Mutagen itself has an API for this, and already does this. Lastly, I thought I was going to have to get a mapping for each individual metadata format and then unify it into a common format that I could then edit easily. Mutagen has, in the previous file determining function, provided an option that causes the dictionary it returns to be interchangeable no matter what the file, makes it trivial to write a wrapper for use in uctui. Long story short, Mutagen makes it very easy to retrieve and edit metadata on music formats.

No comments:

Post a Comment