Table of Contents

foo_discogs Tag Formatting Syntax Reference

Tag Formatting Strings

New to foo_discogs 2.0, information from the Discogs database is now mapped to tags via user-defined tag formatting strings. The advantage of flexible tag mappings over the old, hardcoded tags, is that users now have exact control over what tags they write and how they write them. Post-processing of the hardcoded tags generated by foo_discogs 1.0 using other components is now a thing of the past.

Tag formatting strings are an extension of foobar2000 titleformatting strings. The general syntax is similar, but our extension is quite a bit more complicated. You ought to understand titleformatting syntax before attempting to understand our extended tag formatting syntax.

The underlying data that tag formatting strings operate on is loaded from the Discogs Database for the release and tracks being tagged and accessed via variables provided internally by foo_discogs. We've aimed to expose as much information from the Discogs API as we can, and to expose information in a hierarchical, object-oriented manner. These data fields and how they are accessed are described in detail in the following section.

The biggest complication that foo_discogs' tag formatting strings has over normal titleformatting strings is support for arrays. Users may wish to write multi-value tags, which requires an array of tag results for a single tag. Additionally, much information available from the Discogs database is provided in the form of an array of values rather than a single value. Any scripting language to effectively perform tag mappings needs to support arrays.

Objects and Fields

Key to tag formatting strings are the data that's loaded from the Discogs API and exposed via variables, or fields, for the scripts to operate on and ultimately write to tags. As with titleformatting strings, fields are accessed by wrapping their name with in % symbols, eg. %RELEASE_TITLE%. The name of a field specifies which data it is retrieving from the data model.

All exposed data attributes come from an "object" in the data model. All objects expose attributes, otherwise they would be useless. Many objects also expose sub-objects of their own. All tag formatting fields refer to attributes of an object, but they may be accessed through various paths of sub-objects. The following table lists the objects in the data model.

Object Description
RELEASE A Discogs release.
TRACK A track from a Discogs release.
DISC A disc parsed from the tracklist of a Discogs release.
ARTIST A Discogs artist.
MASTER_RELEASE A Discogs master release.
LABEL A label or company associated with the release.
SERIES A series, a group of releases by theme.
FORMAT A release medium format description.
CREDIT An accreditation of an artist.
IMAGE A release or artist image.

These objects are arranged in a hierarchy. At the top-level, there are a handful of root objects in the hierarchy. All tag formatting fields must begin at one of these root objects. The following table lists the available root objects.

Root Object Description
RELEASE The Discogs release selected via the find_release dialog.
TRACK The track from the Discogs release's tracklist that this file was matched with on the release dialog.
DISC The disc from the Discogs release's tracklist that this track belongs to. Parsed by foo_discogs from the Discogs tracklist.
MASTER_RELEASE The Discogs master release that this release belongs to, if applicable.
ARTISTS The artist(s) for the matched track, if applicable; otherwise, the artist(s) for the release. Technically, this is not a true root object, but a shortcut for the sub-objects TRACK_ARTISTS "or" RELEASE_ARTISTS (whichever is defined first).

Non-root objects can only be accessed as sub-objects via a parent object, ultimately stemming from a root object. The following table lists the sub-objects available for each object. The type of the sub-object should be obvious from its name.

Object Sub-object Type Description
RELEASE ARTISTS array Artists for the release.
RELEASE LABELS array Labels for the release.
RELEASE SERIES array Seriess for the release, if applicable.
RELEASE DISCS array Discs for the release. Each CD, Record, Tape, etc, is parsed as a separate disc.
RELEASE TRACKS array All tracks for the release.
RELEASE FORMATS array Formats for the release. Will include the format for each disc, and may include some additional.
RELEASE CREDITS array Credits for the release, if available. These are release-level, non-track-specific credits only.
RELEASE IMAGES array Images for the release, if available.
DISC TRACKS array All tracks for the disc.
DISC FORMAT single Format of this particular disc.
TRACK ARTISTS array Artists for the track, if applicable.
TRACK CREDITS array Credits for the track. All track-specific credits are put here, even if they were entered at the release level.
TRACK HIDDEN_TRACKS array Tracks hidden within this track. Additional tracks within the same audio file are placed here.
MASTER_RELEASE ARTISTS array Artists for the master release.
MASTER_RELEASE DISCS array Discs for the master release.
MASTER_RELEASE TRACKS array All tracks for the master release. TODO: verify if parsed same as for release or not...
CREDIT ARTISTS array Artists for a credit.
ARTIST IMAGES array Images for the artist, if available.

