INTERACT FORUM

More => Old Versions => JRiver Media Center 19 for Windows => Topic started by: mark_h on July 23, 2014, 05:52:50 am

Title: [HOWTO] Generate an EXPANDED superset from a limited subset.
Post by: mark_h on July 23, 2014, 05:52:50 am
One of the things missing in 'vanilla' MC is the ability to EXPAND (ignoring Expand to Full Album) results based on subset of results.  

You can use Playlist 'IS ANY' or Playlist 'IS ALL' but these LIMIT results to the subset.  They cannot be used to EXPAND.

For example, say you have a sublist that returns a single random artist and then you want to expand the results to list ALL albums by the artist.

sublist: ~sort=Random ~n=1

Until variables were added, you could not.

But with variables this is now possible, eg:


(([Media Type]=[audio] [=save(0,v_filter[artist])1]=1) or (playlistid==sublist* [=save(1,v_filter[artist])1]=1)) [=load(v_filter[artist])]=1 ~nodup=[Album],[Artist] ~sort=[Artist]


*reference the sublist above here

(https://dl.dropboxusercontent.com/u/7082504/Media%20Center/EXPAND.JPG)

This will EXPAND the 'sublist' to show ALL albums by [artist]

Note the use of the variable v_filter[artist]

The steps are:

Set v_filter[artist] to 0 for all database entries - ie unflag every entry in the database
Run the sublist and set v_filter[artist] to 1 for all entries found - ie flag any matching entries in the sublist
Output all entries that have v_filter[artist] set to 1 - ie output any entries that match the variable filter

It's the last step that does the expansion.  The [artist] has been captured from the sublist in v_filter and now all [artist] entries will match the variable.

If you now change sublist to somethiing like:

~sort=Random ~nodup=[Album],[Artist] ~n=3

You will get a sublist set containing just three random artists

And the code above will now EXPAND the result to all their albums.

So far, so what? :)

Well, what if you wanted to do something more interesting?  eg,

The sublist now returns 3 random artist entries and you want to EXPAND to show ALL entries from the same YEAR as those in the sublist, regardless of [artist]

Simply change the v_filter[artist] to v_filter[year] and you now get the sublist EXPANDED to include all matching years...

This framework allows you to fundamentally EXPAND upon the way MC's simple file based approach works.  You can set v_filter up to capture anything you like from the sublist and expand the results into a superset.

So, the basic framework is:

(([Media Type]=[audio] [=save(0,v_filter[artist])1]=1) or (playlistid==sublist* [=save(1,v_filter[artist])1]=1)) [=load(v_filter[artist])]=1

* = your sublist

And by changing v_filter and/or adding further rules you can EXPAND(!) upon this as needed.

Enjoy!
Title: Re: [HOWTO] Generate an EXPANDED superset from a limited subset.
Post by: Humbledore on January 01, 2017, 12:12:34 am
mark_h, I tried out your example of how to generate a superset from i limited subset and I really like the solution! :)
However, I am noticing that the sublist expands ONLY if the artist field just contains this single artist. If the artist field contains several artists (separated by semicolon) it will be ignored.
So, how to change the code so that tracks that also contains multiple artists will be included in the expanded album sublist?

Thanks!

EDIT: moved to a new MC 22 for Windows thread.
Title: Re: [HOWTO] Generate an EXPANDED superset from a limited subset.
Post by: mark_h on January 01, 2017, 03:08:06 am
mark_h, I tried out your example of how to generate a superset from i limited subset and I really like the solution! :)
However, I am noticing that the sublist expands ONLY if the artist field just contains this single artist. If the artist field contains several artists (separated by semicolon) it will be ignored.
So, how to change the code so that tracks that also contains multiple artists will be included in the expanded album sublist?

Thanks!

Good question. 

Somehow you need to split that semi-colon delimited list to create separate v_filter[artist] entries.  Not sure that's possible as it would require some sort of loop mechanism to do the work, which doesn't exist in MC.

In my library, ARTIST is only ever a single entry.  If I want to group names I'd use the ARTISTS field.  So one solution would be to reorganise the library into a form that fits what is available from MC's expression language.

Title: Re: [HOWTO] Generate an EXPANDED superset from a limited subset.
Post by: ferday on January 01, 2017, 05:27:13 am
Solution 2 is a regex (maybe) to look for the ; maybe even in the variable

you're on our own to try that one at this time
Title: Re: [HOWTO] Generate an EXPANDED superset from a limited subset.
Post by: mark_h on January 01, 2017, 05:57:10 am
I did consider regex(), but cannot see a way to use it here...

What we'd need to be able to do is break an ARTIST list, eg Yes;Genesis;Rush into component variables, ie

v_artistYes = 1
v_artistGenesis = 1
v_artistRush = 1

And then when doing the comparison, again, check a list against individual variables to look for matches.

Not possible, as far as I can see.

Title: Re: [HOWTO] Generate an EXPANDED superset from a limited subset.
Post by: Humbledore on January 01, 2017, 08:27:15 am
mark_h and ferday, thanks for giving it a try!