Reply To: Playlist Wizard

#3763
rpedde
Participant

nice…

as far as loading a playlist — what if there was a way to retrieve a particular playlist not just as text, but the parse tree as represented in JSON? Then you could just eval it, and set dropdowns based on the returned object.

Something like:

{“rootnode”: {
“left”: {
“expression” : {
“field” : “genre”,
“optype” : “string”,
“notflag” : “0”,
“operator” : “includes”,
“value” : “rock”
}},
“optype” : “logical”,
“operator” : “and”,
“right” : {
“expression” {
“field” : “year”,
“optype” : “int”,
“notflag” : “0”,
“operator” : “=”,
“value” : “1980”
}}
}

which would be “(genre includes “rock”) and (year = 1980)”

Not sure if that’s all balanced and all, but you get the idea. Basically every node has an optype, which is logical, string, int or date, logicals are ands or ors, with a right and left node. string int and date are expressions with field, operator and value, with a boolean for not.

Probably pretty trivial to emit from mt-daapd… I have to build the parse tree to emit sql anyway, could just as easily make it drop the parse tree as JSON.

Let me know if you think it would be helpful.

— Ron