Sub-objects are traversed by concatenating their name after the parent object and an underscore (_), eg. DISC_FORMAT. To reiterate, all fields must start at root objects. For some fields, you may need to descend multiple layers of sub-objects, eg. RELEASE_CREDITS_ARTISTS.

Of course objects themselves, including sub-objects, are not the goal of fields. It is the data attributes of the objects that we are ultimately accessing by these fields, so any field name that terminated in an object or sub-object name (ie. %RELEASE%, %DISC_FORMAT%) would be incomplete and would not resolve to anything. Here are the data attributes exposed from each object.

Object Attribute Type Description
RELEASE ID string Discogs release id for the release.
RELEASE TITLE string Title for the release.
RELEASE COUNTRY string Country for the release.
RELEASE DATE string Release date formatted as "Mmm YYYY".
RELEASE DATE_RAW string Raw, unformatted release date string.
RELEASE YEAR string Release year.
RELEASE MONTH string Release month, if available.
RELEASE DAY string Release day, if available.
RELEASE NOTES string Raw release notes paragraph.
RELEASE BARCODE string Release barcode, if available.
RELEASE WEIGHT string Estimated weight, if available.
RELEASE TOTAL_DISCS string Total number of discs.
RELEASE TOTAL_TRACKS string Total number of tracks.
RELEASE DISCOGS_USERS_HAVE string Number of Discogs users who "have" this release.
RELEASE DISCOGS_USERS_WANT string Number of Discogs users who "want" this release.
RELEASE DISCOGS_AVG_RATING string Average rating by Discogs members.
RELEASE DISCOGS_RATING_VOTES string Number of rating votes.
RELEASE DISCOGS_STATUS string Release status in Discogs database.
RELEASE DISCOGS_DATA_QUALITY string Release data quality in Discogs database.
RELEASE DISCOGS_SUBMITTED_BY string Name of Discogs user who submitted this release.
RELEASE GENRES array Genres entered for release.
RELEASE STYLES array Styles entered for release.
RELEASE VIDEOS array Video URLs entered for release.
RELEASE SEARCH_FORMATS string Release formats string returned by artist search results.
RELEASE SEARCH_LABELS string Release labels string returned by artist search results.
RELEASE SEARCH_CATNOS string Release catalog numbers string returned by artist search results.
DISC NUMBER string Sequential number of this disc on the release, starting at 1.
DISC TOTAL_TRACKS string Total number of tracks on this disc.
TRACK NUMBER string Sequential number of this track on the release, starting at 1.
TRACK DISC_TRACK_NUMBER string Sequential number of this track on the disc, starting at 1.
TRACK TITLE string Title of this track.
TRACK INDEXTRACK_TITLE string Title of Index track this track falls under, if applicable.
TRACK HEADING string Heading portion of this track's title, if applicable.
TRACK SUBTRACK_TITLE string Sub-track title portion of this track's title, if applicable.
TRACK DISCOGS_DURATION_RAW string Raw duration value entered for this track. If a subtrack, contains index track duration.
TRACK DISCOGS_DURATION_SECONDS string Duration in seconds entered for this track. If a subtrack, contains index track duration.
TRACK DISCOGS_SUBTRACK_DURATION_RAW string Raw duration value entered for this subtrack, if applicable.
TRACK DISCOGS_SUBTRACK_DURATION_SECONDS string Duration in seconds entered for this subtrack, if aplicable.
ARTIST ID string Artist's id in Discogs database.
ARTIST NAME string Artist's name.
ARTIST NAME_VARIATION string Artist's name variation used, if applicable.
ARTIST JOIN string Join conjunction linking artist with previous artist, if applicable.
MASTER_RELEASE ID string Master release id in Discogs database.
MASTER_RELEASE TITLE string Master release title.
MASTER_RELEASE YEAR string Release year.
MASTER_RELEASE MAIN_RELEASE_ID string Release id of main release in master release.
MASTER_RELEASE DISCOGS_DATA_QUALITY string Data quality in Discogs database.
MASTER_RELEASE GENRES array Genres entered for master release.
MASTER_RELEASE STYLES array Styles entered for master release.
MASTER_RELEASE VIDEOS string Video URLs entered for master release.
LABEL ID string Label id in Discogs database.
LABEL NAME string Label name.
LABEL CATALOG_NUMBER string Catalog number of release on label.
SERIES ID string Series id in Discogs database.
SERIES NAME string Series name.
SERIES CATALOG_NUMBER string Catalog number of release in series.
SERIES NUMBER string Item number in series. Not necessarily an actual number.
FORMAT QUANTITY string Quality of format.
FORMAT NAME string Name of format.
FORMAT DESCRIPTIONS array Descriptions appended to format.
CREDIT ROLES_RAW string Raw credit roles string from Discogs.
CREDIT ROLES array Parsed list of credit roles.
CREDIT SHORT_ROLES array Parsed list of credit roles without any extra role information in brackets.
IMAGE TYPE string Image type on discogs - primary or secondary.
IMAGE URL string Image URL.
IMAGE THUMBNAIL_URL string Image thumbnail (150px) URL.

