Titleformat API
English API reference for the titleformat family.
This page is the primary owner for the namespaces listed below. Method names, parameter keys, and return fields follow the C++ RegisterApi handlers.
titleformat
titleformat.eval
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path to evaluate the pattern against. |
pattern | string | Yes | Titleformat pattern to compile and evaluate. |
Returns: {"error":"...","path":"...","pattern":"...","result":"...","success":true}
js
const { result } = await fb2k.invoke('titleformat.eval', {
path: 'C:\\Music\\song.flac',
pattern: '%artist% - %title%'
});titleformat.evalBatch
| Parameter | Type | Required | Description |
|---|---|---|---|
paths | array | Yes | File path list to evaluate. |
pattern | string | Yes | Titleformat pattern compiled once and reused for every path. |
Returns: {"error":"...","errorCount":"...","pattern":"...","results":"...","success":true,"successCount":"...","total":"..."}
js
const { results } = await fb2k.invoke('titleformat.evalBatch', {
paths: ['C:\\Music\\song.flac', 'C:\\Music\\other.mp3'],
pattern: '%codec% %bitrate%kbps'
});titleformat.evalFields
| Parameter | Type | Required | Description |
|---|---|---|---|
fields | object | Yes | Map of result field name to titleformat pattern. |
path | string | Yes | File path to evaluate the patterns against. |
Returns: {"error":"...","path":"...","success":true}
js
const result = await fb2k.invoke('titleformat.evalFields', {
fields: { title: '%title%', artist: '%artist%', length: '%length%' },
path: 'C:\\Music\\song.flac'
});titleformat.evalFieldsBatch
| Parameter | Type | Required | Description |
|---|---|---|---|
fields | object | Yes | Map of result field name to titleformat pattern. |
paths | array | Yes | File path list to evaluate. |
Returns: {"error":"...","errorCount":"...","results":"...","success":true,"successCount":"...","total":"..."}
js
const { results } = await fb2k.invoke('titleformat.evalFieldsBatch', {
fields: { title: '%title%', album: '%album%' },
paths: ['C:\\Music\\song.flac', 'C:\\Music\\other.mp3']
});titleformat.getBuiltinFields
No parameters.
Returns: {"fields":[],"success":true}
js
const result = await fb2k.invoke('titleformat.getBuiltinFields');Evaluation semantics
titleformat.evalrequires a non-emptypathandpattern. Invalid patterns and unavailable files returnsuccess: falsewitherror.titleformat.evalBatchrequires an arraypathsand a non-emptypattern; per-item failures are retained inresults, whilesuccessCountanderrorCountsummarize the batch.titleformat.evalFieldsandtitleformat.evalFieldsBatchrequire an objectfields. Each key becomes a response property; non-string field expressions are returned asnullfor that key.titleformat.getBuiltinFieldsis a convenience reference generated by the runtime. It does not guarantee that optional component fields such as play-count data are populated for every installation or track.