※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

TitleFormat 私的日本語訳


Foobar2000:Titleformat Reference
From Hydrogenaudio Knowledgebase
Contents [hide]
1 Field remappings
1.1 Metadata
1.1.1 %album artist%
1.1.2 %album%
1.1.3 %artist%
1.1.4 %disc%
1.1.5 %discnumber%
1.1.6 %track artist%
1.1.7 %title%
1.1.8 %track%
1.1.9 %tracknumber%
1.2 Technical information
1.2.1 %bitrate%
1.2.2 %channels%
1.2.3 %filesize%
1.2.4 %samplerate%
1.2.5 %codec%
1.3 Special fields
1.3.1 %playlist_number%
2 Control flow
2.1 [...] (conditional section)
2.2 $if(cond,then)
2.3 $if(cond,then,else)
2.4 $if2(a,else)
2.5 $if3(a1,a2,...,aN,else)
2.6 $ifgreater(n1,n2,then,else)
2.7 $iflonger(s1,s2,then,else)
2.8 $select(n,a1,...,aN)
3 Arithmetic functions
3.1 $add(a,b)
3.2 $div(a,b)
3.3 $greater(a,b)
3.4 $max(a,b)
3.5 $min(a,b)
3.6 $mod(a,b)
3.7 $mul(a,b)
3.8 $muldiv(a,b,c)
3.9 $rand()
3.10 $sub(a,b)
4 Boolean functions
4.1 $and(...)
4.2 $or(...)
4.3 $not(x)
4.4 $xor(...)
5 Color functions
5.1 $blend(color1,color2,part,total)
5.2 $rgb()
5.3 $rgb(r,g,b)
5.4 $rgb(r1,g1,b1,r2,g2,b2)
5.5 $transition(string,color1,color2)
6 Now playing info
6.1 Special fields
6.1.1 %_time_elapsed%
6.1.2 %_time_remaining%
6.1.3 %_time_total%
6.1.4 %_time_elapsed_seconds%
6.1.5 %_time_remaining_seconds%
6.1.6 %_time_total_seconds%
6.1.7 %_ispaused%
7 Playlist info
7.1 Special fields
7.1.1 %isplaying%
7.1.2 %_ispaused%
7.1.3 %_playlist_number%
7.1.4 %_playlist_total%
7.1.5 %playlist_name%
8 String functions
8.1 $abbr(x)
8.2 $abbr(x,len)
8.3 $ansi(x)
8.4 $caps(x)
8.5 $caps2(x)
8.6 $char(x)
8.7 $crlf()
8.8 $cut(a,len)
8.9 $directory(x)
8.10 $directory(x,n)
8.11 $ext(x)
8.12 $filename(x)
8.13 $fix_eol(x)
8.14 $fix_eol(x,indicator)
8.15 $hex(n)
8.16 $hex(n,len)
8.17 $insert(a,b,n)
8.18 $left(a,len)
8.19 $len(a)
8.20 $len2(a)
8.21 $longer(a,b)
8.22 $lower(a)
8.23 $longest(a,...)
8.24 $num(n,len)
8.25 $pad(x,len)
8.26 $pad_right(x,y)
8.27 $pad(x,len,char)
8.28 $pad_right(x,len,char)
8.29 $padcut(x,len)
8.30 $padcut_right(x,len)
8.31 $progress(pos,range,len,a,b)
8.32 $progress2(pos,range,len,a,b)
8.33 $repeat(a,n)
8.34 $replace(a,b,c)
8.35 $right(a,len)
8.36 $roman(n)
8.37 $shortest
8.38 $strchr(s,c)
8.39 $strrchr(s,c)
8.40 $strstr(s1,s2)
8.41 $strcmp(s1,s2)
8.42 $stricmp(s1,s2)
8.43 $substr(s,m,n)
8.44 $trim(s)
8.45 $tab()
8.46 $tab(n)
8.47 $upper(s)
9 Track info
9.1 Metadata
9.1.1 $meta(name)
9.1.2 $meta(name,n)
9.1.3 $meta_sep(name,sep)
9.1.4 $meta_sep(name,sep,lastsep)
9.1.5 $meta_test(...)
9.1.6 $meta_num(name)
9.1.7 $tracknumber()
9.1.8 $tracknumber(n)
9.2 Technical information
9.2.1 $info(name)
9.2.2 $codec()
9.2.3 $channels()
9.2.4 %__replaygain_album_gain%
9.2.5 %__replaygain_album_peak%
9.2.6 %__replaygain_track_gain%
9.2.7 %__replaygain_track_peak%
9.3 Special fields
9.3.1 $extra(name)
9.3.1.1 filename
9.3.1.2 filename_ext
9.3.1.3 directoryname
9.3.1.4 path
9.3.1.5 path_raw
9.3.1.6 subsong
9.3.1.7 foobar2000_version
9.3.1.8 length
9.3.1.9 length_ex
9.3.1.10 length_seconds
9.3.1.11 length_seconds_fp
9.3.1.12 length_samples
10 Variable operations
10.1 $get(name)
10.2 $put(name,value)
10.3 $puts(name,value)
11 Component-provided fields and functions on tracks
11.1 Playback statistics
12 Component-specific fields and functions
12.1 Album list
12.2 Columns UI



