MusicBee Wiki
Register
Advertisement

Author: redwing

Introduction[]

Here are virtual tag formulas designed to perform a special task. Keep in mind though that long and complicated virtual tag formulas consume lots of system resources and slow down MB if used for sorting, grouping or searching. Though using them for one-time task only or for display purposes is acceptable.

Converting Date format[]

If you want to convert date like "20110318" to "18/03/2011" format, use this:

Date Convert = $Date($Left(<Year>,4)/$Left($Right(<Year>,4),2)/$Right(<Year>,2),dd/MM/yyyy)

for changing to "03/18/2011" format, use this:

Date Convert = $Date($Left(<Year>,4)/$Left($Right(<Year>,4),2)/$Right(<Year>,2),MM/dd/yyyy)

Now you could copy the virtual tag values to date tag to convert the date format.

Custom AZ bar using vertical Column Browser[]

AZ bar is useful but it responds only to sort column which feels sometimes cumbersome. To avoid this, you can create your own custom AZ bar using a virtual tag and vertical Column Browser. It also filters to the selection.

1. Create a virtual tag as follows:

(1) For general use:

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

(2) If you have classical music tracks and want them grouped by composer rather than by artist:

AZ = $If(<Genre>="Classical",$Group($Sort(<Composer>),1),$Group($Sort(<Artist>),1))

Note: you can replace <Artist> with <Album Artist> or any other field in accordance with your tagging scheme.

2. Configure Column Browser in vertical layout with one column of "AZ" field. Enabling "Show track count" could be useful too.

3. When you want to return to full list after filtered to a subset , click on "all" at the top or a node in left navigator.

Ht vf 1

Sorting by Title in "Letters-Numbers-Symbols" order[]

1. Create a virtual tag with the following formula.

$If($IsMatch(<Title>,"^[a-zA-Z]")="T",1<Title>,$If($IsMatch(<Title>,"^[0-9]")="T",2<Title>,3<Title>))

2. You can either create a custom sorting set using that virtual tag and sort by that field or just add the virtual tag to the main panel and sort by it. Also you can create the same sorting virtual tags for <Artist> and <Album> if you just replace <Title> with those fields using the formula above.

3. To use "ignore words" option, replace "<field>" with "$Sort(<field>)". So for "<Title>", use "$Sort(<Title>)" instead.

Converting "Composer" to "Last name, First name" format[]

This virtual tag converts composer name to "last name, first name" format as follows:

Anonymous => Anonymous

Johannes Brahms => Brahms, Johannes

Ludwig van Beethoven => Beethoven, Ludwig van

Carl Maria von Weber => Weber, Carl Maria von

Sort-Composer = $IsNull(<Composer>,,$If($Contains(<Composer>," ")="F",<Composer>,$RSplit(<Composer>," ",1)", "$Replace(<Composer>*,$RSplit(<Composer>," ",1)*,)))

Note: You can also use ASR preset for the same purpose.

Displaying "First Artist" only[]

This is a pretty simple one, but if you're not familiar to virtual tag functions it might not be apparent at first glance. If you have lots of multiple artist tracks and do not use album artist field, then artist field won't look good due to the lengthy chained artist names. This could be a problem for grouping by the field or displaying it on player scroll.

Create a virtual field as follows:

FA = $Sort($First(<Artist>))

Now use the field as if it's album artist field.

Grouping tracks by "Album Artist (Album)" format[]

Create a virtual field as follows (of course, you can edit the format as you like):

AA_Album = $Sort(<Album Artist>) (<Album>)

Then right click on column header, click Group by, and select "AA_Album" field under virtual field.

Ht vf 2

Defining "Ensemble" field for classical music tracks[]

Because MB uses <Display Artist> field values for <Artist> field in main library and virtual tags, it's a good idea to keep a consistent format for Display Artist field to use it for various purposes. I'm using a semicolon between multiple artists, so it is easy to display artist value in a specific position. For most classical pieces, ensemble is placed in the second position in multiple artist field next to conductor. Then the formula would be like this:

Ensemble = $Split(<Artist>,";",2)

But for concertos, ensemble is in the third artist, following soloist and conductor. I am using <Grouping> field for sub-genres for classical music which contains "Piano Concerto," "Violin Concerto", etc. So the field should display third artist when <Grouping> filed contains "Concerto", otherwise second artist:

Ensemble = $If($Replace(<Grouping>,Concerto,)=Grouping>,$Split(<Artist>,";",2),$Split(<Artist>,";",3))

Ht vf 3

Identifying files with extremely lengthy path[]

