demo program: Amarok Constraint Tree (for dynamic playlists)
Soren Harward
stharward at gmail.com
Thu Aug 28 14:39:53 UTC 2008
Within the last couple of weeks, some of you have asked questions and
made comments about the current state of Dynamic/Smart Playlists in
A2. Daniel Jones has done some really good work on the back end and
put together an awesome (and unique to Amarok) dynamic solver system
which powers the smart playlists. The new solver has necessitated
some major changes on the front end, and the transition hasn't been
totally smooth; from the user's perspective, some significant
functionality has been lost between the Smart Playlists of A1.4 and
the Biases A2.
I've put together a small demo which shows how the functionality of
A1.4 can be brought into the dynamic solver system A2. The Smart
Playlists of A1.4 operate with a system of strict binary "conditions":
a track either matches a condition, or it does not. These conditions
worked fine for A1.4, but limit the usefulness of the fuzzy logic in
the new dynamic solver. I have opted to call the new restrictions
"constraints"; for example, "3 stars or higher" is a constraint. A
constraint applies to a playlist (ie, a set of tracks), and is used to
determine how well that playlist satisfies the constraint. Given the
">3 stars constraint", a playlist composed entirely of 4-star songs
will have a 100% satisfaction value, whereas a playlist of mostly
2-star songs might have a 23% satisfaction value. Constraints can be
combined into "match any constraint" or "match all constraints" groups
(analogous to boolean OR and boolean AND respectively), just as they
can in A1.4; this is a noticeably missing feature in A2. And for what
represents a major improvement over all versions of Amarok, the groups
are recursive, which allows creation of a constraint tree, the size
and depth of which is limited only by system resources. Simple
constraint trees can be 100% satisfied, but more complicated trees can
be solved to generate the best possible playlist. Specifying "I want
songs from the mid-90s with ratings >=4 stars from artists like The
Beastie Boys or The Roots or Public Enemy, and I want no more than 80
minutes of music (to fit on a CD) with no repeat artists" is entirely
possible with a constraint tree, and actually generating the list is
possible with the solver.
The source code for the demo is available here:
http://www.mandy-and-soren.org/misc_files/amarok-constraint-tree-test.tar.bz2
It should build with just "qmake; make". You'll need to copy your
collection.db into the current directory so that it actually has some
data to work with. Right now, only one type of constraint is
implemented, though it's the "Global Match" constraint that is present
in A1.4. Please send me bug reports, suggestions, comments, etc.
--
Soren Harward
More information about the Amarok
mailing list