The File name masks drop-down list all the masks currently available for renaming songs based on their metadata.
You can modify an existing mask by selecting a mask from the drop-down and selecting the Edit button.
You can delete an existing mask by selecting a mask from the drop-down and selecting the Delete button.
You can create a new mask by selecting the Add button
A rename mask consists of a name and the actual mask itself. The name is displayed in the drop down and can be anything you like. The mask uses the full JavaScript Expression language and this makes it incredibly powerful.
The Mask Field list shows all the metadata field that can be used in the mask
When you want to create or edit a mask decide how you want the file path to look with a given set of metadata, remembering that the mask does not replace the base folder, only the sub folder and file name.
i.e. for the file C:\\Music\U2\The Joshua Tree\With or Without You.mp3 the correct split should be:
Base Folder : C:\Music
Sub Folder: U2\The Joshua Tree
File name: With or Without You.mp3
These split between base folder and sub folder is decided when you select a folder to fix, if SongKong gets it wrong it can be modified on the Basic tab before the fixing process is started.
Use the Mask Fields to get the correct metadata.
Use '/' to indicate a folder separator. You can pass these fields to JavaScript functions such as the ifnotempty function, functions take an input and return an output.
The '+' character is used to concatenate the two results, for example 'Dog' + 'Fish' gives 'DogFish'
It is tedious to repeat the same JavaScript in multiple places so you can use any of the predefined JavaScript functions from the .JavaScript User Defined Functions list.
You can also create new functions and edit existing ones.
The ifnotempty function takes two parameters, the first is the metadata field, the second is text to put after the field if the metadata for a particular song is not empty, if it is empty then nothing is output.
This is useful to prevent outputting values intended to separate metadata when we don’t actually have the metadata for a particular song.
The ifnotempty2 function takes three parameters, the first is the metadata field, the second is an alternative metadata field to use if the first metadata field is empty, the third is text to put after the field if the either first or second metadata fields are not empty for a particular song, if both are empty then nothing is output.
This function is useful when you have alternative sources that can be used if the primary source is empty, such as Album Artist and Artist.
The ifnotempty3 function takes four parameters, the first is the metadata field, the second is an alternative metadata field to use if the first metadata field is empty, the third is an alternative if the second metadata field is empty, the fourth is text to put after the field if any of the metadata fields are not empty for a particular song, if all are empty then nothing is output.
The ifmultidisc function takes a value to output if the song belongs to a multi-disc album, if it doesn’t then nothing is output.
The padnumber function takes two parameters, the first is the number, the second is the desired length. For example if the first parameter is '1' and the second parameter is 2 it will output 01, if the second parameter was three it would output 001.
The substring function takes two parameters, the first is the text, the second is the desired length. For example if the first parameter is frederick and the second parameter is 4 it will output fred. Unlike the standard substring function provided by JavaScript this one will not error if the required length is longer than the text
You can modify or create a single JavaScript function using the standard JavaScript Expression syntax.