Parsing a field...

Get answers about using MediaMonkey 4 for Windows.

Moderator: Gurus

TWKArtist
Posts: 20
Joined: Mon Sep 26, 2011 1:11 pm

Parsing a field...

Post by TWKArtist »

In 'Configuring Directory and Filename Formats' there is no listing for any type of function that will help me to parse out part of a field.

For example, if in my <Artist> field for classical music I have the name: "Copland, Aaron"
what I want to do is to extract the name "Copland" by itself. I can achieve pulling out the name if I use the $Left function hard coded with a number like this: $Left(<Artist>,7) which, of course will give me the desired "Copland."

But to code it flexibly for all instances I need to replace the number (in this case '7') with a formula to parse all characters left of the comma delimiter.

In normal VB script syntax I could use a combination of functions like this:
$Left(<Artist>, $InStr(<Artist>, ",")-1)
which would calculate the position of the comma delimiter (in this case position 8) then subtract one character to leave 7 and then use that number 7 as the argument for the $Left() function -- resulting in the desired return of 'Copland.'

Similarly, if the <Artist> field read "Igor Stravinsky" I can find no way to automatically select the last name (i.e. everything right of the space) either.

Any suggestions on what method I could employ instead of this..?
Or, if not, I would think that adding such functionality to the code base for MediaMonkey would be very desirable.
Lowlander
Posts: 59212
Joined: Sat Sep 06, 2003 5:53 pm

Re: Parsing a field...

Post by Lowlander »

<Artist>, does the trick.
TWKArtist
Posts: 20
Joined: Mon Sep 26, 2011 1:11 pm

Re: Parsing a field...

Post by TWKArtist »

@Lowlander -- Yes, it does -- if I wanted the entire name of the Artist. I want to pull out only the last name from the data that is stored in the field.
Lowlander
Posts: 59212
Joined: Sat Sep 06, 2003 5:53 pm

Re: Parsing a field...

Post by Lowlander »

You can pull any information if there is a delimiter. It will get tricky with space as delimiter. You may want to check out: http://www.mediamonkey.com/forum/viewto ... lit=regexp
TWKArtist
Posts: 20
Joined: Mon Sep 26, 2011 1:11 pm

Re: Parsing a field...

Post by TWKArtist »

@Lowlander -- Thanks, and again I already use the RegExp add-on -- it is great..!

But it cannot help me set the mask in the Options > Playback Rules section for "Summary Rules for individual files...".
As far as I can tell, that is governed by the code syntax that is built-in to mediamonkey and I cannot parse fields like I could using the Reg Exp tool.

>>TimK
Lowlander
Posts: 59212
Joined: Sat Sep 06, 2003 5:53 pm

Re: Parsing a field...

Post by Lowlander »

No, it can just display fields as they're tagged.
Post Reply