Documentation/FbTitleFormat
classWORKERCLONEABLE

FbTitleFormat

js/foo_uie_jsplitter.js:6107
FbTitleFormat(expression)

Performance note: if you use the same query frequently, try caching FbTitleFormat object (by storing it somewhere), instead of creating it every time.

Parameters

NameTypeDescription
expressionstring
methodWORKERMAIN THREAD

Eval

js/foo_uie_jsplitter.js:6118
Eval(force)

Always use Eval when you want dynamic info such as %playback_time%, %bitrate% etc.
FbTitleFormat#EvalWithMetadb(fb.GetNowplaying()) will not give the results you want.

Parameters

NameTypeDescription
force = falseoptionalboolean

If true, you can process text that doesn't contain title formatting even when foobar2000 isn't playing. When playing, you should always get a result.

Returns

string

Example

let tfo = fb.TitleFormat("%artist%");
console.log(tfo.Eval());
methodWORKERMAIN THREAD

EvalActivePlaylistItem

js/foo_uie_jsplitter.js:6135
EvalActivePlaylistItem(playlistItemIndex)

Evaluates this title formatting expression for an item in the active playlist. Use this method to access playlist-specific fields such as %list_index%, %list_total% and %isplaying%.

Parameters

NameTypeDescription
playlistItemIndexnumber

Zero-based item index in the active playlist.

Returns

string

Throws

Error —

If there is no active playlist or playlistItemIndex is invalid.

methodWORKERMAIN THREAD

EvalPlaylistItem

js/foo_uie_jsplitter.js:6147
EvalPlaylistItem(playlistIndex, playlistItemIndex)

Evaluates this title formatting expression for an item in a specific playlist. Use this method to access playlist-specific fields such as %list_index%, %list_total% and %isplaying%.

Parameters

NameTypeDescription
playlistIndexnumber

Zero-based playlist index.

playlistItemIndexnumber

Zero-based item index in the playlist.

Returns

string

Throws

Error —

If playlistIndex or playlistItemIndex is invalid.

methodWORKER

EvalWithMetadb

js/foo_uie_jsplitter.js:6160
EvalWithMetadb(handle, want_full_info)

Parameters

NameTypeDescription
handleFbMetadbHandle
want_full_info = falseoptionalboolean

This enables full retrieval of tags that have been blocked with [b][url=https://www.foobar2000.org/LargeFieldsConfig-v2]LargeFieldsConfig-v2[/url][/b] in the latest foobar2000 2.26 previews.

Returns

string

Example

let tfo = fb.TitleFormat("%artist%");
console.log(tfo.EvalWithMetadb(fb.GetFocusItem()));
methodWORKER

EvalWithMetadbs

js/foo_uie_jsplitter.js:6172
EvalWithMetadbs(handle_list)

Parameters

NameTypeDescription
handle_listFbMetadbHandleList

Returns

Array<string>

Example

let tfo = fb.TitleFormat("%artist%");
let handle_list = fb.GetLibraryItems();
let artists = tfo.EvalWithMetadbs(handle_list);
console.log(handle_list.Count === artists.length); // should always be true!