Help creating Action to get Composer in Filename

So I have the COMPOSER field filled like this:

Frédéric Chopin (1810–49)

And the TITLE field filled like this:

Polonaise #5 in F-sharp minor, op. 44

How can I create an Action to make the FILENAME field be like this:

01. CHOPIN_ Polonaise #5 in F-sharp minor, op. 44.mp3

So that's TRACK. COMPOSER(surname & caps only)_ TITLE.mp3


use CONVERT > tag to filename, with mask:

$num(%track%,2). %composer%_%title%

But this will put the entire composer name and date in as composer. So you need a method to pull out just the part of the composer name you want. Perhaps someone else can help with that. Plus there is probably a way to tell mp3tag to make all those filename parts all caps, but I'll have to dig deeper for that as I haven't used that option.

Action #1 Actiontype 5: Format value Field ______: _FILENAME Formatstring: $num(%track%,2). $upper($regexp(%composer%,'^[^\s]+\s([^\s]+).*',$1))_%title%

stevehero, that works brilliantly, thanks!

The only problem now is dealing with Composers with three names. So for example "Wolfgang Amadeus Mozart" comes out as "AMADEUS" using that action.

I can create a simple rule for each of these to replace AMADEUS with MOZART, VAN with BEETHOVEN, etc..

But is it possible to build the original action, or add a new one, that would take the third name if there are three? Or take the first name to the left of the year brackets?

Thanks again!

The old action grabs the 2nd word whereas this will grab the last word before the

_ is space
YEAR is 4 digit year
. matches anything any number of times
$ anchors the regexp to the end of the string.


Begin Action Group _FIXED ACTION

Action #1 Actiontype 5: Format value Field ______: _FILENAME Formatstring: $num(%track%,2). $upper($regexp(%composer%,'.+\s([^\s]+)\s+\(\d\d\d\d.*$,$1))_%title%

End Action Group _FIXED ACTION (1 Action)

I actually got a "Syntax Error" with that, but I compared it with the other one & put in a ' after the the second last $

$num(%track%,2). $upper($regexp(%composer%,'.+\s([^\s]+)\s+(\d\d\d\d.*$',$1))_%title%

Not really sure what that does, but it seems to work now!!

Thanks for your help! It's one hell of an Action!

Sometimes that happens when you paste the action into the forum.. It got rid of the $ before the '. Looks like I missed that. Glad you got found the solution.

As regards the ' at the start and end of the expr. I tend to put that in all my $regexp(x,expr,repl)
and even
$regexp(x,'expr','repl') when needs be.

I can't find where it says that in the help but it's good to be aware of that.