Adding new fields for import & tagging

There are three “non-standard” fields that I have come to rely on in my metadata:


The copyright field is just for that: copyright information (if found). The other two fields I map in my tagging software (puddle tag) to be used as:

wwwsource -> Release Page URL
wwwfileinfo -> License (Creative Commons, Artistic, Public Domain, etc.)

I did not find any plugin(s) that would make it easy to add support for handling these fields. So I’ve turned to the plugin writing documentation to see what it would take to implement these fields. Am I correct in believing the section on extending MediaFile is all I would need to follow to write a plugin that could read/write these fields? By adding these fields to the MediaFile class would they be read and stored by the importer?


Yep, that’s all you need!

Then, do I need to add them as the ID3v2.4 frames? IE:

wwwfileinfo -> WOAF
wwwsource -> WOAS
copyright -> TCOP

And is there some way to alias them? IE, TCOP would be stored under the field name ‘copyright’ so queries would reference copyright instead of TCOP?


I’m not entirely sure what you’re asking, but the way these things work is that you create an internal beets name for your field, which can be anything you want, and describe how to map those onto actual tags for various formats. Needless to say, the mapping for ID3 and for Vorbis Comments is going to be different. But within beets, you only use the internal name.

We are on the same page… It is the mapping of the ID3/Vorbis Comments to the beets name that I am trying to understand… The reason for the confusion is the documentation example uses “foo” for everything (and since I am not as familiar with the internals of beets and mutagen, this isn’t exactly clear). So, here’s the example, modified for one case:

class FooPlugin(BeetsPlugin):
def init(self):
field = mediafile.MediaField(
self.add_media_field(‘license’, field)

Or would I do it like this:

class FooPlugin(BeetsPlugin):
def init(self):
field = mediafile.MediaField(
self.add_media_field(‘license’, field)

Or do I completely misunderstand this mapping?


(Sorry, I forgot to mark the code as pre-formatted so it lost the indentations…)

More like the latter, but if you want to use a non-“TXXX” field for ID3, you’ll need a different StorageStyle. To make this work, I think you might want to spend a little while working with the MediaFile source code to understand what the options are.

So, even if mutagen treats the WXXX fields the same as TXXX fields? For example:

mutagen-inspect d01t08__Cousin_Silas__December_Falling.mp3
– d01t08__Cousin_Silas__December_Falling.mp3

  • MPEG 1 layer 3, 320000 bps (CBR, LAME 3.97.0, -b 320), 44100 Hz, 2 chn, 514.06 seconds (audio/mp3)
    APIC=cover back, (image/jpeg, 2775360 bytes)
    APIC=cover front, (image/jpeg, 2387290 bytes)
    POPM=Windows Media Player 9 Series=0 255/255
    TCOP=CC BY-NC-ND 4.0
    TIT2=December Falling
    TPE1=Cousin Silas
    TPUB=Hortus Conclusus Records
    WOAF=CC BY-NC-ND 4.0

I’m kind of mis-using the WOAF field here (WXXX fields are text fields which are only supposed to contain URL’s, which I hadn’t realized until I dug into the Puddle Tag docs while researching this), but mutagen (and other tools) don’t choke on this misuse as they don’t appear to do any URL validation.

I will dig into the MediaFile source code – but given my surface level understanding of python it’s going to be an uphill struggle for me.