MB helps the user to take care of saving files with a lengthy path into a shortened path name (http://getmusicbee.com/forum/index.php?topic=7741.0), but the best way would be you handle extremely lengthy tags first that are used in your file-naming template before such a problem arises. Hence the question is how to identify those tracks? There may be some other ways, but the recently implemented $IsMatch function would be probably the simplest one to use and modify.

Lengthy_Path = $If($IsMatch(<Path><Filename>,"^.{201,}$")="T",">200",)

This would return ">200" for any tracks with full path name (path + filename + file extension) exceeding 200 characters; otherwise null.

Also you can check whether MB's path shortening is already in action with any of your tracks by using the following virtual tag:

Lengthy_Tag = $If($Contains(<Path><Filename>,~)="T","Y",)

This would return "Y" for any tracks with its path containing "~"character; otherwise null.

Creating a virtual <Folder> tag[]

If you're frequently accessing and playing files from their folders, MB's Computer node in left navigator might not offer desirable functionality for navigating and quick-accessing different folders. Then you might want to use a virtual field starting with the folder name you'd like to populate.

If you have a folder structure starting with E:\Music\Adele,

Folder = $Replace(<Path>,$Left(<Path>,9),)

This would return "Adele\..." value for each track. So replace the number 9 with any number depending on your folder structure.

If you have different folder structure according to genre, etc., you can modify the formula above using $If syntax.

Now you can add this "Folder" virtual field to library explorer, track browser, or main panel for easier browsing. The difference between this and using the tag (in this case "Artist" tag) is that this directs to the corresponding folder instead of a group of tracks corresponding to the tag value. 

Creating "Filename Only" field[]

Currently <Filename> field returns filename plus file extension. Here's how to populate filename only with virtual tags. 

Filename only = $Replace(<Filename>,.<.Ext>,)

Removing Last Backslash of <path>[]

Author:Roadrunner

$Replace(<Path>*,\*,)

It's expandable to a more general formula, let's say you'd like to remove the last 5 characters of any field. First you have to choose a character (or a combination of more than one) that will never be part of that field in the same order, in the following example I use "qqq" instead of the "*":

$Replace(<Anyfield>qqq,$Right(<Anyfield>,5)qqq,)

Identifying Duplicate Filenames in an Auto-organized Library[]

When you have your library auto-organized, what happens if some files in the same folder get exactly the same filename according to your naming template? In that case MB appends an underscore plus counter to the filename to distinguish each file from others. e.g.: "1-08 Right as Rain_1.mp3" Thus you might, once in a while, want to check if there are any duplicate filenames in your auto-organized library. After identifying those, you could edit your template or delete duplicate files depending on the situation.

Duplicate Filename = $If($Left($Right($Replace(<Filename>,.<.Ext>,),2),1)="_",Y,)

will assign "Y" value to the files in filename ending with an underscore plus a single digit number.

Easier Navigation with Artists on Thumbnail Browser[]

The biggest pain with using Thumbnail Browser is that it doesn't support AZ jump bar. Though you can type first letter and jump to those artists, it's not as convenient as it appears because you first have to select an item on Thumbnail Browser to take focus before typing. The better solution is to use a custom AZ jump bar with vertical Column Browser as posted before. The same virtual tag can be used to easily navigate through a long list of artists in Thumbnail Browser.

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

If using a first letter of artist like A, B, C... still lists too many artists, you can divide each letter into two groups like Aa, Ao, Ba, Bo,...

AaZo = $Group($Sort(<Artist>),1)$If($IsMatch($Right($Left($Sort(<Artist>),2),1),[a-n])="T",a,o)

will return "Ea" for Elton John and "Eo" for Eric Clapton.

Th

Let's try one more step. For some letters where only a few artists are listed, you might not want to split them into two groups because if the AZ bar is too long then you have to scroll it up and down as well.

Custom AaZo = $Group($Sort(<Artist>),1)$If($IsMatch($Group($Sort(<Artist>),1),[gioqu-z])="T",,$If($IsMatch($Right($Left($Sort(<Artist>),2),1),[a-n])="T",a,o))

will not split into two groups for first letters specified in [gioqu-z] part, which means "g", "i", "o", "q", "u", "v", "w", "x", "y", and "z".

Creating a Virtual Field that Lists All <Featuring Artist> from Title[]

The following virtual tag returns all featuring artists specified in title.

Featuring Artist = $Replace($Replace($Split($Split(<Title>,feat.,2),")",1),","," &")," &",;)

Song Title => returns nothing

Song Title (feat. BBB) => BBB

Song Title (feat. BBB & CCC) => BBB; CCC

Song Title (feat. BBB, CCC & DDD) => BBB; CCC; DDD

Song Title (feat. BBB, CCC, DDD & EEE) => BBB; CCC; DDD; EEE

If you want, you can copy this virtual tag value to <Artists: Guest> field, using "Copy guest artists from <tag 1>" preset with Additional Tagging Tools plugin.

Advertisement