Glad to! I find puzzling out how to turn a visual structure into computer-readable instructions rather fun.
Unfortunately, the split between what you’re calling “album artist” and “artist” isn’t as big as you’re hoping in our dataset: we’d probably consider “Bob Throat Lab Band” to be its own artist, and sort the album under that. It’s not universal – if the “Lab Band” was still the single person who’s just adopting the persona of a group, there’s a chance we’d put the name in the artist credits, which would mean the structure you’re hoping, but I wouldn’t count on it. To give you that capability, though, I’ve included a check for a custom variable: if the album would normally be sorted under the Lab Band name or something else you don’t want (check the Album Artist Sort Order
in the bottom pane, and if that’s not there, the Album Artist
, Artist Sort Order
, and Artist
fields, in that order, the latter of which are included for safety with incomplete tags), right click and add a new tag; in the dropdown at the top, ignore all the builtin names and type in artistfolder
; finally, in the list of values (there’s an empty one at the top), write the folder you want to use, for example Throat, Bob
. You’ll have to do that for every file in the album, but if you select the row with bold text and the CD icon before adding it, the new tag will automatically be shared across the entire thing. This is fully integrated in the Various Artists logic, so you can force an album to be treated as a compilation (or not) if you need to as well.
Likewise, the sortable name of the album isn’t one of the variables the database stores – I’ve complained about that a couple times on here – but I’ve put in a function that will do a mostly-decent job of sticking the prefixes at the end. If it doesn’t do something right, add a new tag like above, choose albumsort
(it is in the list this time), and enter the proper form. Unfortunately, by default you won’t be able to see whether that’s necessary until after you save something; I’d recommend adding the first following line to a script in the “Scripting” page of the options so it’s more obvious. If you don’t like the Album Sort Order
being included in every file, add the second as well which leaves only Album
if the sort order’s not any different. If you do add the tagging script, I’d recommend replacing $swapprefix(%album%)
in the main file naming script with just %album%
, as leaving it in there causes hidden behaviour that might trip things up in the future.
$if($not(%albumsort%),$set(albumsort,$swapprefix(%album%)))
$if($eq(%albumsort%,%album%),$unset(albumsort))
Also, I made my best guess at the album identifiers, but I wouldn’t be at all surprised if it’s not exactly what you were wanting. If you can give a concrete example, I’ll be happy to fix that part for you – or, indeed, any bit of this that you were imagining formatted differently. Finally, I didn’t make adding the track artist be based on whether the album is a compilation or not, but rather on if it matches the artist for the rest of the album, so an artist who’s only featured on a single track will show up in the filename; we put them in the artist field rather than the title, but if you’d rather the latter, there’s a plugin (“Feat. Artists in Titles”) for that.
$noop(Provide a means of manually specifying the folder with %artistfolder%)
$set(_topartist,$if2(%artistfolder%,%albumartistsort%,%albumartist%,%artistsort%,%artist%,Unknown Artist))
$set(_displayartist,$if2(%albumartist%,%artist%,Unknown Artist))
$set(_isva,$if(%artistfolder%,
$eq(%_topartist%,Various Artists),
$or(
$eq(%compilation%,1),
$eq(%musicbrainz_albumartistid%,89ad4ac3-39f7-470e-963a-56509c546377)
)
))
$noop(%albumsort% provides better control, but isn't automatically set)
$noop(If %albumsort% is populated via a script, replace `$swapprefix(%album%)` with just %album%)
$set(_albumfolder,$if2(%albumsort%,$swapprefix(%album%)))
$set(_displaymedium,$if2(%media%,Medium))
$noop(Guess at losslessness from the extension -- doesn't test MP4s)
$noop(Based on https://community.metabrainz.org/t/categorizing-lossless-music/258530/2)
$setmulti(_losslesstypes,flac;oggflac;ape;ofr;tak;wv;tta;wav)
$set(_islossless,$if($inmulti(%_losslesstypes%,%_extension%),L,S))
$noop(Take the first single letter or character from each field)
$set(_albumid,
$if(%_isva%,
VA,
$left(%_topartist%,1)$left(%_displayartist%,1)
)
$left(%_albumfolder%,1)
%releasecountry%
$left(%_displaymedium%,1)
%date%
%_islossless%
)
$noop(Treat single-track albums as standalone recordings)
$noop(Note that this will not pull out single tracks that are said to be part of a larger album)
$noop(Neither will it recognize non-MusicBrainz albums as being proper albums /unless/ either %totaldiscs% and/or %totaltracks% has been set)
$noop(The track number is not checked for this purpose because I've come across single files on Soundcloud that have that field set for no reason)
$if($or($gt(%totaldiscs%,1),$gt(%totaltracks%,1)),
%_topartist%/
%_displayartist%/
%_albumfolder%
$noop(Some of the ifs aren't necessary, but they're an easy way of adding spaces)
$if(%releasecountry%, %releasecountry%)
$if(%media%, %media%)
$if(%date%, $left(%date%,4))
$if(%_albumid%, %_albumid%)/
$if($or($gt(%totaldiscs%,1),%discsubtitle%),
Disc $num(%discnumber%,2)$if(%discsubtitle%, %discsubtitle%)/
)
$num(%tracknumber%,2)
$if($ne(%_displayartist%,%artist%), - %artist%)
- %title%
,
Random Songs/
%artist% - %title%
)