Page 1 of 1
| Message |
is there a way to add criteras to a musicselection through script?
AFAIK, no.
Regards,
Chris
Thanks, yupp, thought so. Hopefully something like that shows up with one of the next updates.
Hi spexer,
spexer wrote:
> is there a way to add criteras to a
> musicselection through script?
Yes there is. But you'd better not be afraid of some programming...
Look for sample code in my Touch Blue skin, the module
musicsearch.sj. It can construct the SQL from a musicsearch, after which you can add SQL clauses to it and set it up as a new SQL based musicsearch. The good news for this is you can use my module 99% out of the box for this purpose.
Alternatively you can use script to modify the musicsearch in such a way that is still compatible with the musicsearch GUI setup (and not just SQL based like above).
However from a programming viewpoint this might be more complicated, it depends on your exact requirements. For instance just creating a year-based search where you can only add extra years in script is less hard than writing something which could add anything the GUI could.
Have a look at the MusicSearchSet() function in the module to see the sort of construct you have to build to create a valid musicsearch entry.
SilverEagle
Thanks for the answer SilverE. I doubt I will have the skillset requiered but I'll have a look and try to make something out of it!
Oki, as I though I will have a hard time doing anything with this although I will try... my I ask you,if it would be possible to use preset musicselections as criteras aswell? If I load one, genre=pop (then the script saves this info to another selection)after that I load another one, year=1960-1969, and it saves that info to the same selection. I guess it should work, huh?
Me I will have to try learn the basics of programmning... ![]()
spexer wrote:
> it would be possible to use preset
> musicselections as criteras aswell?
> If I load
> one, genre=pop (then the script saves this info
> to another selection)after that I load another
> one, year=1960-1969, and it saves that info to
> the same selection. I guess it should work, huh?
Well, first we have doublecheck our terminology:
A musicselection is a single entry in the list you get when you press ctrl-F. A default for instance is 70's music.
Each musicselection consists of one or more criteria. The default musicselection "Top 20" for instance consists of two criteria: "play count > 1" and "limit result to 20 tracks most often played".
The first field in each criteria line is a drop down list with all possible criteriatypes (from 'title/artist/album' to 'limit result to').
As you can see there is no criteriatype 'music selection', meaning you can not build nested musicselections where a criteria is specified as another music selection. This does not change using scripting.
What you CAN do is copy the criteria of music selections to other msuic selections. Without SQL this is limited, as AND/OR cannot be nested. This is no problem for your very basic example (precisely one criteria for each selection) but it get impossible fast. Take for instance these music selections:
A) match all criteria: year=1970 and genre=bluegrass
B) match all criteria: year=1980 and genre=country
Now when you want to combine them you definitely want to OR them, AND-ing makes no sense as the intersection would by definition be empty. But Silverjuke does not make this possible: you can only 'match all criteria' (=AND) or 'match any criteria' (=OR).
So you are quite limited in your options and cannot create a satisfactory combinational selection using the GUI (or scripting).
The alternative is using SQL. Change both music selections to SQL and they read:
A) (year=1971 and genrename='bluegrass')
B) (year=1980 and genrename='country')
Combining is as simple as creating a single SQL selection with
((year=1971 and genrename='bluegrass') or (year=1980 and genrename='country'))
> Me I will have to try learn the basics of
> programmning...
I'm afraid it needs a bit more than basics. If you are really new to programming (and not just Silverjuke scripting) I think you might consider starting with a few challenges a bit smaller in scope to get a feel for it all.
SilverEagle
Yes, prob. I am way beyond my skills in this.
Still this is what I would like to acomplish:
A Combining of SQLs like this:
(LEVENSTHEIN(genrename, 'pop')==1 and (year>=1990 AND year<=2000)) OR (LEVENSTHEIN(genrename, 'rock')==1 and (year>=1990 AND year<=2000))
Step 1: SQL Sets Year range (or any other "and" alternitive that makes sense) for all the rest of the selections.
Step 2: I select (a function sets), genre pop --> script creates a sql expression of step 2+1, then I can select another genre like rock, then script adds this to the SQL ... however my guess this is this is hard thing to do..
As you point out "As you can see there is no criteriatype 'music selection', meaning you can not build nested musicselections where a criteria is specified as another music selection. This does not change using scripting." yes that would have been the easy way that I was hoping for....
spexer wrote:
> Step 1: SQL Sets Year range (or any other
> "and" alternitive that makes sense) for
> all the rest of the selections.
> Step 2: I select (a function sets), genre pop
> --> script creates a sql expression of step
> 2+1, then I can select another genre like rock,
> then script adds this to the SQL ... however my
> guess this is this is hard thing to do..
Do I understand correctly: is all this just meant to have
A) one selection the user picks from the existing musicsearches
and then
B) a genrelist in a nice layout (see shiruba/100) where the user selects a genre and pressed a button to add this genre to the filter
If you limit it this way it is rather doable (with use of my musicsearch.sj), it will probably get ugly when instead you want all sorts of criteria combined.
SilverEagle
Sorry, for not responding, however I been busy making it work the way I wanted it
Have a look at it if you like, I did some minor changes to your script and now it works the way I wanted it (but wasnt really able to explain to you I think).
Thanks for your help anyway!
http://www.silverjuke.net/forum/topic-3340.html
/spexer