As with sub-objects, attributes are accessed by concatenating their name to after an underscore (_), eg. %DISC_FORMAT_QUANTITY%. We now have a complete data field variable: it begins at a root object, terminates at an attribute, and is wrapped with the % symbol.

Note: Some sub-objects, such as artist and labels, are not fully loaded from the release. In the past, foo_discogs v1 loaded these before writing tags, knowing in advance what fields were needed. In foo_discogs v2, these fields trigger additional loading from the Discogs API while writing tags. Hence, using fields like ARTISTS_PROFILE will additional loading and slower tag writing.

Note: if fields are missing, undefined, or not applicable, they return empty strings (or arrays of empty strings).

It's impossible to go further without finally discussing arrays. While arrays are the subject of the next section, we should first describe how they relate to fields. As shown in the above chart, fields can either return a string or an array of string values. Furthermore, sub-objects that are denoted as type "array" will wrap all of their attributes in an array. Therefore, if an array field is accessed via an array sub-object, or a string field via an array sub-object of an array sub-object, a nested array will be the return type. Only one root object, ARTISTS, is of array type.

Fields that return arrays are written with triangular brackets placed around their name, eg. %<ARTISTS_NAME>%. Fields that return a nested array (an array within an array) require multiple layers of triangular brackets, eg. %<<RELEASE_DISCS_TRACKS_NAME>>%. This rule is enforced in tag formatting strings for the sake of clarity and explicitness. You should always understand what exactly is being returned from a data field. Otherwise, you won't know how to manipulate it or what is being written to the tag.

Arrays

To extend titleformatting scripting with arrays, we have encoded arrays inside strings using special, non-character bytes as markers. As a consequence, unfortunately, builtin titleformatting functions cannot be used on foo_discogs arrays, as they are not aware of our encoding, will likely cause corruption, and will almost certainly not work as intended. Instead, we have re-implemented most of the builtin functions with their name prefixed with "multi_" (because the default functions cannot be overwritten). They will be described in the section on functions.

In the examples in this document, arrays will be denoted between square brackets, ie. [abc,def,ghi] is an array consisting of the elements "abc", "def", and "ghi". Because arrays can be nested arbitrarily, we need some terminology to talk about their dimensions.

The "depth" of an array A, denoted as D in our discourse, speaks to level of nesting of arrays inside it. For example, [a,b,c] is an array of depth 1, [[x,y,z]] of depth 2, and [[[]]] of depth 3. An array of depth 0 is a simple string. An array of depth 2 contains sub-array(s) of depth 1. You'll notice that [[x],[y],[z]] is also an array of depth 2. Hence, depth alone is not enough to know the shape of an array.

The "width" of an array is its length. For example, [a,b,c,d,e] has width 5. An array of depth 2's width is its immediate number of sub-arrays. For example, [[x,y,z]] has width 1 while [[x],[y],[z]] has width 3.

The "shape" of an array generally refers to its depth, its width, and the width of each of its nested sub-arrays. We don't attempt to quantitatively define the shape of an array. We only discuss it because some operations (ie. functions) on arrays only make sense when the array conforms to a certain shape, and most operations on multiple arrays only make sense if the arrays are of compatible shape.

