INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How to use the 'Mix Modifier'  (Read 3737 times)

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
How to use the 'Mix Modifier'
« on: November 19, 2017, 12:29:27 pm »

I would like to use the 'Mix Modifier' (in "Edit Search > Modify Results") to create file list views (for DLNA), and need help with the expression language...
What "~mix..." string would I need to sort a list of videos by 1. rating (descend.), 2. number of plays (ascend.), and 3. random order? (In other words: "Best & least played movies first, identical values sorted randomly.")

For example: A list of 500 videos (media type 'movie') has 50 items rated '5 stars', 200 x rated '4 stars', the rest 3 or no stars, and each group has subsets of 0,1,2,3... etc. 'number of plays'.
The output list should then appear like (from top to bottom): 50 x '5 stars' videos, sorted by 'number of plays', each subset in random order. The next group, 200 x '4 stars' movies, again sorted by number of plays, then random, and so on.

I have tried this: "~mix=500,{~sort=[Rating]-d,[Number Plays],[Random]}", but doesn't have the desired effect (highest ratings don't appear on top).

Can anybody help? Thank you in advance!
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #1 on: November 19, 2017, 02:33:35 pm »

~Mix returns a shuffled list.
The general idea is that you can set multiple searches, and specify either a percentage or quantity of tracks that must be included in the mix. It then picks the files based on the criteria you have set, and mixes them all up, to give you... a mix :)

I'll have a think for a while and see if I have a eureka moment that helps you attain your goal, but I'm already thinking that if it's even possible, it's going to involve some merging of separate lists....

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #2 on: November 19, 2017, 02:45:17 pm »

Thanks Marko. Another question seems to be, whether a 'Mix' modifier can combine & apply different sorting criteria in specific order (such as by 1. Rating, 2. Number Plays, 3. Random) on the same list... Or can any other search feature do this?

Add.: Just tried this syntax: "~mix=3000,~sort=[Rating]-d,~sort=[Number Plays],~sort=[Last Played]-d,~sort=[Random]", adding '~sort' for each criterion, but to no avail...
BTW, should any portions be enclosed in curved brackets {''}, and what do these do?

Add. #2: According to the Wiki "Search Language" page, '~mix' only works on a specified number 'n' (or percentage) of files for each criterion, is that the clue?
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #3 on: November 19, 2017, 03:32:33 pm »

They separate searches...

~mix=500,50%{[Media Type]=[Video] ~sort=[Rating]-d,[Number Plays]},50%{[Media Type]=[Video] ~sort=[Rating],[Number Plays]-d}

Should give you 250 files from the first search, and 250 files from the second search, all shuffled.
I've got some good links for ~mix at home. I'll post them when I get there if no-one's done so before that.

In the meantime, perhaps try experimenting with sorting the final mix list by applying sort rules afterwards... Something like...
~mix=500,50%{[Media Type]=[Video] ~sort=[Rating]-d,[Number Plays]},50%{[Media Type]=[Video] ~sort=[Rating],[Number Plays]-d} ~sort=[Rating],[Number Plays]-d

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #4 on: November 19, 2017, 03:48:49 pm »

They separate searches...

~mix=500,50%{[Media Type]=[Video] ~sort=[Rating]-d,[Number Plays]},50%{[Media Type]=[Video] ~sort=[Rating],[Number Plays]-d}

Thanks, that should be a good starting point. Can I omitt "[Media Type]=[Video]" if the parent view category already specifies "[Media Subtype]=[Movie]"? (This is a DLNA only option as filters can be specified both for 'category' and 'library item'.)
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #5 on: November 20, 2017, 01:02:24 am »

I'm not sure as I have zero experience with DNLA. Try it and see?

Here's a short thread showing ~Mix's first introduction (explains the curly braces)
https://yabb.jriver.com/interact/index.php?topic=24288.msg169446;topicseen#msg169446

and here's a great example showing just how complex you can get if you fancy... I used this to build a ~mix that suited me that produced some great results.
http://yabb.jriver.com/interact/index.php?topic=29940.msg206134#msg206134

You'll note that in my blind assistance earlier, I missed out the required commas (now corrected) after specifying the percentages.

-marko

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #6 on: November 20, 2017, 10:27:47 am »

Thanks for all your effort Marko! In the meantime I have tried a number of ~mix variations but none had the desired effect... For example, how about this one:

~mix=800,25%,{[Rating]=5 ~sort=[Number Plays] ~%=100 ~sort=random},25%,{[Rating]=4 ~sort=[Number Plays] ~%=100 ~sort=random},25%,{[Rating]=3 ~sort=[Number Plays] ~%=100 ~sort=random},25%,{[Rating]=0 ~sort=[Number Plays] ~%=100 ~sort=random}

Assuming here that "~%=100 ~sort=random" would apply all filtering and sorting criteria to the entire sub goup (eg. to '5 stars' only). I even added '~sort=' after each criteria, just to be sure, and copied the "~%=..." bit from the wiki, only guessing what it does... Can you tell better?

