Change a tag extracting info from the tag


I'm quite new to Mp3Tag, already read the info pages for creating new actions, but I cannot find a way to change a tag using info that lies within the tag.

For example the Album tag is AlbumName (Rock Collection Vol.8) and I want to convert it to RC08 AlbumName, that is I want to add a prefix RC with he number of the volume with two digits, so that 8->08, but 12->12 remains the same, then erase the last part of the name, all that lies in parentheses.

It would be great if also the discnumber could be changed to 8/20 assuming the whole collection is 20 albums.

So I need to read the number of the Vol. in the Album tag, apply that value to rename the Album and also put thatt value in the discnumber.

Thanks in advanced

I would apply 2 actions (as you want to manipulate 2 fields):

  1. Action of the type "Guess value",
    Source: $regexp(%album%,'(.*) \(.*(\d+).','$1==$2')
    Target string: `%album%==%discnumber%

  2. Action of the type "Format value" for ALBUM
    Format string: RC $num(%discnumber%,2) %album%

How would MP3tag know that this the 8th of 20 discs?

That is a lot of information to move from only one tag that you have shared. Best to ensure the individual tags are already populated, then work from there for changing the current info you have now in that one Album tag.

You mention the total of 20 discs in this collection. Does that already exist in a tag such as TOTALDISCS or something similar to work from? And is the DISCNUMBER tag already filled in as "8"? There is no detail in your example to get the total disc filled in, but for the current disc you could use the Guess Value Action.

A picture is worth a thousand words, a screenshot of all your current tags would help.

Hi, thank you vey much for your response. I implemented it but still have some tiny issues, it just reads the last digit, for example in AlbumName (Rock Collection Vol.11) it will change the discnumber to 1, and therefore when applying the second action it will rename it RC01 AlbumName

I'm trying to decipher the regexp command, but don't understand the last part the $1==$2

The second action works beautifully, thank you thank you

Hi, the 20 total records is a known fact, not something to extract from the tags : It's something more cosmetic than useful :slightly_smiling_face:

Yes, sorry, the .*part was too gready.
$regexp(%album%','(.*) \(.*?(\d+).','$1==$2')

As the regular expression prepares the string from ALBUM to be split, I simply chose a separator this is very unlikely to appear in normal language. The == always looks spectacular nerdy but it is simply a unique separator to make sure that the "guessing" in the action works.

1 Like

Works incredible!

Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.