[edit]Field remappings
Some of the fields accessible through %name% are remapped to other values to make writing titleformat scripts more convenient.

[edit]Metadata
[edit]%album artist%
Defined as $if3($meta(album artist),$meta(artist),$meta(composer),$meta(performer)).

[edit]%album%
Defined as $if3($meta(album),$meta(venue)).

[edit]%artist%
Defined as $if3($meta(artist),$meta(album artist),$meta(composer),$meta(performer)).

[edit]%disc%
Returns the discnumber. The discnumber is taken from the discnumber tag; if that does not exist, it is taken from the disc tag. If neither exist, the field is undefined.

This is equivalent to the %discnumber% remapping.

[edit]%discnumber%
Returns the discnumber. The discnumber is taken from the discnumber tag; if that does not exist, it is taken from the disc tag. If neither exist, the field is undefined.

This is equivalent to the %disc% remapping.

[edit]%track artist%
Defined as $meta(artist), if $meta(album artist) is different than $meta(artist), otherwise this field is empty.

[edit]%title%
Defined as $if2($meta(title),%_filename%). Returns the title tag if available, otherwise it returns the filename excluding the extension.

[edit]%track%
Returns the tracknumber padded to two digits from the left with zeroes. The tracknumber is taken from the tracknumber tag; if that does not exist, it is taken from the track tag. If neither exist, this field is undefined.

This is equivalent to the %tracknumber% remapping.

[edit]%tracknumber%
Returns the tracknumber padded to two digits from the left with zeroes. The tracknumber is taken from the tracknumber tag; if that does not exist, it is taken from the track tag. If neither exist, this field is undefined.

This is equivalent to the %track% remapping.

[edit]Technical information
[edit]%bitrate%
Defined as $if2($info(bitrate_dynamic),$info(bitrate)). Returns the current bitrate, if available, otherwise it returns the average bitrate. If neither is available, nothing is returned.

[edit]%channels%
Defined as $channels(). Returns the number of channels in text form; returns "mono" and "stereo" instead of "1" and "2".

[edit]%filesize%
Defined as %_filesize%. Returns the filesize in bytes.

[edit]%samplerate%
Defined as $info(samplerate). Returns the samplerate in Hz.

[edit]%codec%
Defined as $codec().

[edit]Special fields
[edit]%playlist_number%
Defined as $num(%_playlist_number%,$len(%_playlist_total%)). Returns the position of the track as index into the playlist. The first track has index 1. The index is padded from the left with zeroes to the same number of digits as the last track.

[edit]Control flow
The functions in this section can be used to conditionally execute statements.

[edit][...] (conditional section)
Evaluates the expression between [ and ]. If it has the truth value true, its string value and the truth value true are returned. Otherwise an empty string and false are returned.

Example: [%artist%] returns the value of the artist tag, if it exists. Otherwise it returns nothing, when artist would return "?".

[edit]$if(cond,then)
If cond evaluates to true, the then part is evaluated and its value returned. Otherwise, false is returned.

[edit]$if(cond,then,else)
If cond evaluates to true, the then part is evaluated and its value returned. Otherwise, the else part is evaluated and its value returned.

[edit]$if2(a,else)
Like $if(a,a,else) except that a is only evaluated once.




[edit]$if3(a1,a2,...,aN,else)
Evaluates arguments a1 ... aN, until one is found that evaluates to true. If that happens, its value is returned. Otherwise the else part is evaluated and its value returned.

[edit]$ifgreater(n1,n2,then,else)
Compares the integer numbers n1 and n2, if n1 is greater than n2, the then part is evaluated and its value returned. Otherwise the else part is evaluated and its value returned.

[edit]$iflonger(s1,s2,then,else)
Compares the length of the strings s1 and s2, if s1 is longer than s2, the then part is evaluated and its value returned. Otherwise the else part is evaluated and its value returned.

[edit]$select(n,a1,...,aN)
If the value of n is between 1 and N, an is evaluated and its value returned. Otherwise false is returned.

