Check if it is a multiple disc and tag Album field accordingly with the folder name

Hello! The title is not very clear, sorry.
Anyway...
I wanted to know whether I could simplify the tagging of the album field.
Sometimes it happens that I have multiple albums to tag from the same artist and I need to change the "Album" field so it is the same as the folder name. If this collection includes both single albums and multiple albums, I need to manually select the single album and run this action:

Format "ALBUM": %_directory%
Regular expression "ALBUM": "\d\d\d\d\s" -> ""

Then I have to select the multiple albums and tell MP3 tag not to take the folder name but go up a folder and use that:

Format "ALBUM": %_parent_directory%
Regular expression "ALBUM": "\d\d\d\d\s" -> ""

Is there a way to do this selecting everything and applying a single action? Basically a way to make MP3tag check whether the folder contains a single album or a multiple disc album and act accordingly?

Thank you!

How would you distinct between a "single album" and a "multiple disc album" if you should describe it in words?
What exactly can Mp3tag check for to be sure that one or the other album type exists?

Hi and first of all thank you for your help.

Usually, if it is a multiple disc, it is like this:

  • "YEAR" "ALBUM TITLE"
    |--------"ART FOLDER (if present)
    |--------"CD 1" (sometimes followed by a text, ie: "CD 1 - The original record")
    |--------"CD 2" (sometimes followed by a text, ie: "CD 2 - The new mix")
    |--------"CD 3" (sometimes followed by a text, ie: "CD 3 - Live in Bumblefuck")

etc.

Anyway, Mp3tag already recognizes this to reset disc numbers when applying automatic numbering.

When the album is single, there is no subfolder except often for the art folder. ie:

"YEAR" "ALBUM TITLE"
|- ART FOLDER
|-01 Song title.extension
|-02 Song title.extension
|-03 Song title.extension
|-04 Song title.extension
|-05 Song title.extension
|-06 Song title.extension

etc.

Thanks again.

Does this mean you have a field like DISCTOTAL or TOTALDISCS filled in for all of your files? If so, you can filter for any albums when this field is greater than 1.

How often in the life of your collection will the album have to be renamed?
Honestly, I would filter for the files where _DIRECTORY contains CD plus a number, get the data with Convert>Filename - Tag and a lot of dummys and then filter for those that don't match this pattern and use Convert>tag-Tag for ALBUM.

So try
%_directory% MATCHES "CD\s*\d+"
and
NOT %_directory% MATCHES "CD\s*\d+"

and I bet that all future ALBUM fields will contain the correct data so that it does not have to be imported from the folder name.

Thank you everyone. :slight_smile:

And what did you do in the end?

I think I just will have to keep doing it manually, because I am not quite sure I can create an expression.
Using basic, what I needed was: "IF [multilpe CDs] then DO this, ELSE do this".
The point is that when I rip a CD, I use Easy CD-DA Extractor and it retrieves the informations capitalized in a way I don't like (ie: "The Lamb Lies Down On Broadway" instead of "The lamb lies down on Broadway"), so I rename the folder and apply its name to the tag.
Anyway, thank you all for your help.

Yes.
But this would have become a rather lenghty expression which would have to have catered for variable strings with variable numbers.
And that would be much easier to be achieved with a filter and a one-off for the 2 (or are there more?) cases. And it would be much safer to treat files where you can be sure that not the odd one out has crept in. A filter would give you this overview.
It's a pity that you did not even try the filter.
Here is the documentation on scripting functions:

Thank you so much, I will surely have a look at it.