The tag to filename engine is a template driven engine used at several places in Helium:

  • The Rename Files tool
  • The Filename to tag feature in the Tag editor
  • Scripting
  • Definition of user-columns

The engine can tag in-data arguments from a specific database entry or an physical audio file and from that genrate an aggregated result string based on existing properties and rules.

The basics

Say you want your filenames to look something like this:
David Bowie – Lazarus.mp3
Easy. Just type in this template and hit Go (or “Rename files” as the button is really named):
{{artist}} - {{title}}

What’s that around the artist and title names you ask? Curly brackets of course. Why do we need to use two opening and two closing all the time you ask? You’ll see.

Prefixes and suffixes

Say you want to include a little more information in the names such as a “Remix” field and a “Subtitle” field. Easy, you say. Looks like this:
{{artist}} - {{title}} ({{subtitle}}) [{{remix}}]

Of course. But what about files that don’t have any subtitle or remix tags set? That would end up with something like this:
David Bowie – Lazarus () [].mp3
You don’t want that. This is where the concept of prefix and suffix comes in. Prefix is something that is included before a field and suffix is included after the field. Look at this template:
{{artist}} - {{title}}{ ({subtitle})}{ [{remix}]}

As you can see we have included a prefix and suffix in between the curly brackets. This will make the field disappear entirely (including the prefix and suffix) from the file name if the field is empty in tags.
As you see you can use a combination of literal text (like the ” – ” between artist and title) and prefix/suffix. Literals work fine as long as you are sure that the fields before and after will always contain something. Use what fit your needs.

Folders

Creating folders based on tag information is important to any serious music collector. You can enter folders into your templates by adding backslashes to specify new folders. If you would want to move songs into artists’ folders like this:
David Bowie\Lazarus.mp3
You type in a template like this:
{{artist}}\{{title}}

Note that this would create an artist folder wherever the file was previously located which may not be what you expect. To tell Neon exactly where you would like your files to end up you will need to explicitly include the path in your template, like this:
C:\My music\{{artist}}\{{title}}

Numbers

Numbers can be included just as any other field in a template. Just wrap the field between two curly brackets as usual:
{{track}}. {{title}}

which produces this file name:
3. Lazarus.mp3
Sometimes you might want to pad numbers with leading zeros, perhaps to make them line up neat in the lists. Would that be hard? You know it won’t. Example ahead:
{{track(2)}}. {{title}}

Insert round brackets after the field name and enter the number of numbers (no pun intended) you want your filenames to have. The above template would produce:
03. Lazarus.mp3

While
{{track(5)}}. {{title}}

would produce
00003. Lazarus.mp3

Limit lengths

If you want to limit the length of some fields you can do this in a similar fashion to how number padding works. Say you would want to create a file structure like this:
C:\My music\D\David Bowie\Blackstar\03. Lazarus.mp3
Your template would look like this:
C:\My music\{{artist(1)}}\{{artist}}\{{album}}\{{track(2)}}. {{title}}

As you see you include a limitor between round brackets. The 1 says that the artist field should be limited to a maximum of one character.

Replacement for empty tags

As mentioned earlier, an empty field will always be stripped from the filename along with the prefix and suffix. Sometimes you want this but sometimes you would want to include a placeholder to keep consistency in file names or folders. Consider the following file structure:
C:\My music\Album\2016\David Bowie – Blackstar\3. Lazarus.mp3
The following template would work as long as the “Release type” field contains some information:
C:\My music\{{releasetype}}\{{releaseyear}}\{{artist}} - {{album}}\{{track}}. {{title}}

But what if you run across a couple of files that does not have any value in the “Release type” field? These files would end up here:
C:\My music\2015\Basement Jaxx – Awesomeness (Bootleg)\5. Best. Song. Ever.mp3
See the missing release type folder? This can be solved using this syntax:
{{field|Replacement text}}

i.e. a pipe character after the field name followed by the text that should replace an empty field. The following template would fix the issue with folders ending up in the wrong place:
C:\My music\{{releasetype|Unknown}}\{{releaseyear}}\{{artist}} - {{album}}\{{track}}. {{title}}

Which would place the Basement Jaxx tune from above in this folder instead:
C:\My music\Unknown\2015\Basement Jaxx – Awesomeness (Bootleg)\5. Best. Song. Ever.mp3

Complete list of fields

Below is a list of all supported fields:
  • {{bitrate}} 
  • {{encodingtype}} 
  • {{frequency}} 
  • {{album}} 
  • {{albumartist}} 
  • {{artist-so}} 
  • {{album-so}} 
  • {{albumsubtitle}}
  • {{albumversion}} 
  • {{artist}} 
  • {{artist-so}} 
  • {{bandorchestra}} 
  • {{bpm}} 
  • {{comment}} 
  • {{composer}} 
  • {{conductor}} 
  • {{copyright}} 
  • {{cd}} 
  • {{track}} 
  • {{custom1}} 
  • {{custom2}} 
  • {{custom3}} 
  • {{custom4}} 
  • {{custom5}} 
  • {{custom6}} 
  • {{custom7}} 
  • {{custom8}} 
  • {{custom9}} 
  • {{custom10}} 
  • {{encodedby}} 
  • {{genre}} 
  • {{initialkey}} 
  • {{isrc}} 
  • {{label}} 
  • {{language}} 
  • {{lyricist}} 
  • {{media}} 
  • {{mood}} 
  • {{originalartist}} 
  • {{originallyricist}} 
  • {{originaltitle}} 
  • {{preference}} 
  • {{produced}} 
  • {{rating}} 
  • {{recordingyear}} 
  • {{releaseyear}} 
  • {{remix}} 
  • {{situation}} 
  • {{softwaresettings}} 
  • {{subtitle}} 
  • {{tempo}} 
  • {{title}} 
  • {{title-so}} 
  • {{totalcds}} 
  • {{totaltracks}}
  • {{delete}} - this is just a pseudo-field which can be used to ignore certain characters in file names (more below)


The {{delete}} field

The {{delete}} field can be used for more advanced filename to tag usage. It can be seen as a pseudo-field which is not connected to any tag field. It can be used to ignore certain characters in a filename that you don't want to bring into any tag.


Here is an example:


Let's say that you have these files:

3. Bomb The Bass - Bug Powder Dust - UNWANTED TEXT (Chemical Brothers Re-Edit).mp3

4. Bomb The Bass - Beat Dis - UNWANTED TEXT2 (7" Mix).mp3

5. Bomb The Bass - Megablast - UNWANTED TEXT3 (7" Mix).mp3


If you wanted to use the filename to tag function to extract the text from this filename into tag fields the UNWANTED TEXTx would be a problem since you could not get rid of that information, hence it would end up in a tag in some way. By taking advantage of the {{delete}} field you could use a template like this:


{{track}}. {{artist}} - {{title}} - {{delete}} ({{remix}})


Which would take the track, artist, title and remix fields and put them into the correct tag fields, but just ignore the text where the {{delete}} field is.


Note: This field has no effect when used in a file rename template.