To write a multi-value tag, the tag formatting string for that tag should resolve to an array. Each value in the array will be written as a value to the tag. Note: Empty strings are always ignored when writing to tags.

Arrays are coerced into a simple string by joining their elements. There are two cases where foo_discogs implicitly joins arrays (using ", " as the delimiter; see function $join(A) described below). The first case is if a tag formatting string returns an array of depth > 1. The array will be coerced to depth 1 by joining its nested sub-arrays. The second case is when a field that returns an array is not accessed with triangular braces (eg. %ARTISTS_NAME% instead of %<ARTISTS_NAME>%).

Note: The depth of arrays is issumed to be uniform. For example, an array cannot have one sub-array of depth 2 and another of depth 1.

Functions

The following special functions all deal with array operations. Most builtin titleformatting functions cannot be used on foo_discogs arrays. Hence, many of the builtin functions are reimplemented below, prefixed with "multi_".

Most functions operating on arrays operate at a certain depth. When we say that a function operates at depth 0, we mean that it operates on the outermost nested array. At the opposite extreme, a function operating at depth D (where D is the depth of the array), is operating on the individual strings at the bottom of the nested arrays. A function operating at depth D-1 is operating on an array of depth 1. For example, given A = [[[a,b,c]]], an function operating at depth D-1 is operating on [a,b,c], a function operating at depth D on a, b, and c, and a function operating at depth 0 on [[[a,b,c]]] as a whole.

