Adding file type or bit rate to Folder name (IF function)

Hi. I'm a new user to MP3Tag and I'm trying to figure out how to rename my folders a certain way. I've created an action with the default value of "_DIRECTORY" and then trying to use a format string for the naming convention.

Basically what I want to do is have the folder name be "Year - Album [FLAC or Bitrate)

I want to do this so that if the file is FLAC, it obviously shows FLAC. But if it's an MP3, I want it to show the bitrate. So I'm assuming this is done using an IF function, but I can't get it right. I've played around with a bunch of variations (few below) but I keep getting errors and I'm obviously not a coder. :slight_smile:

I based this off the $if(x,y,z) if x is true, y is returned, otherwise z

%year% - %album% $if(%_extension%=flac,%_extention,%_bitrate%)

%year% - %album% $if(%_extension%=flac,FLAC,%_bitrate%)

%year% - %album% $if($eql(%_extension% IS 'flac'),%_extention,%bitrate%)

%year% - %album% $if($eql(%_extension%, 'flac'),FLAC,%bitrate%)

I can get Year - Album [%_extention] to work perfectly, but I'm lost of the IF statement and can't get it work. Is this even possible? Any advise would be greatly appreciated.

THANKS!!
Linus

THis is almost right

Try
%year% - %album% $if($eql(%_extension%,flac),FLAC,%_bitrate%)

Wow, that was fast. THANK YOU so much!! And this is why I stick to graphics and not coding :smiley:

You're the man.

Here is what I ended up with.

%year% - %album% $if($eql(%_extension%,flac),'(FLAC)','('%_bitrate%'kbps)')

Example of what you the outcome is:

1994 - The Downward Spiral (FLAC)
or
1994 - The Downward Spiral (320kbps)

How would you also incorporate WAV into this? So the output is either FLAC, WAV, or bitrate

Try
$ifgreater($strstr(FLACWAV,$upper(%_extension%)),0,$upper(%_extension%),%_bitrate% kbps)

That works, but missing the [ ], so it comes out as WAV instead of [WAV] etc

It says nowehre in the thread that the square brackets are needed.
And if you need them, Use '[' and ']' to insert them, where you like them.

Think i got it
$ifgreater($strstr(FLACWAV,$upper(%_extension%)),0,$upper'[%_extension%]','['%_bitrate%'kbps]')

Thank you!

This would be shorter:
'['$ifgreater($strstr(FLACWAV,$upper(%_extension%)),0,$upper(%_extension%),%_bitrate% kbps)']'

That works also!
I image adding a VBR variable to bitrate would be a stretch? :upside_down_face:

You can add whatever information you want, like %_VBR%:

If the bitrate is variable ... it varies from file to file. So which value would you like to see?

So for CBR the actual [bitrate], for variable i'd like to see just [VBR] instead of the actual

Before I invest any more brainpower, please note that MP3tag looks at every file individually and then renames the folder.
So if you have a mixture of VBR and CBR files, you will see only one of the properties in the folder name (depending which file won).
So, I doubt that this information is really beneficial.
And why not make it easier and simply add the property %_VBR% to the bitrate output so that you know how to interpret that data.

No mixtures. My folders are same CBR bitrate, or VBR - V0, V1 etc, I was not talking about having a mixture of different bitrate files in same folder. Sorry for confusion.
And no worries, I appreciate your efforts!