More > JRiver Media Center 27 for Mac

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

(1/4) > >>

henning65:
Problem solved --> see last post
------------------

Hello

I would like to ask for advice on how to set up an expression to calculate a library field.

Step 1
I set up a costume library field PERFORMER to get information (performer) from the audio metadata into the MediaCenter Library.
I designed a new library field PERFORMER to get the multi values from audio files. (this works - I can see the data in the new generated library field PERFORMER). The data are multi-value. The different data are separated by ";". The orchestra performer is highlighted by an extension "(orchestra)".

Step 2
I try to extract the names of performing orchestras from the new created library field PERFORMER. I have problems to trim the data and delete all data not related to the orchestra. To set up the calculation I do only have the information "orchestra" and the seperator ";"

I do need help to set up the expression.
I would be glad if someone could help.

With regards

wer:
Show the expressions you have written so far. Also show the input, and the exact output you desire.

Also, you've been using the wrong word. It's not a "costume" field, it's a "custom" field.  The two words have totally different meanings in English.

henning65:
@wer: thanks for helping!

I started to work on the expression, but failed. There is not really anything to start working on.

I try to make it as transparent as possible, what I try to achieve:

It's about classical music, and the file multi value metadata field "performer" (FLAC). Please find enclosed a picture of on track, showing the different performers. The picture is taken from a MusicBrainz Picard window: MP Picard is a software which can perform tagging based on the MusicBrainz database.

I was able to define a simple JR MeciaCenter Library field "PERFORMER" to be populated with the values from the file metadata field "performer". Please see picture two taken from the tags as they show up in JR MediaCenter.

The library field "PERFORMER" now has the relevant information (the fact, that there is an orchestra performing AND the name of the orchestra) but beside that other content in the "PERFORMER" library field, which is not relevant for now.

For the custom library field ORCHESTRA:
IF the track without an orchestra, the field should be empty.
IF the track has an orchestra listed in the "PERFORMER" library field, the name of the orchestra should be calculated.

EXCEMPLE:
If the track has the PERFORMER field information:
Alison Browner (alto vocals);Chorus Musicus Köln (choir vocals);Wilfried Jochens (tenor vocals);Markus Schäfer (tenor vocals);Angela Kazimierczuk (soprano vocals);Peter Lika (bass vocals);Franz-Josef Selig (bass vocals);Das Neue Orchester (orchestra)

than the ORCHESTRA field should have: "Das Neue Orchester"

The problem: the number of values in the multi value field performer varies from track to track. Also the position of the orchestra in the list of values can be different (not always at the end of the list). Also the name of the orchestra is different from album to album...

As posted in my first post: To set up the calculation I do only have the information "orchestra" and the seperator ";"
Somehow - I guess - the calculation must work like: "search for "orchestra" and take all letters 2 letters left from "orchestra" till ";"

Thanks for your help!

Yours

henning65:
Actually - If I learn how to extract the Orchestra Information from the Performer-multi-value field - I could do interesting things with other informations like:
-- special instruments (classical music)
-- other performers like soloists (classical music)
-- search for special vocal performers for audio drama (sorting like for conductors & other artists)

So ... your help is very Wellcome!

wer:

--- Quote from: henning65 on December 20, 2020, 02:09:01 pm ---...
For the custom library field ORCHESTRA:
IF the track without an orchestra, the field should be empty.
IF the track has an orchestra listed in the "PERFORMER" library field, the name of the orchestra should be calculated.

EXCEMPLE:
If the track has the PERFORMER field information:
Alison Browner (alto vocals);Chorus Musicus Köln (choir vocals);Wilfried Jochens (tenor vocals);Markus Schäfer (tenor vocals);Angela Kazimierczuk (soprano vocals);Peter Lika (bass vocals);Franz-Josef Selig (bass vocals);Das Neue Orchester (orchestra)

than the ORCHESTRA field should have: "Das Neue Orchester"
...

--- End quote ---

Since the number of entries in the string is arbitrary, and the position of the target within the string is also arbitrary, the best way to do this would be to use the newly created regex -2.

This expression will return the value of the orchestra for the input example you gave:

--- Code: ---Regex([Performer],/#([\w\s]+)(?= \([Oo]rchestra\))#/,-2)
--- End code ---

The [Oo] in Orchestra will match whether the word is capitalized or not.

This code is a good regular expression and it works. I do not at the moment have access to a copy of MC to test, so I can't verify if MC's idiosyncratic implementation of regular expressions can digest this.  If it can't, you can either work it out for yourself or perhaps Zybex will happen along and give you any necessary correction.

You can learn about using Regex with MC here:
https://wiki.jriver.com/index.php/String_Manipulation_Functions#Regex

Navigation

[0] Message Index

[#] Next page

Go to full version