INTERACT FORUM
More => Old Versions => JRiver Media Center 19 for Windows => Topic started by: connersw on January 15, 2014, 08:22:24 am
-
I've been using this expression to group by Artist Letters (thanks Mrc):
Regex([Artist], /#^(?:(?:the|an|a) +)?(.)#/,-1)if(Compare(1[R1], >=, 10), 0 - 9, [R1])
It's been working great, but I've started to use the list ability of the Artist field more and discovered a problem. If there are multiple artists, it only uses the first letter of the first artist.
For example: The All Star Band; The Levon Helm Band; My Morning Jacket
The All Star Band, The Levon Helm Band, and My Morning Jacket will all appear under the letter A.
I would like each one to be placed under their own letter (ie A, L, and M). Is that possible?
-
Only to a limited extent.
The problem: MC doesn't have a list-iterator, so you can't grab the first letters of each item in the list generally.
With a more complex regex, that essentially replicates the current pattern and adds more optional cases following a semicolon, you could grab up to the first 9 (MC also limits the number of captures to 9, which I think was a limitation of the previous Microsoft TR1 regular expression library). Of course, more conditional If's will be required too.
If your artists don't change that much, you could use an external script (hint: pscriptor) to populate another field with the results you want, and use that fields instead of Artists.
-
I doubt I would ever have more than 9 Artists in the Field. I'd prefer to use an expression rather than an external script since it is automatic. I would need to remember to run the scriplet every time I imported an Album in order to populate the new Field.
-
Why don't you do it this way, which is as extensible as you want to copy/paste:
Regex([Artist], /#^(?:(?:the|an|a) +)?(.)#/,-1)if(Compare(1[R1], >=, 10), 0 - 9, [R1])/
ifelse(compare(listcount([Artist]), >, 1),
;Regex(listitem([Artist], 1), /#^(?:(?:the|an|a) +)?(.)#/,-1)if(Compare(1[R1], >=, 10), 0 - 9, [R1]))/
ifelse(compare(listcount([Artist]), >, 2),
;Regex(listitem([Artist], 2), /#^(?:(?:the|an|a) +)?(.)#/,-1)if(Compare(1[R1], >=, 10), 0 - 9, [R1]))/
&datatype=[list]
Copy and paste a colored section and change the bold indexes accordingly. 1 is the second list item, 2 is the third, etc.
-
Almost there, but not quite. That places all of them in each letter (ie A has The All Star Band, The Levon Helm Band, and My Morning Jacket, L has The All Star Band, The Levon Helm Band, and My Morning Jacket , and M has The All Star Band, The Levon Helm Band, and My Morning Jacket).
-
if you have a track that has three artists, The All Star Band, The Levon Helm Band, and My Morning Jacket, which single grouping should it go under? It contains three artists.
This is better suited to Panes or Categories where you can create a hierarchy, and you select based on the letter, and are presented with only the item that matched that letter.
-
It should go under all three, but only the Artist for that grouping should be shown.
Example:
A -> The All Star Band -> Track 27
L -> The Levon Helm Band -> Track 27
M -> My Morning Jacket -> Track 27
Right now it shows:
A -> The All Star Band -> Track 27
The Levon Helm Band -> Track 27
My Morning Jacket -> Track 27
L -> The All Star Band -> Track 27
The Levon Helm Band -> Track 27
My Morning Jacket -> Track 27
M -> The All Star Band -> Track 27
The Levon Helm Band -> Track 27
My Morning Jacket -> Track 27
This is better suited to Panes or Categories where you can create a hierarchy, and you select based on the letter, and are presented with only the item that matched that letter.
That is what I'm trying to do.
-
I'm confused. Are we talking about Group By? If not, where?
-
I don't think he knows about the Category Grouping feature...
I'm on my phone right now, so I can't easily explain.
-
I'm aware of the Category Grouping feature, and it does not do it properly either. It automatically groups by Album and doesn't break out the Artists.
-
Try this instead:
ifelse(compare(listcount([Artist]), >, 0),
Regex(listitem([Artist], 0), /#^((?:(?:the|an|a) +)?(.).*)#/,-1)if(Compare(1[R2], >=, 10), 0 - 9, [R2])\[R1])/
ifelse(compare(listcount([Artist]), >, 1),
;Regex(listitem([Artist], 1), /#^((?:(?:the|an|a) +)?(.).*)#/,-1)if(Compare(1[R2], >=, 10), 0 - 9, [R2])\[R1])/
ifelse(compare(listcount([Artist]), >, 2),
;Regex(listitem([Artist], 2), /#^((?:(?:the|an|a) +)?(.).*)#/,-1)if(Compare(1[R2], >=, 10), 0 - 9, [R2])\[R1])/
&datatype=[list]
-
BAM! That's it. Thank you for you patience with me MrC.
-
No sweat. I got confused by the term "group by" in your original post.
I captured the entire Artist name in the RE (as [R1]) to show in the nested level. If you want the artist sans articles, use:
/#^(?:(?:the|an|a) +)?((.).*)#/
as the RE.
-
Ahh....I just figured out why Category Grouping does that and possibly what Glynor was going to explain.
I need to double the Categories. So:
Artist (Grouping Size 1)
Artist
Album
Thanks for bearing with me.
-
Yep, that's it.
(http://glynor.com/img/screenshots/MC19/MC19-Category_Grouping_Example.png)
-
Try this instead:
ifelse(compare(listcount([Artist]), >, 0),
Regex(listitem([Artist], 0), /#^((?:(?:the|an|a) +)?(.).*)#/,-1)if(Compare(1[R2], >=, 10), 0 - 9, [R2])\[R1])/
ifelse(compare(listcount([Artist]), >, 1),
;Regex(listitem([Artist], 1), /#^((?:(?:the|an|a) +)?(.).*)#/,-1)if(Compare(1[R2], >=, 10), 0 - 9, [R2])\[R1])/
ifelse(compare(listcount([Artist]), >, 2),
;Regex(listitem([Artist], 2), /#^((?:(?:the|an|a) +)?(.).*)#/,-1)if(Compare(1[R2], >=, 10), 0 - 9, [R2])\[R1])/
&datatype=[list]
So this is working perfectly, and it doesn't appear to be limited to the first 9. I copy and pasted it out and tested it with up to 15-Artists, and it worked. I prefer it to the Category Grouping feature since it places all numbers in 0-9 instead of individual groups for 1, 2, 3, etc.
However, it places special characters (!, $, &, etc) in their own individual grouping. Category Grouping puts them all in a group called "Others." I would like to do the same thing except have them under * so they are first in the alphabetical listing rather than after O.
Could I trouble you for assistance one more time?
-
Replace [R2] with FormatRange([R2],1,1). This won't place them under *, but will use FormatRange's "(Others)" and its special sorting. You can of course post-replace that by replacing "(Others)" with whatever you want.
-
Perfect--many thanks. (Others) actually works nicely since it will come first alphabetically as opposed to Others in Category Grouping.
-
This works like a charm while using Gizmo! It makes locating an artist so much easier now!! Thanks MrC!