Fandom

MusicBee Wiki

Functions

180pages on
this wiki
Add New Page
Comments8 Share

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

Functions can be nested and combined in almost any way you can imagine. Any part within a function that you want rendered as text should be contained in quotes, even spaces.

See Useful Virtual Tag Formulas for some examples.

Functions Edit

Contains Edit

Checks whether the tag contains the given value (string or other tag). Expressed as $Contains(<Tag>,Search Value).

Returns T if true or F if false. For more advanced results, combine with $If: $If($Contains(<Tag>,Search Value)=[T or F],True Result,False Result)

Date Edit

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, as well.

First Edit

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

Group Edit

Groups tag values by the first "#" letters. Expressed as $Group(<Tag>,#).

If Edit

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

The 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.

Also see $IsNull.

And Edit

This is a subfunction of $If which requires that two conditions be met in order to return the true result. Expressed as $If($And(Criteria 1,Criteria 2),True Result,False Result)

Or Edit

This is a subfunction of $If which requires that at least one of two conditions be met in order to return the true result. Expressed as $If($Or(Criteria 1,Criteria 2),True Result,False Result)

IsMatch Edit

Checks whether the tag matches a regular expression. Expressed as $IsMatch(<Tag>,Regex).

Returns T if true or F if false. For more advanced results, combine with $If: $If($IsMatch(<Tag>,Regex)=[T or F],True Result,False Result)

For help with regex, try this page.

IsNull Edit

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 Edit

Returns "#" digits from the right or left end of the tag. Expressed as $Left(<Tag>,#) or $Right(<Tag>,#).

Lower / Upper Edit

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

Pad Edit

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

Replace Edit

Find and replace Search value with Replace value. Expressed as $Replace(<Tag>,Search Value, Replace Value).

Sort Edit

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 <Artist> is "IgnoredWord ABC" is "ABC, IgnoredWord".

Split / RSplit Edit

$Split returns "#" section of the text based on a split character or set of characters, counting from left to right. Expressed as $Split(<Tag>,Split Value,#).

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.

Trim Edit

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

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.