«« More on the Quick Edit Perspective Durham Not Using Java 5 »»
blog header image
Properties Get More Difficult

Properties used to be simple. They used to be just a name and value pair, like these:

firstName = Ryan
lastName = Lowe

You could store these name-value pairs in a Java Map, and get the values using the name as the Map key. Then id3v2 came along and complicated matters. id3v2 has many properties using keys comprised of more than one value.

A simple example is the Comments frame of id3v2 -- frame ID of COM or COMM -- which can exist multiple times in an id3v2 tag as long as the language and description fields are different (Here's a list of all of the id3v2 frame types). Three fields then become the property key -- id, language, description -- and uniquely identify the property. An application like iTunes uses the key:

id=COM
language=English
description="" (blank)

for the "default" comment -- the one that shows up in the UI. Possibly for other language versions of Mac OS X the language changes, I can't be sure about that. It also uses two other comments to store some iTunes-specific values:

id=COM
language=English
description="iTunNORM"

id=COM
language=English
description="iTunes_CDDB_IDs"

WinAmp is lazy and just picks up the first Comment frame instead of looking for the one with the blank description. So the first could be the user-entered comment or one of this iTunes ones with data in it that doesn't make much sense to a user. The spec says that the comments should be sorted by importance.

Maps are handy for storing properties and I want to keep using them. But my property keys are going to have to get a little more complicated to handle these types of properties. I also want to keep it simple for simple situations though -- the Map should still support regular one string names for keys as well. Of course in a Map all of the keys need to be unique.

---

That's not all. The UI has to be able to know what a valid key looks like. To do that I have to be able to describe keys and the elements in them. In the example above valid id and language values come from a known set (ie. enumeration). The UI could display this set as a dropdown box. The description field is a little more free-form and can even be blank.

In other id3v2 properties some of the keys are numbers that have to be within a certain range or cannot be empty. Expressing these restrictions could be a little tricky...

I don't want to get too far ahead of myself but at the same time I don't want to trivialize metadata properties by thinking they are always easy name-value pairs.

It might be nice to start with a basic name-value pair-based GUI for Durham but at some point Durham is going to have to support these "advanced" kinds of properties as well somehow. Hopefully sooner than later because great id3v2 support could really be a killer feature of Durham and the next AudioMan.

I know Roy's definitely been clamoring for great id3v2 support. ;)

Posted at January 11, 2005 at 03:29 PM EST
Last updated January 11, 2005 at 03:29 PM EST
Comments

Yes I have! People like us want to identify what songs we have, however, 99% of the users out there are too lazy to manually update it, thus these id3v1/2 tags are a waste of space and lead to misinformation and illegitimate data listings in your mp3 player, HD, and on P2P apps.

This has to be automated, or atleast intelligent, or else things will stay the same. People are lazy by nature and are not going to give a damn about id3v1/2 tags. It's sad but true. But, we still need to improve it.

I think it's like a phase in digital audio right now. We're in that "damn, we should've automated that metadata update before we the Internet was flooded with a billion mp3s." Oops.

That's pretty much where we stand right now. Lessons learned...and it also doesn't help that the id3v1/2 specs were made unncessarily complex. Like, who in the world uses the "Composer" field when filling out their id3v2 tag?!? The artist is good enough. No need to get cute and fancy.

» Posted by: roy at January 12, 2005 12:20 AM

One thing that I would suggest would be to make a simple "key" class rather than trying to shoehorn strings as keys all the time. If you override the methods like hashcode, equals and toString you can still keep them in sorted data structures easily enough. I just think that long term it would be more flexible.

You may also want to make a key interface so that for any meta data just have to implement that. And that way for specific restrictions like "this has to be a number between 0-255" you can hid that in the implementation.

Just a suggestion... ;-)

» Posted by: Jim at January 12, 2005 09:14 AM

I'll be posting my initial run at the properties stuff soon .... probably in -- ACK! -- UML.

» Posted by: Ryan at January 12, 2005 09:26 AM
Google
 
Search scope: Web ryanlowe.ca