fb#
Properties
| fb.AlwaysOnTop | boolean |
read, write | |
| fb.ComponentPath | string |
read | |
| fb.FoobarPath | string |
read | |
| fb.ProfilePath | string |
read | |
| fb.VersionString | string |
read |
Example
fb.AlwaysOnTop = !fb.AlwaysOnTop; // toggles the current value
console.log(fb.FoobarPath); // Z:\foobar2000\
Methods
fb.AddDirectory()#
Shortcut to main menu command.
No return value.
fb.AddFiles()#
Shortcut to main menu command.
No return value.
fb.AddLocationsAsync(paths)#
| Arguments | ||
|---|---|---|
| paths | array |
An array of strings which could be files, urls, playlists. |
Returns a unique task_id.
Similar to plman.AddLocations except rather than specifiying a target playlist, you get a handle list generated from the supplied paths/urls which are sent to a new on_locations_added callback.
Example
var files = ["z:\\1.mp3", "z:\\2.flac"];
function on_mouse_lbtn_dblclk() {
var task_id = fb.AddLocationsAsync(files);
console.log("got task_id", task_id);
}
function on_locations_added(task_id, handle_list) {
console.log("callback task_id", task_id);
console.log(handle_list.Count);
}
fb.CheckClipboardContents()#
Returns a boolean value.
Checks clipboard contents are handles or a file selection
from Windows Explorer. Use in conjunction with
fb.GetClipboardContents.
fb.CheckComponent(name)#
| Arguments | ||
|---|---|---|
| name | string |
Returns a boolean value.
Use this if your script depends on other components.
Example
if (!fb.CheckComponent("foo_playcount")) {
utils.ShowPopupMessage("This script requires foo_playcount.", "Rating");
}
fb.ClearPlaylist()#
No return value.
Clears active playlist. If you wish to clear a specific playlist, use plman.ClearPlaylist.
fb.CreateContextMenuManager()#
Returns a JsContextMenuManager instance.
fb.CreateHandleList([handle])#
| Arguments | ||
|---|---|---|
| handle | JsMetadbHandle, optional |
Returns a JsMetadbHandleList instance.
Example
var handle = fb.GetFocusItem();
var handle_list = fb.CreateHandleList(handle);
var image_path = ...
handle_list.AttachImage(image_path, 0);
fb.CreateMainMenuManager(root_name)#
| Arguments | ||
|---|---|---|
| root_name | string |
Must be one of File, Edit, View, Playback, Library, Help. |
Returns a JsMainMenuManager instance.
fb.EnumerateMainMenuCommands()#
Returns a JSON array in string form so you need to use JSON.parse on the result.
Every item of the array has the following properties:
Checked // boolean
Disabled // boolean
FullPath // string, the same full path you'd supply to fb.RunMainMenuCommand
HiddenByDefault // boolean
Radio // boolean
Fixed // boolean, some menu items such as playlist names or output devices are dynamic as opposed to fixed
Visible // boolean
Example
let menu_commands = JSON.parse(fb.EnumerateMainMenuCommands());
// list all checked commands in the Console
menu_commands
.filter(command => command.Checked)
.forEach(command => console.log(command.FullPath));
fb.Exit()#
Shortcut to main menu command.
No return value.
fb.GetAlbumArtStub([art_id])#
| Arguments | ||
|---|---|---|
| art_id | AlbumArtId | Default 0. |
Returns a JsImage instance or null on failure.
fb.GetAudioChunk(requested_length[, offset])#
| Arguments | ||
|---|---|---|
| requested_length | number |
seconds |
| offset | number |
Default 0 |
Returns a JsAudioChunk instance or null on failure.
fb.GetClipboardContents()#
Returns a JsMetadbHandleList instance.
Clipboard contents can be handles copied to the clipboard in other components, a file selection from Explorer, etc.
Example
include(fb.ComponentPath + 'helpers.js');
function on_mouse_rbtn_up(x, y) {
var ap = plman.ActivePlaylist;
// PlaylistCanAddItems is defined in helpers.js, it uses
// plman.GetPlaylistLockFilterMask to determine if the active playlist
// permits adding items
// MF_STRING and MF_GRAYED are also defined there.
var can_paste_flag = PlaylistCanAddItems(ap) && fb.CheckClipboardContents() ? MF_STRING : MF_GRAYED;
var menu = window.CreatePopupMenu();
menu.AppendMenuItem(can_paste_flag, 1, "Paste");
var idx = menu.TrackPopupMenu(x, y);
if (idx == 1) {
var handle_list = fb.GetClipboardContents();
plman.InsertPlaylistItems(ap, plman.GetPlaylistItemCount(ap), handle_list);
}
return true;
}
fb.GetFocusItem()#
Returns a JsMetadbHandle instance.
Handle of the currently focused active playlist item or null on failure.
fb.GetLibraryItems([query])#
| Arguments | ||
|---|---|---|
| query | string |
Optional. If omitted or invalid, all items will be returned. |
Returns a JsMetadbHandleList instance.
fb.GetSelection([flags])#
| Arguments | ||
|---|---|---|
| flags | number |
Default 0, 1 no now playing |
Returns a JsMetadbHandleList instance.
fb.GetSelectionType()#
Returns a SelectionType
fb.IsLibraryEnabled()#
Returns a boolean value.
fb.IsLibraryInitialised()#
Returns a boolean value.
fb.LoadPlaylist()#
Shortcut to main menu command.
No return value.
fb.RunContextCommand(command)#
| Arguments | ||
|---|---|---|
| command | string |
The full path to the command must be supplied. Case is not important. |
Returns true if a matching command was found, false otherwise.
Note
This method is for the currently playing file only. See also: JsMetadbHandleList RunContextCommand.
fb.RunMainMenuCommand(command)#
| Arguments | ||
|---|---|---|
| command | string |
The full path to the command must be supplied. Case is not important. |
Returns true if a matching command was found, false otherwise.
fb.SavePlaylist()#
Shortcut to main menu command.
No return value.
fb.ShowConsole()#
Shortcut to main menu command.
No return value.
fb.ShowLibrarySearchUI(query)#
| Arguments | ||
|---|---|---|
| query | string |
No return value.
Opens the Library>Search window populated with the query you set.
fb.ShowPictureViewer(path)#
| Arguments | ||
|---|---|---|
| path | string |
No return value.
fb.ShowPreferences()#
Shortcut to main menu command.
No return value.
fb.TitleFormat(pattern)#
| Arguments | ||
|---|---|---|
| pattern | string |
Returns a JsTitleFormat instance.