[mythtv] Heads up: Smart playlists in MythMusic

Joseph A. Caputo jcaputo1 at comcast.net
Mon Jan 26 15:56:55 EST 2004


On Monday 26 January 2004 14:41, Kevin Kuphal wrote:
> Just a heads up that I should be submitting a patch soon that adds
> basic backend smart playlist support.  That is, right now, there is
> no GUI to configure it but you can edit the playlist entries in the
> DB to configure.
>
> Right now a list is defined in place of the comma delimited list of
> song Ids in the musicplaylist table like:
>
> smart:[any|all]:[field],[operand],[result];[...]
>
> any|all: Either any or all depending on whether you want all
> conditions met or any condition
> field: any field from the musicmetadata table
> operand: any valid SQL operator like =, <, >, LIKE, etc.
> result: the value to test against.  Text must be quoted.
>
> So
>
> smart:all:artist,=,"Fuel";playcount,>,1
>
> Would generate a playlist at selection time with this SQL:
>
> SELECT intid FROM musicmetadata WHERE artist = "Fuel" AND playcount >
> 1;
>
> I have to do some more testing but it seems to work so far.
>
> Kevin

Why the need for all the commas in the database?  Why not just store the 
SQL query, starting with everything after 'WHERE'?  So, 
"smart:all:artist,=,"Fuel";playcount,>,1" becomes "smart:artist = 
'Fuel' AND playcount > 1"

This way it's really easy for anybody hand-editing the database, and a 
GUI to construct simple playlist/queries shouldn't be that difficult.  
I'd model it on the common GUI interface for building mail filters.  
Basically you get a 3-part entry form:  a combo list with the column 
names, a combo or lineedit with an operator, and a combo or lineedit 
with the match value (combo is good for picking exact matches, lineedit 
is good for <,>, and LIKE).  Use a checkbox for the any/all, which will 
determine whether the query uses AND or OR.  Then buttons at the bottom 
will add/remove conditions.

I suppose now that I've suggested all this, I should probably put my 
code where my mouth is and write the GUI, hmmm?  I'll volunteer if you 
like, but I can't promise any kind of delivery schedule :-)

-JAC



More information about the mythtv-dev mailing list