CUETools Templates

From CUETools
Jump to navigation Jump to search

CUETools output path templates are based on foobar2000 title formatting syntax. (However CUETools only uses some of them.)

Note 240px.png Note: CUETools and CUERipper expect you to define the output path in a template to a CUE file (even if one will not be created), so if you do not have .cue at the end of the output path template, CUETools and CUERipper will automatically add it for you.

Conditional section

Text enclosed in brackets [] is removed if variables inside are undefined. For example, %year% - %album% can evaluate as %year% - Dark Side Of The Moon if the date is unspecified but [%year% - ]%album% evaluates to 1973 - Dark Side Of The Moon if the date is specified in CUE Sheet or tags, else it evaluates to Dark Side Of The Moon.

Variables

  • %music% is replaced by current user's 'My Music' folder.
  • %unique% is replaced by a number starting from 1, and increased until the output path is unique.
  • %filename% is replaced by the input filename (without source directory and extension).
  • %directoryname% is replaced by the path to the input file.
  • %artist% is replaced by the artist name.
  • %album% is replaced by the album name.
  • %year% is replaced by the album date.
  • %discnumber% is replaced by the disc number in a multidisc release.
  • %disctotal% is replaced by the total number of discs in a multidisc release.
  • %totaldiscs% {outdated form} see %disctotal%

MusicBrainz variables

Metadata via CTDB. Variables may be undefined for freedb metadata so you should place inside of brackets [] to make conditional.

  • %discname% is replaced by the Disc Subtitle Name of the disc in a multidisc release.
  • %label% is replaced by the Label Name(s) of the release.
  • %labelno% is replaced by the Label Catalog Number of the release.
  • %country% is replaced by the Release Country.
  • %releasedate% is replaced by the Release Date in YYYY-MM-DD format.
  • %barcode% is replaced by the Release Barcode.

Combined variables

MusicBrainz metadata via CTDB. Variables may be undefined for freedb metadata so you should place inside of brackets [] to make conditional.

  • %discnumberandname% when %disctotal% > 1 is replaced by [%discnumber%] of %disctotal%[ - %discname%], else undefined.
  • %labelandnumber% is replaced by %label% %labelno% or either defined variable within, else undefined.
  • %releasedateandlabel% is replaced by %country% - %labelandnumber% - %releasedate% or any combination of defined variables within, else undefined.

Other variables

Considered tag names and are replaced by the value of the corresponding tag from the Input file(s). Metadata from CTDB and manual edits are not evaluated.

  • %edition% is used to demonstrate that you can use any custom tag that you might have in your files.
  • %genre% is replaced by the Genre name.
  • %comment% is replaced by the Comment field. Warning: Comments can be very long.

Track specific tags, e.g. %tracknumber%, cannot be used in output path templates.

Using variables in other templates

Single Format template
  • %filename% is replaced by the CUE Paths Output filename (without source directory and extension).
  • %album artist% is replaced by the album artist name.
Track Format template
  • %tracknumber% is replaced by the track number.
  • %artist% is replaced by the track artist name.
  • %album artist% is replaced by the album artist name.

Some other track specific variables, e.g. %tracktotal%, %totaltracks% {outdated form}, are not available.

CUETools/verify/accurip Log File Name Template
  • %filename% is replaced by either the CUE Paths Input or Output filename (without source directory and extension) depending on where the file is written.
  • %album artist% is replaced by the album artist name.

Functions

  • $len(a) calculates the length of given text (in characters)
  • $max(x,y) calculates the maximum of two numbers
  • $ifgreater(x,y,a,b) evaluates to "a" if integer x > integer y, else it evaluates to "b".
  • $iflonger(string,n,a,b) compares length of string to integer n, if longer it evaluates to a, else it evaluates to b.
  • $ifequal(x,y,a,b) evaluates to "a" if integer x = integer y, else it evaluates to "b".
  • $if(x,a,b) evaluates to "a" if "x" is true, else it evaluates to "b".
  • $if2(a,b) evaluates to "a" if "a" is true, else it evaluates to "b".
  • $if3(a1,a2,a3,...,b) evaluates to first of "a1,a2,a3,..." that is true, else it evaluates to "b".

Quotation Mark

  • Text enclosed in single quotation marks, e.g. '(%)' is inserted bypassing syntax processing. This allows special characters such as % $ [ ] ( ) to be inserted. In order to insert a quotation mark character, use '' (two single quotation marks).

Examples

 %music%\Converted\%artist%\[%year% - ]%album%[ - %edition%]
 $ifgreater($max(%discnumber%,%totaldiscs%),1, - cd %discnumber%,)
 [' ('%unique%')']\%artist% - %album%[ - %edition%].cue

This template can produce the following:

 C:\Users\johndoe\My Music\Converted\Pink Floyd\1973 - The Dark Side Of The Moon\Pink Floyd - The Dark Side Of The Moon.cue

If such file already exists, then %unique% variable will be set to 1 and the following output be produced:

 C:\Users\johndoe\My Music\Converted\Pink Floyd\1973 - The Dark Side Of The Moon (1)\Pink Floyd - The Dark Side Of The Moon.cue

If edition tag is set e.g. to CP35-3017, this will produce

 C:\Users\johndoe\My Music\Converted\Pink Floyd\1973 - The Dark Side Of The Moon - CP35-3017\Pink Floyd - The Dark Side Of The Moon - CP35-3017.cue

If %discnumber% or %totaldiscs% is greater than 1, " - cd %discnumber%" section will be activated:

 C:\Users\johndoe\My Music\Converted\Pink Floyd\1969 - Ummagumma - cd 1\Pink Floyd - Ummagumma.cue


 %music%\Converted\%artist%\[%year% - ]%album%[ '('disc %discnumberandname%')'][' ('%releasedateandlabel%')'][' ('%unique%')']\%artist% - %album%.cue

This default template can produce the following (using MusicBrainz metadata via CTDB):

 C:\Users\johndoe\My Music\Converted\Pink Floyd\2011 - Discovery (disc 09 of 16 - The Dark Side of the Moon) (US - EMI 50999 0 82613 2 8 - 2011-09-27)\Pink Floyd - Discovery.cue

If using freedb metadata via CTDB this template can produce:

 C:\Users\johndoe\My Music\Converted\Pink Floyd\1973 - The Dark Side Of The Moon\Pink Floyd - The Dark Side Of The Moon.cue


 %music%\Converted\%artist%\[%year% - ]%album%[' ('%releasedateandlabel%')'][' ('%unique%')']\%artist% - %album%[ '('disc %discnumberandname%')'].cue

This default template can produce the following (using MusicBrainz metadata via CTDB):

 C:\Users\johndoe\My Music\Converted\Pink Floyd\2011 - Discovery (US - EMI 50999 0 82613 2 8 - 2011-09-27)\Pink Floyd - Discovery (disc 09 of 16 - The Dark Side of the Moon).cue

If using freedb metadata via CTDB this template can produce:

 C:\Users\johndoe\My Music\Converted\Pink Floyd\1973 - The Dark Side Of The Moon\Pink Floyd - The Dark Side Of The Moon.cue