Syntax Description Examples
$split(s,d) Splits string s into an array of parts around delimiter d. Returns an array of depth 1. $split('abcd,efg,hijk',',') => [abcd,efg,hijk]
$split(s) Equivalent to $split(s,', ').
$join(A,B) Joins array A using delimiter B. Operates at depth D-1 in A and depth D in B. Returns an array of depth D-1. B must be a compatible array of the same shape or smaller than A.
Note: $join removes and ignores empty strings from A, also skipping their delimiter in B.
$join([aaa,bbb,ccc],123) => aaa123bbb123ccc123
$join([[aaa,bbb,ccc]],[111,222,333] => [aaa111bbb222ccc333]
$join(A) Equivalent to $join(A,', '). $join([duck,frog,lion]) => duck, frog, lion
$zip(A,X,...) Concatenates strings in A at depth D with X, etc. Operates at depth D and returns an array of the same shape as A. X, etc, must be compatible arrays of the same shape or smaller than A.
Note: $zip does not concatenate to A where A is the empty string.
$zip([aaa,,ccc],XXX,[1,2,3]) => [aaaXXX1,,cccXXX3]
$array(A), $array(A,N) Creates an array with N sub-elements, A. N is option and defaults to 1. $array(aa,3) => [aa,aa,aa]
$unique(A) Removes non-unique elements from A. Operates at depth 0. Returns an array with depth D but possibly smaller width at depth 0. $unique([aa,bb,aa,cc,aa,dd]) => [aa,bb,cc,dd]
$flatten(A) Flattens nested array A. Returns array of depth 1 containing all strings of A at depth D. $flatten([[[a,b]],[[c,d]]]) => [a,b,c,d]
$extend(A,X,...) Adds elements of X, etc, to A. Operates at depth D-1. Returns array of depth D, possibly wider at depth D-1. Arrays X, etc, must depth D and the same width at 0 ≥ depth ≤ D-1. $extend([[a,b]],[[c,d]]) => [[a,b,c,d]]
$sextend(A,X,...) Shallow version of $extend that operates at depth 0. Returns an array of depth D, possibly wider at depth 0. Arrays X, etc, must have depth D and the same width at 1 ≥ depth ≤ D. $sextend([[a,b]],[[c,d]]) => [[a,b],[c,d]]
$append(A,X,...) Adds X, etc, to array A. If A is a simple string, A is treated as [A]. Operates at depth D-1 on A, depth D on X, etc. Returns an array of depth D, possibly wider a depth D-1. Arrays X, etc, must have depth D-1 and the same width at 0 ≥ depth ≤ D-2. $append(a,b,c) => [a,b,c] $append([[aa,ab]],[bb,bc]) => [[aa,ab,bb,bc]]
$sappend(A,X,...) Shallow version of $append that operates at depth 0. Returns an array of depth D, possibly wider at depth 0. Arrays X, etc, must have depth D-1 and the same width at 0 ≥ depth ≤ D-2. $sappend(a,b,c) => [a,b,c] $sappend([[aa,ab]],[bb,bc]) => [[aa,ab],[bb,bc]]
$contains(A,Q) Tests whether Q is contained in A. Operates at depth D-1 on both A and Q. Array Q must be of compatible shape at depth 0 ≥ depth ≤ D-1. Returns a boolean array of depth D, but of the width of Q at depth D. $contains([[aa,ab]],[aa,bb,ab,bb]) => [[1,,1,]]
$filter(A,Q) Removes values in Q from A. Operates at depth D-1 on both A and Q, or depth D in Q if Q is a simple string. Returns an array of similar shape to A, but possibly less wide at depth D-1. $filter([[aa,ab]],aa) => [[ab]] $filter([[aa,ab]],[[ac,ab]]) => [[aa]]
$first(A) Returns first element from array A. Operates at depth 0. Returns an array of depth D-1. $first([aa,bb,cc]) => aa $first([[aa,ab,ac],[ba,bb,bc]]) => [aa,ab,ac]
$last(A) Returns last element from array A. Operates at depth 0. Returns an array of depth D-1. $last([aa,bb,cc]) => cc $last([[aa,ab,ac],[ba,bb,bc]]) => [ba,bb,bc]
$element(A,n) Returns nth element from array A. Operates at depth 0. Returns an array of depth D-1. n must be an integer. $element([aa,bb,cc],2) => bb
$length(A) Returns width of array A at depth 0, as a simple string. $length([[aa,ab,ac],[ba,bb,bc]]) => 2
$any(A) Tests whether any elements of A at depth D-1 evaluate to true. Returns a boolean array of depth D-1. $any([[,,],[a,b,c],[a,,]]) => [,1,1]
$all(A) Tests whether all elements of A at depth D-1 evaluate to true. Returns a boolean array of depth D-1. $all([[,,],[a,b,c],[a,,]]) => [,1,]
$sum(A) Counts the number of all elements of A at depth D-1 that evaluate to true. Returns an array of depth D-1. $sum([[,,],[a,b,c],[a,,]]) => [,3,1]
$multi_replace(A,X,Y) Replaces X with Y in A. Operates at depth D. Returns array of the same shape as A. X and Y must be compatible arrays of same shape or smaller than A. $multi_replace([[aa,ab,ac]],aa,[[xx,yy,zz]]) => [[xx,ab,ac]]
$multi_trim(A) Trims whitespace from elements of A. Operates at depth D. Returns array of the same shape as A. $multi_trim([[ aa,ab ,a c, ]]) => [[aa,ab,a c,]]
$multi_strcmp(A,X) Performs $strcmp() on an array. Operates at depth D. Returns array of the same shape as A. X must be a compatible array of same size or smaller than A. $multi_strcmp([[aa,ab,ac]],ab) => [[,1,]]
$multi_strstr(A,X) Performs $strstr() on an array. Operates at depth D. Returns array of the same shape as A. X must be a compatible array of same size or smaller than A. $multi_strstr([[aab,aba,abc,aac]],b) => [[2,1,1,]]
$multi_pad(A,N), $multi_pad_right(A,N) Pads elements of A with spaces up to N characters. Operates at depth D. Returns array of the same shape as A. N must be a compatible integer array of same size or smaller than A. $multi_pad([x,y,z],3) => [x ,y ,z ]
$multi_wrap(A,S) Wraps elements of A with string S. Operates at depth D. Returns array of the same shape as A. N must be a compatible integer array of same size or smaller than A. $multi_pad([x,y,z],3) => [x ,y ,z ]
$multi_pad(A,N,X), $multi_pad_right(A,N,X) Pads elements of A with with character X up to N characters. Operates at depth D. Returns array of the same shape as A. N and X must be a compatible arrays of same size or smaller than A. N must be an integer, X a character. $multi_pad_right([x,yz],[2,3],[a,b]) => [ax,ayz]
$multi_cut(A,N) Array version of $cut(). Operates at depth D. Return an integer array of the same shape as A.
$multi_if(A,X,Y) Performs $if() on an array A, returning X where A evaluates to true and Y where A evaluates to false. Operates at depth D. Returns an array of the same shape as A. X and Y must be compatible arrays of the same size or smaller than A. $multi_if([[,,],[a,b,c],[a,,]],[A,B,C],no) => [[no,no,no],[B,B,B],[C,no,no]]
$multi_if2(A,Y) Performs $if2() on an array A. Same as $multi_if(A,A,Y). $multi_if2([,1,1,],no) => [no,1,1,no]
$multi_and(A,X,...) Returns true where both A and X evaluate to true, false otherwise. Operates at depth D. Returns a boolean array of the same shape as A. X must be a compatible array of the same size or smaller than A. $multi_or([[,,],[a,b,c],[a,,]],no) => [[no,no,no],[a,b,c],[a,no,no]]
$multi_or(A,X,...) Returns A where A evaluates to true, or X where it evaluates to true, or false. Operates at depth D. Returns an array of the same shape as A. X must be a compatible array of the same size or smaller than A. $multi_or([[,,],[a,b,c],[a,,]],no) => [[no,no,no],[a,b,c],[a,no,no]]
$multi_not(A) Returns false where A evaluates to true and vice versa. Operates at depth D. Returns a boolean array of the same shape as A. $multi_not([[,,],[a,b,c],[a,,]],no) => [[1,1,1],[,,,],[,1,1]]
$multi_len(A) Array version of $len(). Operates at depth D. Returns an integer array of the same shape as A.
$multi_longest(A,B,...) Array version of $longest(). Operates at depth D. Returns an array of the same shape as A.
$multi_longer(A,B), $multi_greater(A,B) Array versions of $longer() and $greater(). Operate at depth D. Return boolean arrays of the same shape as A.
$multi_left(A,N), $multi_right(A,N) Array version sof $left() and $right. Operate at depth D. Return arrays of the same shape as A.
$multi_add(A,B,...), $multi_sub(A,B,...), $multi_mul(A,B,...), $multi_div(A,B), $multi_mod(A,B), $multi_min(A,B,...), $multi_max(A,B,...) Array version of math functions. Operate at depth D. $multi_meta(nonexistent_tag) => [] $multi_meta(existent_tag) => [value1,value2,value3]
$multi_meta(N) Array version of $meta(). Loads values of tag named N into an array of depth 1. $multi_meta(nonexistent_tag) => [] $multi_meta(existent_tag) => [value1,value2,value3]
$pput(N,V), $pputs(N,V), $pget(N) Similar to $put(), $puts(), and $get(), but persist across all tag formatting strings for a single file.
Note: If used, these functions create a dependency on the order in which tags are defined.
$pput(temp,[1,2,3]) => [1,2,3] $pputs(temp,[1,2,3]) => '' $pget(temp) => [1,2,3]
$prompt(N) Prompt user for value when generating tags. $prompt(temp) => value

Note: $multi_if and other boolean functions are slightly different than their builtin counterparts. The builtin functions are based on a truth value that is not accessible to custom functions, so the custom functions instead treat an empty string as false and anything else as true. Hence, something like $if(%MISSINGTAG%) is false while $multi_if(%MISSINGTAG%) is true, because %MISSINGTAG% returns "?". However, $multi_if($meta(MISSINGTAG)) will be false. Also, $if(X) is false where X is any number or character string, whereas $multi_if() will be true in this case.

All builtin titleformatting functions can be used on arrays of depth 0, or simple strings, the builtin functions that generate strings can still be used to generate strings, and the variable operations (ie. $put and $get) can be used to store and retrieve arrays, since they don't modify their arguments.

Examples

Finally, let's look at some examples of tag formatting strings, including some changes likely to be popular with users.

1. Number tracks for the entire release, not starting at 1 for each disc:

TRACKNUMBER = $num(%TRACK_NUMBER%,2)

2. Use master release date instead of release date, if applicable:

DATE = $if2(%MASTER_RELEASE_YEAR%,%RELEASE_YEAR%)

3. Replace "Various" with "VA" in album artist:

ALBUM ARTIST = $join($multi_replace(%<RELEASE_ARTISTS_NAME>%,'Various','VA'),$multi_wrap(%<RELEASE_ARTISTS_JOIN>%,' '))

4. Calculate percentage of track numbers from master release that exactly match track names from release:

$puts(a,$multi_count($put(x,$contains(%<RELEASE_TRACKS_TITLE>%,%<MASTER_RELEASE_TRACKS_TITLE>%))))$puts(b,$multi_length($get(x)))$div($add($mul($get(a),100),$div($get(b),2)),$get(b))'%'

Refer to the default tag formatting strings in foo_discogs for additional examples.

Internal Usages

Within foo_discogs, tag formatting strings are used in several other contexts to allow users to customize parts of the interface.

Usage Description
Release formatting string In the releases list, all releases and master releases for the selected artist are shown, optionally filtered. Release entries in the list are formatted by this string. This formatting string has access to the respective RELEASE object and, if applicable, MASTER_RELEASE object. It should return a single string representing the release.

Note: Using fields not available from the Discogs search results will cause an additional API call for each release in the list which will be very slow. Not recommended.

Default: $if(%MASTER_RELEASE_ID%,' '$ifequal(%RELEASE_ID%,%MASTER_RELEASE_MAIN_RELEASE_ID%,'* ',' '),)$join($append(%RELEASE_TITLE%,%RELEASE_SEARCH_LABELS%,%RELEASE_SEARCH_FORMATS%,%RELEASE_YEAR%,%RELEASE_SEARCH_CATNOS%))
Master formatting string In the releases list, all releases and master releases for the selected artist are shown, optionally filtered. Master release entries in the list are formatted by this string. This formatting string has access to the respective MASTER_RELEASE object. It should return a single string representing the master release.

Note: Using fields not available from the Discogs search results will cause an additional API call for each master release in the list which will be slow. Not recommended.

Default: '[master] '$join($append(%MASTER_RELEASE_TITLE%,%MASTER_RELEASE_YEAR%))
Tracklist Discogs formatting string In the left pane of the tracklist, Discogs tracks are shown. Entries in this list are formatted by this string. This formatting string has access to the RELEASE, DISC, and TRACK objects for the individual track. It should return a single string representing the track.

Default: $ifgreater(%RELEASE_TOTAL_DISCS%,1,%DISC_NUMBER%-,)$num(%TRACK_DISC_TRACK_NUMBER%,2) - $multi_if($multi_and(%ARTISTS_NAME_VARIATION%,$multi_not(%REPLACE_ANVS%)),%ARTISTS_NAME_VARIATION%$multi_if(%DISPLAY_ANVS%,*,),%ARTISTS_NAME%) - %TRACK_TITLE%$ifequal(%TRACK_TOTAL_HIDDEN_TRACKS%,0,,' [+'%TRACK_TOTAL_HIDDEN_TRACKS%' HIDDEN]')
Tracklist file formatting string In the right pane of the tracklist, selected files are shown. Entries in this list are formatted by this string. This formatting string has access to the file info only. It should return a string representing the file.

Default: $if($strcmp($ext(%path%),tags),$info(@),%path%)
Album/artist art directory The directory that album or artist artwork is saved to is determined by these formatting strings. The formatting string has access to the relevant RELEASE or ARTIST object that the artwork is being saved for. Additionally, it has access to the IMAGE object for the image being saved. The formatting string should resolve to a single directory in which the artwork for the given release or artist will be saved. If the string resolves to "null", artwork will not be saved.

Default: $directory_path(%path%)
Album/artist art file prefix The file names that album or artist artword are saved as are determined by these formatting strings. The formatting string has access to the relevant RELEASE or ARTIST object that the artwork is being saved for. Additionally, it has access to the IMAGE object for the image being saved. A custom field %IMAGE_NUMBER% resolves to the sequential number of image being saved, in the case that fetch all available art is enabled and more than one image exists. The formatting string should resolve to a single file name for the given artist image. If the string resolves to "null", the image will be skipped.

Default: $directory_path(%path%)
Artist IDs to download artwork for When saving artist artwork, the artist IDs that artwork is saved for are determined by this formatting string. The formatting string has access to the RELEASE and, if applicable, MASTER_RELEASE that artist artwork is being saved for. It should return an array of artist IDs.

Default: %<RELEASE_ARTISTS_ID>%

Additional Help

For additional help or questions, try the foo_discogs discussion thread on hydrogenaudio forums.