More > JRiver Media Center 27 for Mac

Library field and how to trim a field -> get a tex from a multi value field

<< < (2/4) > >>

henning65:
@wer: Thanks for your help. The function works with some - but important - exceptions:
a) Orchestras with a name containing special letters like éèêëâäãîïí cause malfunctions. I guess these special letters are simply not covert by "\w"?
Do you have any idea how to include these letters?

b) Another malfunction results from a wrong assumption I had: I assumed that only one orchestra will be present on a single album. That's wrong - or let's say - the metadata list for some tracks show more than one orchestra. This results in two - in one case even three orchestras populating the library field.

At all I believe a data type "list (semicolon delimited) would suit my goals best. I learned, that other MC library fields (like "conductor") which might have more than one value ("conductor A" and "conductor B), simple list the track under both values. This is most-likely wrong - but the "behavior" of MC is -to my judgement- more user friendly.
For the custom MC library field ORCHESTRA: If two orchestras are found in the library field "PERFORMER", MC generates a view, where the two orchestras are both listed, separated by ";" - actually this is not very user friendly as the idea was to be able to see which albums from a certain orchestra I do have (to listen orchestra focused you may say) - now that's all mixed up again...

I tried to change the MC Library field data type from string to "list (semicolon delimited)":
If I change only the setting for "ORCHESTRA" - not possible - "jumps" back to string.
If I change the setting for "ORCHESTRA" and "PERFORMER": the calculation no longer works (field "ORCHESTRA" empty).


The goal would be
a) include orchestras with "special letter" in name
b) find a way to preserve the data type "list (semicolon delimited) (as only than the different orchestras are separated and listed individually, as they should
I hope the regex function can be used to calculate a list?

I would be happy for any advice.

Have a nice evening.

wer:
You'd better start learning regular expressions. :)  Here's one tutorial; there are dozens.
https://regexone.com/

It's good that you partly understood what \w is for. But \w isn't what matches the string Orchestra; that's the later part. Matching accented characters is a common question.  You should google "regex accented characters" and you will immediately see many posts that give you values to substitute for that part in the match string.  Try plugging some of them in until you get what you want. Hint: [A-Z] will match all uppercase non-accented letters.

Report back here with your successful attempt so others can learn along with you, if you want to contribute to the community.

Regarding the list data type, yes that can be done. It is called type casting. I just helped someone else with this recently.  Adding
--- Code: ---&datatype=[list]
--- End code ---
to any string (like the output of a regex expression) will cause MC to treat the string as a list.

Read this post for an example:
https://yabb.jriver.com/interact/index.php/topic,127840.msg887089.html#msg887089

henning65:
@wer

Thanks!

I ended up adding all non-latin-letters, as I couldn't find an expression capturing all of them - I also had to include "\-"
That's how the expression looks now:

Regex([PERFORMER],/#([\w\s'üýäàáâæãåāéèêëėîïíīìöôòóõœøōßśšÿçćčñńÁÛØ∏ÅÍÏÌÓÙÇflŒÆÄÀÁÂÆÃÅĀÉÈÊËĖÜÛÙÚŪÎÏÍĪÌÖÔÒÓÕŒØŌŚSŠŸÇĆČÑŃ\-]+)(?= \([Oo]rchestra\))#/,-2)&datatype=I wouldn't have been able to get anywhere near without your help - thanks for this.

And I will take up your suggestion and write a little "how to".

If you have some advise on how to make the expression a little more elegante?! - you are Wellcome!

thanks!

Henning

wer:
You mean something like [À-ÿ] ?

Remember my hint. You can use a range of characters.

Also, look at your most recent post. When you post an expression with type casting here on the forum, you have to include it in a code quote (use the # button in the post editor). You'll notice for forum stripped the trailing list cast from your regex. Others reading it will be misled.

But congratulations on getting your first one working!

zybex:
The issue with non-standard chars can be avoided with ListGrep:
listgrep([Performer], /(orchestra)        -> returns "Das Neue Orchester (orchestra)"   (not case sensitive, also matches Orchestra)

Removing the "(orchestra)" part then requires some simpler regex - this should work for you:
regex(listgrep([Performer], /(orchestra), /#(.+) \(#/, 1)

PS: While testing a non-regex method, I found an undocumented "feature"; the replace() function will remove trailing "()" from the result:
replace(listgrep([Performer], /(orchestra), orchestra, )     ->  returns "Das Neue Orchester", where I would have expected "Das Neue Orchester ()"

(Note that this last one is case sensitive, so it will fail with "(Orchestra)")

EDIT: fixed some escape chars, I had used \( instead of /(

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version