Another, simpler version was:

~mix=800,25%,{[Rating]=5 ~sort=[Number Plays],[Random]},25%,{[Rating]=4 ~sort=[Number Plays],[Random]},25%,{[Rating]=3 ~sort=[Number Plays],[Random]},25%,{[Rating]=0 ~sort=[Number Plays],[Random]}

Anyway, despite all my curly braces, either output was a mess -- with no 5 star ratings on top, but only 'random' sorting actually in effect!

Maybe the modifier simply does not support combinations of search criteria & random sorting within sub groups, what do you think?
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: How to use the 'Mix Modifier'
« Reply #7 on: November 20, 2017, 04:32:37 pm »

I don't know this, but I would guess it's read left to right, so that last sort would be the one

Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #8 on: November 20, 2017, 05:31:21 pm »

Imagine each of the searches inside the curly braces as an independent search...

MC performs the search, applies the specified sorting, takes the specified number of files from that list, adds them to the mix, discards the rest and moves on to the next search... and so on until it's done. Then it shuffles the whole mix result.

So you *should* have the the files you want, just not in the right order, so you would apply an extra sort rule that is applied once ~mix has completed.
If you can't get the order you want from a regular sort rule, then I don't think the goal is attainable.

-marko

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #9 on: November 20, 2017, 07:57:31 pm »

Imagine each of the searches inside the curly braces as an independent search...

Yes, I did get that part (still a nice explanation ;-)... All I need now is a ~mix string that gets anywhere close to my initial idea...
The 2nd of the strings posted above didn't work, because 'Random' cannot be combined with any other sorting (needs to be added to each search as you suggest)...
Still I'm wondering what '~%=' means, and if it applies to the previous or subsequent strings?
And in terms of notation, should it read '~sort=random', or in brackets as '~sort=[Random]'? I found both examples...
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #10 on: November 21, 2017, 03:13:36 am »

