sampsyo/beets — pull request #208 by steinitzu (2013-03-07 00:40:58+00:00)
Title: partial flexattrs

What I've got so far for the flexible attributes.

This is all barely tested and somewhat hacky right now. Just been focusing on getting this functional without breaking anything.

But, attributes for items and albums can be set using `item['pluginname']['key'] = 'value'` . ('pluginname' must be a currently loaded plugin).
I was thinking this could be confusing though. One might expect `item['artist']` to be the same as `item.artist`.

Item attributes are saved to database along with the item through the `Library.store` method.
There is no way to store album attributes at the moment.

Select queries might need a little tweaking, but from my limited testing they seem to work, mixing and matching select clauses over regular fields and special fields, all that.
It gets a little weird though cause the `FieldQuery` objects don't return the full 'WHERE' clause because what the full clause looks like is a bit dependant on whether its `CollectionQuery` uses an 'AND' or 'OR' joiner.
This will be an issue when using a single `FieldQuery` (not part of `CollectionQuery`) to match a flexible attribute field, but I don't know if they are ever used that way but in that case, one solution would be to make the queries aware of their context somehow.

I've barely started touching on this for Albums, the query stuff might need some changes for that to work properly.