Help with script for folder name -- format based

Hello

at the moment I’m using the following:

%albumartist% - %album% ($left($if2(%date%,%originalyear%,----),4))/$if($gt(%totaldiscs%,1),%discnumber%-,)$if($ne(%albumartist%,),$num(%tracknumber%,2) ,)$if(%_multiartist%,%artist% - ,)%title%

That gives me a folder name which contains the album artist, album name, and year of release. The filename shows the track name (preceded by discnumber if greater than 1), the artist name if the album has several artists, and the title.

I’d like to tweak this further and name the folder in a way that it displays the albumartist if it’s a compilation (Various Artists, let’s say), but it chooses artist instead if not. The reason behind that is that I use one general name in albumartist in cases where an artist has slightly changed name over different albums, and the actual artist name on artist. For example: for albums by “Sergio Mendes and Bossa Rio”, “Sergio Mendes & Brasil '66” and “Sergio Mendes & Brasil '77” and just “Sérgio Mendes”, I use a common albumartist plainly named “Sergio Mendes”. I want all those albums sorted under his general name (albumartist), but I want the folder to be named according to the actual artist name (artist), not albumartist. Please correct me if this isn’t the right approach?

And… further: again in the folder name, after the year, I’d like to add [FLAC] if the files in the folder are in flac format. Is this possible, somehow? At the moment I’m doing it manually, so not ideal. An example would be like this: “Miles Davies - At Carnegie Hall (1962) [FLAC]”

Many thanks in advance!