[edit]Arithmetic functions
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string, that can be interpreted as number. Leading whitespace is ignored.

Example: "c3po" -> 0, " -12" -> -12, but "- 12" -> 0

[edit]$add(a,b)
Adds a and b.

Can be used with an arbitrary number of arguments. $add(a,b,...) is the same as $add($add(a,b),...).

[edit]$div(a,b)
Divides a through b. If b evaluates to zero, it returns a.

Can be used with an arbitrary number of arguments. $div(a,b,...) is the same as $div($div(a,b),...).

[edit]$greater(a,b)
Returns true, if a is greater than b, otherwise false.

[edit]$max(a,b)
Returns the maximum of a and b.

Can be used with an arbitrary number of arguments. $max(a,b,...) is the same as $max($max(a,b),...).

[edit]$min(a,b)
Returns the minimum of a and b.

Can be used with an arbitrary number of arguments. $min(a,b,...) is the same as $min($min(a,b),...).

[edit]$mod(a,b)
Computes the remainder of dividing a through b. The result has the same sign as a. If b evaluates to zero, the result is a.

Can be used with an arbitrary number of arguments. $mod(a,b,...) is the same as $mod($mod(a,b),...).

[edit]$mul(a,b)
Multiplies a and b.

Can be used with an arbitrary number of arguments. $mul(a,b,...) is the same as $mul($mul(a,b),...).

[edit]$muldiv(a,b,c)
Multiplies a and b, then divides by c. The result is rounded to the nearest integer.

[edit]$rand()
Generates a random number in the range from 0 to 232-1.

[edit]$sub(a,b)
Subtracts b from a.

Can be used with an arbitrary number of arguments. $sub(a,b,...) is the same as $sub($sub(a,b),...).

[edit]Boolean functions
The functions in this section can be used to work with truth values (true and false), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with $if and related functions.

[edit]$and(...)
Logical And of an arbitrary number of arguments. Returns true, if and only if all arguments evaluate to true.

Special case: $and(x,y) is true, if both x and y are true. Otherwise it is false.

[edit]$or(...)
Logical Or of an arbitrary number of arguments. Returns true, if at least one argument evaluates to true.

Special case: $or(x,y) is true, if x or y is true, or if both are true. Otherwise it is false.

[edit]$not(x)
Logical Not. Returns false, if x is true, otherwise it returns true.

[edit]$xor(...)
Logical Exclusive-or of an arbitrary number of arguments. Returns true, if an odd number of arguments evaluate to true.

Special case: $xor(x,y) is true, if one of x and y is true, but not both. Otherwise it is false.

[edit]Color functions
[edit]$blend(color1,color2,part,total)
Returns a color that is a blend between color1 and color2. If part is smaller than or equal to zero, color1 is returned. If part is greater than or equal to total, color2 is returned. Otherwise a blended color is returned that is part parts color1 and total-part parts color2. The blending is performed in the RGB color space.

[edit]$rgb()
Resets the text color to the default color.

[edit]$rgb(r,g,b)
Sets the color for text. r, g and b are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.

[edit]$rgb(r1,g1,b1,r2,g2,b2)
Sets the color for text. r1, g1 and b1 are the red, green and blue component of the color for unselected text. r2, g2 and b2 are the red, green and blue component for the color of selected text.

[edit]$transition(string,color1,color2)
Inserts color codes into string, so that the first character has color1, the last character has color2, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying $transition.

[edit]Now playing info
The following functions and fields are usable for scripts used with the currently playing item, for example the status bar, the main window title and the copy command script.

[edit]Special fields
[edit]%_time_elapsed%
Returns elapsed time.

[edit]%_time_remaining%
Returns remaining time until track ends.

[edit]%_time_total%
Returns total length of track.

[edit]%_time_elapsed_seconds%
Returns elapsed time in seconds.

[edit]%_time_remaining_seconds%
Returns remaining time in seconds.

[edit]%_time_total_seconds%
Returns total track length in seconds.

[edit]%_ispaused%
Returns "1" if playback is paused and empty string otherwise.

[edit]Playlist info
The following functions and fields are usable for playlist scripts.

[edit]Special fields
[edit]%isplaying%
Returns "1" if file is currently playing and empty string otherwise.

The old version %_isplaying% still works.

[edit]%_ispaused%
Returns "1" if playback is paused, empty string otherwise.

[edit]%_playlist_number%
Returns playlist index of specified item. The first item is at index 1.

Also see %playlist_number%.

[edit]%_playlist_total%
Returns number of items in the playlist.

[edit]%playlist_name%
Returns the name of the playlist containing the specified item.

The old version %_playlist_name% still works.

