MusicBee Wiki
Register
Advertisement

Up-to-date with version 3.1.6305

This forum post is also an excellent (and more recent) resource.

MusicBee offers a number of functions for use in Naming Templates, Virtual Tags, and so on. This page describes what each of them does.

Any part within a function that you want rendered as text in the output should be contained in quotes, even spaces.

Functions can be nested and combined in almost any way you can imagine. See Useful Virtual Tag Formulas for some examples.

Functions[]

Contains / IsMatch[]

$Contains checks whether the tag contains the given value (string or other tag).

$IsMatch checks whether the tag matches a regular expression. For help with regex, see this page.

Format as $Contains(<Tag>,Search Value).

Both functions return T if true and F if false. For more advanced results combine with $If, e.g. $If($Contains(<Tag>,Search Value)="T",True Result,False Result)

Date[]

Returns a date field formatted to your specifications. Expressed as $Date(<Tag>,Format).

Format can be any combination of yy or yyyy for year (2 digit or 4 digit), M or MM for month (MM will include leading 0s), and d or dd for day. If available, it will also handle hours (h or hh), minutes (m or mm) and seconds (s or ss). You can insert any separating characters you want, e.g. yyyy-MM-dd, hh:mm:ss.

First[]

Returns the first value of a multi-value field. Expressed as $First(<Tag>).

For later values, use one of the $Split functions.

Group[]

Groups tag values by the first "#" letters (e.g. putting 3 will group by the first three letters). Expressed as $Group(<Tag>,#).

If[]

Returns one of two values. Expressed as $If(Criteria,True Result,False Result).

Basic criteria takes the form of <Tag>=Value or <Tag1>=<Tag2>. For numerical tags you can use > or < (less than or greater than) as well as equal. If the criteria is true, you'll get the True result, otherwise you'll get the False result. Both the criteria and the results can include other functions.

See also $IsNull.

And / Or[]

These are subfunctions of $If which can evaluate two criteria instead of just one.

$And requires that both criteria be met in order to return the true result.

$Or requires that only one of the two be met in order to return the true result.

Format as $If($And(Criteria 1,Criteria 2),True Result,False Result)

IsNull[]

This is a variant of $If for dealing with null values (empty fields). Expressed as $IsNull(<Tag>,True Result,False Result). If the checked tag has any value at all, even 0, you will get the False result. Only if it is blank or non-existent will you get the True result.

Left / Right[]

Returns "#" characters from the left (beginning) or right (end) side of the tag, respectively. Formatted as $Left(<Tag>,#).

Lower / Upper[]

Converts tag to all lower case or all upper case, respectively. Format as $Lower(<Tag>).

Pad[]

Pads numerical tags to "#" digits by adding zeros to the left side. Expressed as $Pad(<Tag>,#).

Replace / RxReplace[]

$Replace finds the Search Value in a tag and replaces it with the Replace Value.

$RxReplace does the same, but can use regular expressions for both searching and replacing. For help with regex, see this page.

Format as $Replace(<Tag>,Search Value,Replace Value).

Sort[]

Applies the criteria found in the "Ignore Words" box in Sorting & Grouping. If none are found, it still treats "The" as an ignored word. Expressed as $Sort(<Tag>).

For example, output of $Sort(<Artist>) where the Artist is "IgnoredWord ABC" is "ABC, IgnoredWord".

Split / RSplit / RxSplit[]

$Split returns "#" section of the text based on a split character or set of characters, counting from left to right (i.e. from the beginning of the string to the end). For instance, if Title for a particular track contained "One Two Three", then the function $Split(<Title>," ",2) would return "Two" because it is the second section of the text based on splitting at the spaces.

$RSplit does the same, but counts from right to left (from the end of the string to the beginning).

$RxSplit is the same as $Split (works left to right), except the split value can be a regular expression. For help with regex, see this page.

Format as $Split(<Tag>,Split Value,#).

Trim[]

Trims all spaces from the beginning and end of a tag. Expressed as $Trim(<Tag>).

Advertisement