TitleFormatting
JSplitter provides global Title Formatting fields for its statistics database and foobar2000 directories. These fields are available wherever foobar2000 evaluates global display fields, including formatting through fb.TitleFormat and EvalWithMetadb.
Statistics fields
These values belong to the JSplitter statistics database, not to audio-file tags. Scripts manage them through the linked FbMetadbHandle methods.
| Field | Value | Setter |
|---|---|---|
| %jsplitter_playcount% | Play count stored by the script. | SetPlaycount |
| %jsplitter_loved% | Loved value stored by the script. | SetLoved |
| %jsplitter_first_played% | First-played string stored by the script. | SetFirstPlayed |
| %jsplitter_last_played% | Last-played string stored by the script. | SetLastPlayed |
| %jsplitter_rating% | Rating value stored by the script. | SetRating |
Numeric fields are absent when their stored value is 0; string fields are absent when empty. ClearStats clears all five values. No fixed rating scale or date-string format is imposed by these fields.
Directory fields
| Field | Value | JavaScript equivalent |
|---|---|---|
| %jsplitter_fb2k% | foobar2000 installation directory. | fb.FoobarPath |
| %jsplitter_fb2k_profile% | foobar2000 profile/configuration directory. | fb.ProfilePath |
Both values are native filesystem paths with a trailing backslash and support Unicode. They are initialized at startup and remain fixed for the session. The fields use the jsplitter_ prefix so they do not register the unprefixed names used by other components.
Using fields in JavaScript
Evaluate Title Formatting through fb.TitleFormat; the field names are not JavaScript variables. Eval with true also evaluates the expression when playback is stopped:
const profile = fb.TitleFormat('%jsplitter_fb2k_profile%').Eval(true);
const imagePath = profile + 'images\\cover.png';
Statistics fields refer to the track being formatted:
const track = fb.GetNowPlaying();
if (track) {
const rating = fb.TitleFormat('$if2(%jsplitter_rating%,0)').EvalWithMetadb(track);
console.log(rating);
}
Process environment variables
The directory names jsplitter_fb2k and jsplitter_fb2k_profile are also set as Windows environment variables in the foobar2000 process. Their values are the same paths as the Title Formatting fields. Child processes inherit them when they inherit foobar2000's environment. The system-wide and user environment are not modified.
A path input field can expand %jsplitter_fb2k% or %jsplitter_fb2k_profile% if its component supports the corresponding Title Formatting or environment-variable expansion. Registration does not make every text field perform expansion automatically.
Relative paths inside scripts
Supported file and image methods resolve relative paths as described in utils.ReadTextFile. To obtain the main script's own full path for custom path handling or external tools, use the Path property of window.ScriptInfo. Directory fields identify foobar2000 directories, not the main script's directory.