[edit]String functions
The functions in this section can be used to manipulate character strings.

[edit]$abbr(x)
Returns abbreviation of x.

[edit]$abbr(x,len)
Returns abbreviation of x, if x is longer than len characters, otherwise returns x.

[edit]$ansi(x)
Converts x to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.

[edit]$caps(x)
Converts first letter in every word of x to uppercase, and all other letters to lowercase.

[edit]$caps2(x)
Converts first letter in every word of x to uppercase, and leaves all other letters as they are.

[edit]$char(x)
Inserts Unicode character with code x.

[edit]$crlf()
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system notification area ("systray") icon.

[edit]$cut(a,len)
Returns first len characters on the left of a.

[edit]$directory(x)
Extracts directory name from the file path x.

[edit]$directory(x,n)
Extracts directory name from the file path x; goes up by n levels.

[edit]$ext(x)
Extracts file extension from x which must be a file name or path.

[edit]$filename(x)
Extracts file name from full path.

[edit]$fix_eol(x)
If x contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by " (...)". Otherwise x is returned unaltered.

[edit]$fix_eol(x,indicator)
If x contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by indicator. Otherwise x is returned unaltered.

[edit]$hex(n)
Formats the integer number n in hexadecimal notation.

[edit]$hex(n,len)
Formats the integer number n in hexadecimal notation with len digits. Pads with zeros from the left if necessary.

[edit]$insert(a,b,n)
Inserts b into a after n characters.

[edit]$left(a,len)
Returns the first len characters from the left of a.

[edit]$len(a)
Returns length of string a in characters.

[edit]$len2(a)
Returns length of string x in characters, respecting double-width character rules (double-width characters will be counted as two).

[edit]$longer(a,b)
Returns true, if string a is longer than string b, false otherwise.

[edit]$lower(a)
Converts a to lowercase.

[edit]$longest(a,...)
Returns the longest of its arguments. Can be used with an arbitrary number of strings.

[edit]$num(n,len)
Formats the integer number n in decimal notation with len digits. Pads with zeros from the left if necessary.

[edit]$pad(x,len)
Pads x from the left with spaces to len characters.

[edit]$pad_right(x,y)
Pads x from the right with spaces to len characters.

[edit]$pad(x,len,char)
Pads x from the left with char to len characters.

[edit]$pad_right(x,len,char)
Pads x from the right with char to len characters.

[edit]$padcut(x,len)
Returns first len characters from the left of x, if x is longer than len characters. Otherwise pads x from the left with spaces to len characters.

[edit]$padcut_right(x,len)
Returns first len characters from the left of x, if x is longer than len characters. Otherwise pads x from the right with spaces to len characters.

[edit]$progress(pos,range,len,a,b)
Creates a progress bar: pos contains position, range contains range, len progress bar length in characters, a and b are characters to build progress bar with.

Example:$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,'#','=') produces "====#===============", the # character is moving with playback position.

[edit]$progress2(pos,range,len,a,b)
Creates a progress bar: pos contains position, range contains range, len progress bar length in characters, a and b are characters to build progress bar with. Produces different appearance than $progress.

[edit]$repeat(a,n)
Returns n copies of a. Note that a is evaluated once before its value is used, so $repeat cannot be used for loops.

[edit]$replace(a,b,c)
Replaces all occurrences of string b in string a with string c.

Can also be used with an arbitrary number of arguments. Note that $replace(a,b1,c1,b2,c2) is generally not the same as $replace($replace(a,b1,c1),b2,c2).

Example: $replace(ab,a,b,b,c) -> "bc", $replace($replace(ab,a,b),b,c) -> "cc"

[edit]$right(a,len)
Returns the first len characters from the right of a.

[edit]$roman(n)
Formats the integer number n in roman notation.

[edit]$shortest
Returns the shortest of its arguments. Can be used with an arbitrary number of strings.

[edit]$strchr(s,c)
Finds first occurence of character c in string s.

Example: $strchr(abca,a) -> 1

[edit]$strrchr(s,c)
Finds last occurence of character c in string s.

Example: $strrchr(abca,a) -> 4

[edit]$strstr(s1,s2)
Finds first occurence of string s2 in string s1.

[edit]$strcmp(s1,s2)
Performs a case-sensitive comparison of the strings s1 and s2.

[edit]$stricmp(s1,s2)
Performs a case-insensitive comparison of the strings s1 and s2.

[edit]$substr(s,m,n)
Returns substring of string s, starting from m-th character and ending at n-th character.

[edit]$trim(s)
Removes leading and trailing spaces from string s.

[edit]$tab()
Inserts one tabulator character.

