Fandom

MusicBee Wiki

How to Create a File-Naming Template

180pages on
this wiki
Add New Page
Comments16 Share

Author: redwing

Key PrinciplesEdit

Sure, you can name your music files with a bunch of meaningless numbers and store all of them in one big folder as long as you are able to manage them with their tags. But problems will soon arise when you're trying to locate and play a song outside a music player. And more often than not you will be forced to manage those files to fix some problems, and you would probably want to see more info on their path and filename. On the other hand, you don't have to organize your files more meticulously than necessary. Most of the time you will be playing them from a music player rather than from their folder; your collection keeps growing and changing, often demanding a different organizing rule.

Here are some key principles I'd think to keep in mind with regard to naming templates.

  • Make the folder structure practically useful to your pattern of accessing and managing files.
  • Keep filename as simple and short as possible.
  • Avoid any duplicate names for files within the same folder.
  • It doesn't matter, on the other hand, for the template to be lengthy and complicated to do the job.

Handling of Missing TagsEdit

Let's start with MB's default template.

<Album Artist>\<Album>\<Disc-Track#> <Title>

This means your music files will be stored with the following path:

Adele\21\01-11 Someone like You.mp3

If you don't tag disc# for a single disc album, then:

Adele\21\11 Someone like You.mp3

What if the track has no track# tag either? In that case:

Adele\21\# Someone like You.mp3

If the track has no <Album> tag either; then it gets the following path:

Adele\Unknown Album\# Someone like You.mp3

This is why "do not re-organize files with missing tags" option is by default ticked for file organization dialog.  

Now, you want to make <Disc-Track#> field blank when the tag value doesn't exist, then put this:

<Album Artist>\<Album>\$IsNull(<Disc-Track#>,, <Disc-Track#>" ")<Title>

" " means it would insert a space between Disc-Track# and Title when the value is present. This will give you the following path:

Adele\21\Someone like You.mp3

If you want to do the same thing for album:

<Album Artist>\$IsNull(<Album>,,<Album>)\$IsNull(<Disc-Track#>,, <Disc-Track#>" ")<Title>

then it will give you the following path with no sub-folder for <Album> if the tag doesn't exist:

Adele\Someone like You.mp3

Splitting Your Collection to Big GenresEdit

Now, do you want your folder structure to start with an artist name or some big genres? If you want every track start with its own <Genre>, then it's easy:

<Genre>\<Album Artist>\<Album>\<Disc-Track#> <Title>

But not sure how useful that structure could be with tens of genres.

If you're like me and want to split the collection to two big folders, Classical and Pop(all the others), then use this in place of <Genre>:

$If(<Genre>="Classical","Classical","Pop")

Then all classical music tracks would start with \Classical\ path while all other tracks start with \Pop\ path.

What if you want to split it to three, Classical, Jazz and Pop?:

$If(<Genre>="Classical","Classical",$If(<Genre>="Jazz","Jazz","Pop"))

Now you got the idea. With the nested $If conditions, you can split your collection to as many genres as you like.

Different Template for Each Big GenreEdit

Then why would you want, in the first place, to split your collection to a few big genres? Obviously it will keep your files of the same big genre get stored together in a big folder. But, more important, it will allow you to use a different file-naming template for each big genre. For an average collection of popular music, MB's default template would be more than enough. But that wouldn't do much good for classical music where all album names and track titles look just the same for most standard repertoire and where it's not uncommon for the same conductor(album artist) performing a piece of music several times with the same title and the same album name.

Now you want to use completely different template for classical and pop music tracks. Then use this sort of pattern:

$If(<Genre>="Classical","Classical\<Composer>\<Artist>\<Year>\<Disc-Track#> <Title>","Pop\<Album Artist>\<Album>\<Disc-Track#> <Title>")

It will use "Classical\<Composer>\<Artist>\<Year>\<Disc-Track#> <Title>" template for classical music and MB's default template following \Pop\ path for popular music.

On the other hand, if you want to make just a small difference in path, use this pattern instead:

$If(<Genre>="Classical","Classical","Pop")\<Album Artist>\$If(<Genre>="Classical",<Year>,)\<Album>\<Disc-Track#> <Title>

This will make the two genre starting with \Classical\ and \Pop\ but the rest would be the same except that <Year> sub-folder will be inserted only to classical music tracks.

What to Use among Album Artist, Artist, and First Artist? (1)Edit

What would the differences be between using <Album Artist> and using <Artist> for the template? For the tracks with the same values for the two tags, obviously there would be no differences. It's the same for users who do not use <Album Artist> field and keep the field blank (Virtual tags cannot see a blank <Album Artist> field. It's immediately filled with <Artist> value). It makes differences only when <Artist> value and <Album Artist> values are different, mostly with compilation albums and "Various Artists." Let's see the differences with the following example:

<Album Artist>\<Album>\<Disc-Track#> <Title>
​Various Artists\Almost Alice\01 Alice.mp3

With this, the filename gives you no idea about who the artist is.

<Artist>\<Album>\<Disc-Track#> <Title>
Avril Lavigne\Almost Alice\01 Alice.mp3

Now you can see who the artist is. But this template will split all albums with different artists into different folders.

How about the following?

$If(<Album Artist>=<Artist>,<Album Artist>,<Artist>)\<Album>\<Disc-Track#> <Title>

This will use <Album Artist> as long as the value is the same with <Artist>, otherwise uses <Artist>. What? Actually this means nothing. It's the same as the template just above since it always uses <Artist> value for the first path.

Now you don't want to split albums with different artists except for compilation albums:

$If(<Album Artist>="Various Artists", <Artist>,<Album Artist>)\<Album>\<Disc-Track#> <Title>

This will use <Album Artist> for all tracks without splitting albums with the different artists, but for compilation albums with Various Artists it will split them using <Artist> path instead.

What to Use among Album Artist, Artist, and First Artist? (2)Edit

Now you know the differences between <Album Artist> and <Artist> in file-naming template, and you feel like <Artist> would suit your collection better. At this point, you must think about how many artists are tagged for an average track in your collection. This would make huge differences especially to the length of path in case you're frequently tagging tracks with multiple artists with long names. It's not uncommon to classical music collection that several ensembles with lengthy names are used as multiple artists.

So when the following gives you this lengthy path:

<Artist>
Carlo Maria Giulini; Philharmonia Orchestra; Philharmonia Chorus

You might want to use first artist only:

$First(<Artist>)
Carlo Maria Giulini

Or first & second artists only:

$First(<Artist>)$IsNull($Split(<Artist>,";",2),,"; "$Split(<Artist>,";",2))
Carlo Maria Giulini; Philharmonia Orchestra

Handling of "The"Edit

It always gives you a headache when you're trying to sort artists by their names, but those names starting with article "The" or "A" just won't be sorted correctly. Fortunately that shouldn't be a problem for any MB user thanks to "ignore words" option under Tags (2) settings. If you put some words in there, then you can make any virtual tags and the file-naming template to respect the setting by using $Sort function.

<Artist>
The Alan Parsons Project


$Sort(<Artist>)
Alan Parsons Project, The

What does this mean to users who just want to use MB's default template? It would be better to use the followings than the default in case any of your artist has name starting with an article:

$Sort(<Album Artist>)\<Album>\<Disc-Track#> <Title>

or

$Sort(<Artist>)\<Album>\<Disc-Track#> <Title>

Grouping Folders with First LetterEdit

It might look better and practically useful if you're grouping artist name folders with its first letter; of course, you don't have to. In case you want that grouping folder, use this:

$Group($Sort(<Artist>),1)

Why use $Sort(<Artist>) instead of <Artist>?

That's for "The Alan Parsons Project,"

$Group(<Artist>,1)

would return "T", whereas

$Group($Sort(<Artist>),1)

would return "A" instead.

When you want to group folders for first artist:

$Group($Sort($First(<Artist>)),1)

Tips for Shortening Tag ValuesEdit

So far most key points were covered. Now it won't be hard for you to modify this default template of MB:

<Album Artist>\<Album>\<Disc-Track#> <Title>
The Alan Parsons Project\The Collection\# Eye in the Sky.mp3

into something like this:

$If(<Genre>="Classical","Classical","Pop")\$Group($Sort(<Album Artist>),1)\$Sort(<Album Artist>)\<Album>\$IsNull(<Disc-Track#>,, <Disc-Track#>" ")<Title>
Pop\A\Alan Parsons Project, The\The Collection\Eye in the Sky.mp3

One important point is you'd better keep any track's path not exceeding 260 characters: http://getmusicbee.com/forum/index.php?topic=9317.msg66715#msg66715

Then how to shorten tag values while avoiding duplicate names? There can be numerous ways. Just list a few:

  • Limiting the number of characters for a specific tag

$Left(<Album>,50)\<Disc-Track#> $Left(<Title>,50)

This will use first 50 characters only both for <Album> and <Title> field

  • Using first artist only instead of using multiple artists

$First(<Artist>)
  • Using unique value fields that can help avoid duplicate filenames

<Album Artist>\<Year(YYYY)>\<Composer>\<Disc-Track#>  <Title>
  • Using multiple $Split function to shorten tag values

$Split($Split($Split(<Album>,";",1),"/",1),"&",1)

This would use a string before any of ";" "/" "&" characters for <Album> path.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.