Add Artist to filename only if Albumartist is different AND present

Hi,

I would like to add the artist to the end of a filename when its different from Albumartist. Therefore I’m using the following string to format:

\$if2(%albumartist%,%artist%)\[%year% - ]%album%\[CD$num(%discnumber%,1) ]$num(%track%,2) %title%$if($eql(%artist%,%albumartist%),, - %artist%)

Of which this bit is intended for the described behaviour:

$if($eql(%artist%,%albumartist%),, - %artist%)

Now this does give the desired result, except when the Albumartist is not occupied. Makes sense, because it IS different from Artist. But in that case it's not wanted also. So I have been trying to combine boolean functions, but I just get syntax errors, so obviously I'm doing it wrong :grin:

Anyone that can give me a push in the right direction?

So you want to add the ALBUMARTIST content only if it is not empty?
If ALBUMARTIST is empty - and therefore different vom ARTIST - you want to see the ARTIST only, with a leading space a hyphen and a space, correct?

If yes, you can try something like this:
$if($and(%albumartist%,$neql(%albumartist%,%artist%)), - %albumartist%, - %artist%)

Thanks for thinking with me!

Actually I want to add the ARTIST content, when ALBUMARTIST is not empty...
By adjusting your example, I have made it work:

if($and(%albumartist%,$neql(%albumartist%,%artist%)), - %artist%,)

I was mainly struggling with the syntax of nesting functions. So thanks for helping me get unstuck!

If you want to use a little less code, you could try:
$if($eql($if2(%albumartist%,%artist%),%artist%),, - %artist%)

So maybe to help others, I'll explain what my string does and my thinking behind it.

First of all, the reasons for me really needing a good folder structure and file-naming, is that my (VW) car radio is only searchable by going through the folder structure. And each level is sorted by foldername or filename alphabetically. So that said, here's my current string for filenaming:

C:\Users\Wild_Chocolate\Music\$if2(%albumartist%,%artist%)\[%year% - ]%album%\[CD$num(%discnumber%,1) ]$num(%track%,2) %title%$if($eql($if2(%albumartist%,%artist%),%artist%),, - %artist%)

Breakdown and explanation:

The folder structure:

C:\Users\Wild_Chocolate\Music\

That's the main folder for my music(, obviously).

$if2(%albumartist%,%artist%)\

Create a folder from albumartist, or if that's not occupied from artist
This makes sure that, for example, albums with Various Artists end up in the according folder.
Also, if there are songs that have contributing/featured artists, they still end up in the folder of the main artist.

[%year% - ]%album%\

Create a folder from album, put year in front of it, if occupied.
I like to sort albums chronologically.

The filename

[CD$num(%discnumber%,1) ]

Only if there is a discnumber start the filename with CD followed by the discnumber consisting of 1 digit.
I'll live with it in the rare case that an album consists of more than 9 discs (I'm pretty sure it wil print 2 digits if there are 2, so it will only mess up the disc order in my car.

$num(%track%,2) 

add (or start with if no discnumber) the tracknumber in 2 digits.
Most albums were made to listen in an intended order. So it makes sense to start with tracknumber rather than sorting alphabeticallyh. Because discs commonly contain more than 9 tracks, I want it to start with a 0 for the first 9 tracks. Otherwise my car messes up the sorting.

%title%

add the title

$if($eql($if2(%albumartist%,%artist%),%artist%),, - %artist%)

At the end, if the albumartist is occupied, AND its not the same as the artist, add the artist.
This is mostly if a "nice to have" on, for example, "Various Artists" albums. I put it at the back, because I can only see the first part of the filename when browsing in my car. It's the less import to me than the title in that situation, so I don't want it in front of it.

A couple of extra remarks:
Since I it's already quite hard to keep this simple and understandable, for sake of readability I haven't mentioned anything about spaces, dashes etc. Of course you can play with the position of those, to format the filename as you find pleasant. In case of data that only is added if available, it is important to ad that formatting within the "formula" for that data, otherwise you will end up with unwanted spaces and dashes and stuff. So it pays to play with those a bit and use the "example" button in the filename dialogue.

Personally, I keep a .txt-file with my naming convention, and stuff I need to check when/after I tag new files, before changing the filenames from the tags.

  • Are the genres to my standard?
  • Check if there are more than one artist (featuring or various), if so make sure the albumartist tag is correctly filled
  • In (album)artists names I use & all the time instead of and (or the Dutch and German words en, und)
  • In artist I use "Ft" consistently instead of "with", "and" etc.
  • In tags I don't want to start track with a "0" (because all the software I use is smart enough to know that 2 comes before 10...)

Besides that, I use albumartist to keep all the bands that Eric Clapton played in, in the Eric Clapton folder, instead of spreading them over Cream, Blind Faith, Delaney & Bonny & Friends, John Mayall & The Bluesbreakers, T.D.F. if you catch my drift :grin:
But this is of course personal, and how do you go about with, for example, Genesis, where both Peter Gabriel and Phil Collins went on to successful solo careers... It's hard to develop a consistent method that works in all situations... choices, choices, choices :grin:
I'm happy that my scheme now works in 95% of the cases. An exception is Christmas music, which I keep in a seperate folder. And for that I didn't want to spend time figuring out to that if the genre is "christmas". I am sure MP3Tag can do it, but it only costs me half a minute extra for those albums to do it by hand. (filtering on that criterium)

Thank you for your explanation.

I've just cherry-picked one of your own rules:

You are aware that this will change the artist original name from
Nurse With Wound -> Nurse Ft Wound
MAN WITH A MISSION -> MAN Ft A MISSION

I strongly advise against changing ARTIST or ALBUMARTIST name in such a manner.
Even if this is "only" used for filenames.

Of course it's your collection @Wild_Chocolate and you can do whatever you like.
This is just a warning for other readers.

You're absolutely right!
To clarify, I only do this for occasional co-operations, not if it's the bandname.
So your examples, I wouldn't touch. Also not Sting & The Police or Gladys Knight & The Pips.

So just to solve that everyone tags those occasional co-operations differently.