[edit]$tab(n)
Inserts n tabulator characters.

[edit]$upper(s)
Converts string s to uppercase.

[edit]Track info
The functions and fields in this section can be used to access information about tracks.

[edit]Metadata
[edit]$meta(name)
Returns value of tag called name. If multiple values of that tag exist, they are concatenated with ", " as separator.

Example: $meta(artist) -> "He, She, It"

[edit]$meta(name,n)
Returns value of n-th tag called name.

Example: $meta(artist,2) -> "She"

[edit]$meta_sep(name,sep)
Returns value of tag called name. If multiple values of that tag exist, they are concatenated with sep as separator.

Example: $meta_sep(artist,' + ') -> "He + She + It"

[edit]$meta_sep(name,sep,lastsep)
Returns value of tag called name. If multiple values of that tag exist, they are concatenated with sep as separator between all but the last two values which are concatenated with lastsep.

Example: $metasep(artist,', ',', and ') -> "He, She, and It"

[edit]$meta_test(...)
Returns true, if all given tags exist.

Example: $meta_test(artist,title) -> true

[edit]$meta_num(name)
Returns the number of values for the tag called name.

Example: $meta_num(artist) -> 3

[edit]$tracknumber()
Returns the tracknumber padded to 2 digits with zeroes.

[edit]$tracknumber(n)
Returns the tracknumber padded to n digits with zeros.

[edit]Technical information
[edit]$info(name)
Returns value of technical information field called name.

Example: $info(channels) -> 2

[edit]$codec()
Returns codec of track. If no codec field is present, it the uses file extension.

Example: $codec() -> "WavPack"

[edit]$channels()
Returns number of channels in text format.

Example: $channels() -> "stereo"

[edit]%__replaygain_album_gain%
Returns ReplayGain album gain value. //Not available through// $info(replaygain_album_gain).

[edit]%__replaygain_album_peak%
Returns ReplayGain album peak value. //Not available through// $info(replaygain_album_peak).

[edit]%__replaygain_track_gain%
Returns ReplayGain track gain value. //Not available through// $info(replaygain_track_gain).

[edit]%__replaygain_track_peak%
Returns ReplayGain track peak value. //Not available through// $info(replaygain_track_peak).

[edit]Special fields
[edit]$extra(name)
Returns the value of the special field called name. These fields can also be accessed as %_name%; note the additional underscore. The following field names can be used:

[edit]filename
Returns the filename without directory and extension.

[edit]filename_ext
Returns the filename with extension, but without the directory.

[edit]directoryname
Returns the name of the parent directory only, not the complete path.

[edit]path
Returns the path.

[edit]path_raw
Returns the path as URL including the protocol scheme.

[edit]subsong
Returns the subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.

[edit]foobar2000_version
Returns a string representing the version of foobar2000.

[edit]length
Returns the length of the track formatted as hours, minutes, and seconds.

[edit]length_ex
Returns the length of the track formatted as hours, minutes, seconds, and milliseconds.

[edit]length_seconds
Returns the length of the track in seconds.

[edit]length_seconds_fp
Returns the length of the track in seconds as floating point number.

[edit]length_samples
Returns the length of the track in samples.

[edit]Variable operations
Variables can be used to store strings and number. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.

[edit]$get(name)
Returns the value that was last stored in the variable name, if the variable was not defined (yet), it returns nothing. The truth value returned by $get indicates if the variable name was defined.

[edit]$put(name,value)
Stores value in the variable name and returns value unaltered.

[edit]$puts(name,value)
Stores value in the variable name and returns only the truth value of value.

[edit]Component-provided fields and functions on tracks
This section lists components that provide additional fields and functions that are useable in the context of any track.

[edit]Playback statistics
Playback statistics homepage
Playback statistics titleformat reference
[edit]Component-specific fields and functions
This section lists components that provide additional fields and functions that are only useable in the context of the particular component.

[edit]Album list
The official album list component supports creating multiple tree entries using special commands.

Album list homepage
Album list titleformat reference
[edit]Columns UI
Columns UI homepage
Global variables reference
Playlist colors reference
Playlist switcher reference
Retrieved from "http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference"
ViewsArticleDiscussionEditHistory Personal toolsCreate an account or log in NavigationMain Page
Topic Index
HAK Community
Current events
Recent changes
Random page
Help
Donations
Search ToolboxWhat links here
Related changes
Upload file
Special pages
Printable version

This page was last modified 22:23, 14 January 2006. This page has been accessed 13,076 times. Content is available under GNU Free Documentation License 1.2. About Hydrogenaudio Knowledgebase Disclaimers
  

更新履歴

取得中です。