From the wiki... (https://wiki.jriver.com/index.php/Search_Language)

Quote
~%=num    Limits the set of files to a maximum of num percent of the total possible.

Example: Randomly select and return 50% of the files imported into Media Center within the last week:

[Date Imported]=<1w ~%=50
So, if you set that to say, ~%=50, it would limit the results to ˝ the available files, thus reducing the number of files ~mix has available to pick from in that particular subset of the ~mix rule.

From this, you should see that ~%=100 is redundancy as all files are presented by default anyway.

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #11 on: November 21, 2017, 03:31:26 am »

Following on from the above:
This ~mix rule...
Quote
~mix=800,25%,{[Rating]=5 ~sort=[Number Plays] ~%=100 ~sort=random},25%,{[Rating]=4 ~sort=[Number Plays] ~%=100 ~sort=random},25%,{[Rating]=3 ~sort=[Number Plays] ~%=100 ~sort=random},25%,{[Rating]=0 ~sort=[Number Plays] ~%=100 ~sort=random}

and this commentary:
Quote
Assuming here that "~%=100 ~sort=random" would apply all filtering and sorting criteria to the entire sub goup (eg. to '5 stars' only). I even added '~sort=' after each criteria, just to be sure, and copied the "~%=..." bit from the wiki, only guessing what it does... Can you tell better?

Suggest some confusion still exists...
Quote
Assuming here that "~%=100 ~sort=random" would apply all filtering and sorting criteria to the entire sub goup (eg. to '5 stars' only).
You are correct. That's exactly what it does. It then presents that resultant sub group of files to the ~mix function, which takes the specified number of files from it, 200 in this case (25% of 800), discards all the rest, and moves on to the next sub group search.

When it has finished gathering files from all the sub groups, it then shuffles everything it has gathered and presents that to you as your "Mix"...
You cannot overide that final shuffle. All you can do is specify sort rules that are applied to the entire ~mix result

The sorting you specify in each of the sub group search applies only to that sub group search, and only sorts the files prior to the mix function making its selection from that search result. Once ~mix has picked its files from that list, any sorting specified has now done its job and is never revisited.


andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #12 on: November 21, 2017, 02:29:57 pm »

Thank you so much again for the extensive feedback! I have now tried this new ~mix (removing the % ratio and square brackets from 'Random'), but to no success -- high ratings don't appear on top, as before:

~mix=800,25%,{[Rating]=5 ~sort=[Number Plays] ~sort=Random},25%,{[Rating]=4 ~sort=[Number Plays] ~sort=Random},25%,{[Rating]=3 ~sort=[Number Plays] ~sort=Random},25%,{[Rating]=0 ~sort=[Number Plays] ~sort=Random}

What I realized though is 'random', not being a library field (no 'value') is processed differently than all other criteria (with field names written in square brackets). All still assuming that each (curly braced) sub group can be internally sorted by random, before the next group begins... But...

Quote
When it has finished ... it then shuffles everything it has gathered and presents that to you as your "Mix"... You cannot overide that final shuffle. All you can do is specify sort rules that are applied to the entire ~mix result

This sounds like any sub group sorting is overridden by a "final shuffle" (=random sorting), but I guess you refer to sub groups -- otherwise there's no point in sorting group results anyway, if ~mix will shuffle them all up afterwards... Did I get this wrong?

Anyway, I'll forget about the random sorting for now, and simply 'adopt, adapt and improve' one of the presets from the 'Smartlists' wiki, such as:
~mix=800,25%,{[Rating]=>4 ~sort=[Number Plays],[Last Played]},25%,{[Rating]=>3 ~sort=[Number Plays],[Last Played]},25%,{[Rating]==3 ~sort=[Number Plays],[Last Played]},25%,{[Rating]=<3 ~sort=[Number Plays],[Last Played]}
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #13 on: November 21, 2017, 04:10:44 pm »

you've got it. I think one last try on the sorting...

Being able to specify a sort in one of the searches for the ~mix opens up quite a few possibilities for us... fx...

If you say "I want a mix of 40 tracks, 20 of which will be least played '4 star' tracks, and the other 20 will be 5 star tracks I've not listened to in ages"

~Mix=40,20,{[rating]=[4] ~sort=[number plays]},20,{[rating]=[5] ~sort=[last played]}

~Mix will perform the first search, take the first twenty tracks and add them to the mix, then the same with the second search.
Then it will shuffle them and present your mix to you.

This mix will perpetually evolve as [number plays] and [last played] update in your library over time.
The ability to apply sorting in the component searches allows us some control over the the files that ~mix will add to the list, and that is as far as it goes.

If I understand you correctly, you were expecting that ~mix would process each component search in turn, giving you a single list that is a linear list of the component searches, complete with specified sorting. If I'm right, I can see why you would expect that, but unfortunately, it was never intended to work like that. The end result of ~mix has always been a shuffled list of files derived from component searches as complicated or as simple as you desire.

I'm up to my neck in Real Life™ at the moment so I've still not looked at how close you could get by sorting after the fact, though my gut is telling "not very close".
I also wondered what would happen if you made individual lists for each 'block' you want, with a final smartlist that combines them all. Again though, without testing that, I'm not sure if any kind of default sorting would kick in, which had me further thinking, could we use the ~seq function to preserve the file order as the final list is built.... bet you could :)

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #14 on: November 21, 2017, 04:55:57 pm »

Sorry, but the key question to me remains (to quote myself ;-)...:
Quote
if ~mix will 'shuffle' them all up afterwards, there's no point in sorting group results anyway

So is 'shuffle' equivalent to 'random' (as I believe), or just another word for 'compile' results (not randomly, unless specified for subsets or all), into a final list?
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9165
Re: How to use the 'Mix Modifier'
« Reply #15 on: November 21, 2017, 05:09:10 pm »

"Shuffle" and ~sort=random are one and the same.

The point of sorting in the component searches is that when you specify how many files mix is to extract from a given component, it takes them from the top, so, if you sort by number plays, it will always be picking from least played, and as the least played get played more, new files top the 'least played' list and are subsequently picked by ~mix, thus ensuring that the mix you play is always fresh.

The sort rules in each component search affect the files mix can pick from, not the final mix list.

andrewberg

  • Galactic Citizen
  • ****
  • Posts: 418
Re: How to use the 'Mix Modifier'
« Reply #16 on: November 21, 2017, 06:23:56 pm »

So by all we said so far, the following mix should get fairly close to my intention... Only it doesn't:

~mix=800,25%,{[Rating]=>4 ~sort=[Number Plays],[Last Played]},25%,{[Rating]=>3 ~sort=[Number Plays],[Last Played]},25%,{[Rating]==3 ~sort=[Number Plays],[Last Played]},25%,{[Rating]=<3 ~sort=[Number Plays],[Last Played]} ~nodup=[Titel]**

Instead, (even without random sorting involved... ;-) it gives me all kinds of ratings at about any place in the list, on top, in the middle and elsewhere... All I can confirm is a certain accumulation of 'less/least played' files on top... So I guess that ~mix will in fact 'shuffle up' results after all, regardless of 'random', while other sorting criteria are merely 'preferred', but not necessarily presented first.

** The '~nodup=[Titel]'* bit is to avoid duplicate titles, which random sortings tend to present as I browse file lists page-wise on my DLNA-TV... (*curiously, the German word 'Titel' is used here, since '~nodup=' is a Search Wizard function, 'localized' by MC for our convenience... ;-)
Which takes me to another issue -- the main reason I wanted to use ~mix was to combine 'random' sorting with other filtering criteria. But for all I can see so far, this just doesn't work. The only example for this I could find in the Smartlists wiki, presumably tried & tested by the author, uses the '~%=n ~sort=random' modifier within component searches (as I tried at 100% in one of my mixes, hoping that would randomly sort the entire sub group, but it didn't).

I'll keep testing about some more, and eventually post any successful mixes here... ;-)
Logged
"To be is to do" (Socrates) - "To do is to be" (Sartre) - "Do be do be do" (Sinatra)
Pages: [1]   Go Up