Documentation/plman
namespaceWORKER

plman

js/foo_uie_jsplitter.js:1634

Functions for managing foobar2000 playlists.

propertyWORKERMAIN THREAD

ActivePlaylist

js/foo_uie_jsplitter.js:1642
ActivePlaylist: number

-1 if there is no active playlist.

Throws

Error —

If the assigned playlist index is out of bounds.

Examples

console.log(plman.ActivePlaylist);
plman.ActivePlaylist = 1; // Switches to 2nd playlist.
propertyWORKERMAIN THREAD

PlaybackOrder

js/foo_uie_jsplitter.js:1658
PlaybackOrder: number

See PlaybackOrder enum 0 - Default
1 - Repeat (Playlist)
2 - Repeat (Track)
3 - Random
4 - Shuffle (tracks)
5 - Shuffle (albums)
6 - Shuffle (folders)

Throws

Error —

If the assigned playback-order id is unknown.

propertyWORKERMAIN THREAD

PlayingPlaylist

js/foo_uie_jsplitter.js:1676
PlayingPlaylist: number

-1 if there is no playing playlist.

Throws

Error —

If the assigned playlist index is out of bounds.

Example

console.log(plman.PlayingPlaylist);
propertyWORKERMAIN THREADreadonly

PlaylistCount

js/foo_uie_jsplitter.js:1689
PlaylistCount: number
propertyWORKERreadonly

PlaylistRecycler

js/foo_uie_jsplitter.js:1697
PlaylistRecycler: FbPlaylistRecycler

A Recycle Bin for playlists.

methodWORKERMAIN THREAD

AddItemToPlaybackQueue

js/foo_uie_jsplitter.js:2368
AddItemToPlaybackQueue(handle)

Parameters

NameTypeDescription
handleFbMetadbHandle

Throws

Error —

If handle is null.

methodWORKERMAIN THREAD

AddLocations

js/foo_uie_jsplitter.js:1706
AddLocations(playlistIndex, paths, select)

This operation is asynchronous and may take some time to complete if it's a large array.

Relative filesystem paths are resolved as described in utils.ReadTextFile. URLs and foobar2000 URI paths are passed through unchanged. Each filesystem location is resolved before the asynchronous operation starts.

Parameters

NameTypeDescription
playlistIndexnumber
pathsArray<string>

An array of files/URLs

select = falseoptionalboolean

If true, the active playlist will be set to the playlistIndex, the items will be selected and focus will be set to the first new item.

Throws

Error —

If playlistIndex is invalid or a playlist lock prevents adding items.

Example

plman.AddLocations(plman.ActivePlaylist, ["e:\\1.mp3"]);
// This operation is asynchronous, so any code in your script directly
// after this line will run immediately without waiting for the job to finish.
methodWORKERMAIN THREAD

AddPlaylistItemToPlaybackQueue

js/foo_uie_jsplitter.js:2376
AddPlaylistItemToPlaybackQueue(playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber
methodWORKERMAIN THREAD

ClearPlaylist

js/foo_uie_jsplitter.js:1727
ClearPlaylist(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Example

plman.ClearPlaylist(plman.PlayingPlaylist);
methodWORKERMAIN THREAD

ClearPlaylistSelection

js/foo_uie_jsplitter.js:1737
ClearPlaylistSelection(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Example

plman.ClearPlaylistSelection(plman.ActivePlaylist);
methodWORKERMAIN THREAD

CreateAutoPlaylist

js/foo_uie_jsplitter.js:1747
CreateAutoPlaylist(playlistIndex, name, query, sort, flags)

Parameters

NameTypeDescription
playlistIndexnumber
namestring

Name for the new autoplaylist.

querystring

Title formatting pattern for forming the playlist content.

sort = ''optionalstring

Title formatting pattern for sorting.

flags = 0optionalnumber

1 - when set, will keep the autoplaylist sorted and prevent user from reordering it.

Returns

number —

Index of the created playlist.

Throws

Error —

If foobar2000 rejects the autoplaylist query or sort expression.

methodWORKERMAIN THREAD

CreatePlaylist

js/foo_uie_jsplitter.js:1760
CreatePlaylist(playlistIndex, name)

Parameters

NameTypeDescription
playlistIndexnumber
namestring

Returns

number —

Index of the created playlist.

Examples

// Creates a new playlist named "New playlist", which is put at the beginning of the current playlists.
plman.CreatePlaylist(0, '');
// Create a new playlist named "my favourites", which is put at the end.
plman.CreatePlaylist(plman.PlaylistCount, 'my favourites');
methodWORKERMAIN THREAD

DuplicatePlaylist

js/foo_uie_jsplitter.js:1777
DuplicatePlaylist(playlistIndex, name)

Note: the duplicated playlist gets inserted directly after the source playlistIndex.
It only duplicates playlist content, not the properties of the playlist (e.g. Autoplaylist).

Parameters

NameTypeDescription
playlistIndexnumber
nameoptional?string

A name for the new playlist. If the name is "" or undefined, the name of the source playlist will be used.

Returns

number —

Index of the created playlist.

Throws

Error —

If from is out of bounds.

methodWORKERMAIN THREAD

EnsurePlaylistItemVisible

js/foo_uie_jsplitter.js:1790
EnsurePlaylistItemVisible(playlistIndex, playlistItemIndex)

Signals playlist viewers to display the track (e.g. by scrolling to it's position).

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber
methodWORKERMAIN THREAD

ExecutePlaylistDefaultAction

js/foo_uie_jsplitter.js:1800
ExecutePlaylistDefaultAction(playlistIndex, playlistItemIndex)

Starts playback by executing default doubleclick/enter action unless overridden by a lock to do something else.

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber

Returns

boolean —

-1 on failure.

methodWORKERMAIN THREAD

FindByGUID

js/foo_uie_jsplitter.js:1844
FindByGUID(guid)

Parameters

NameTypeDescription
guidstring

String representing GUID.

Returns

number —

Index of the found playlist on success, -1 on failure.

Throws

Error —

If foobar2000 is older than 2.0.

methodWORKERMAIN THREAD

FindOrCreatePlaylist

js/foo_uie_jsplitter.js:1811
FindOrCreatePlaylist(name, unlocked)

Returns playlist index of the named playlist or creates a new one, if not found.
If a new playlist is created, the playlist index of that will be returned.

Parameters

NameTypeDescription
namestring
unlockedboolean

If true, locked playlists are ignored when looking for existing playlists. If false, the playlistIndex of any playlist with the matching name will be returned.

Returns

number —

Index of the found or created playlist.

methodWORKERMAIN THREAD

FindPlaybackQueueItemIndex

js/foo_uie_jsplitter.js:2384
FindPlaybackQueueItemIndex(handle, playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
handleFbMetadbHandle
playlistIndexnumber
playlistItemIndexnumber

Returns

number —

Returns position in queue on success, -1 if track is not in queue.

Throws

Error —

If handle is null.

methodWORKERMAIN THREAD

FindPlaylist

js/foo_uie_jsplitter.js:1824
FindPlaylist(name)

Parameters

NameTypeDescription
namestring

Case insensitive.

Returns

number —

Index of the found playlist on success, -1 on failure.

methodWORKERMAIN THREAD

FlushPlaybackQueue

js/foo_uie_jsplitter.js:2395
FlushPlaybackQueue()
methodWORKERMAIN THREAD

GetGUID

js/foo_uie_jsplitter.js:1832
GetGUID(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

string

Throws

Error —

If foobar2000 is older than 2.0.

Example

console.log(plman.GetGUID(plman.ActivePlaylist));
methodWORKERMAIN THREAD

GetPlaybackQueueContents

js/foo_uie_jsplitter.js:2402
GetPlaybackQueueContents()

Returns

Array<FbPlaybackQueueItem>

Example

let contents = plman.GetPlaybackQueueContents();
if (contents.length) {
    // access properties of first item
    console.log(contents[0].PlaylistIndex, contents[0].PlaylistItemIndex);
}
methodWORKERMAIN THREAD

GetPlaybackQueueHandles

js/foo_uie_jsplitter.js:2416
GetPlaybackQueueHandles()

Returns

FbMetadbHandleList

Example

let handles = plman.GetPlaybackQueueHandles();
if (handles.Count > 0) {
   // use "Count" to determine if Playback Queue is active.
}
methodWORKERMAIN THREAD

GetPlayingItemLocation

js/foo_uie_jsplitter.js:1853
GetPlayingItemLocation()

Retrieves playlist position of currently playing item.
On failure, the property FbPlayingItemLocation.IsValid will be set to false.

Returns

FbPlayingItemLocation
methodWORKERMAIN THREAD

GetPlaylistFocusItemIndex

js/foo_uie_jsplitter.js:1863
GetPlaylistFocusItemIndex(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

number —

Returns -1 if nothing is selected

Example

let focus_item_index = plman.GetPlaylistFocusItemIndex(plman.ActivePlaylist); // 0 would be the first item
methodWORKERMAIN THREAD

GetPlaylistItems

js/foo_uie_jsplitter.js:1874
GetPlaylistItems(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

FbMetadbHandleList

Example

let handle_list = plman.GetPlaylistItems(plman.PlayingPlaylist);
methodWORKERMAIN THREAD

GetPlaylistLockedActions

js/foo_uie_jsplitter.js:1885
GetPlaylistLockedActions(playlistIndex)

Returns the list of blocked actions

Parameters

NameTypeDescription
playlistIndexnumber

Returns

Array<string> —

May contain the following:
- 'AddItems'
- 'RemoveItems'
- 'ReorderItems'
- 'ReplaceItems'
- 'RenamePlaylist'
- 'RemovePlaylist'
- 'ExecuteDefaultAction'

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

GetPlaylistLockName

js/foo_uie_jsplitter.js:1903
GetPlaylistLockName(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

?string —

name of lock owner if there is a lock, null otherwise

Throws

Error —

If playlistIndex is out of bounds or the playlist lock name cannot be queried.

methodWORKERMAIN THREAD

GetPlaylistName

js/foo_uie_jsplitter.js:1912
GetPlaylistName(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

string

Example

console.log(plman.GetPlaylistName(plman.ActivePlaylist));
methodWORKERMAIN THREAD

GetPlaylistSelectedIndexes

js/foo_uie_jsplitter.js:1923
GetPlaylistSelectedIndexes(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

Array<number>

Throws

Error —

If playlistIndex is invalid.

Example

let selected_indexes = plman.GetPlaylistSelectedIndexes(plman.ActivePlaylist);
methodWORKERMAIN THREAD

GetPlaylistSelectedItems

js/foo_uie_jsplitter.js:1935
GetPlaylistSelectedItems(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

FbMetadbHandleList

Example

let selected_items = plman.GetPlaylistSelectedItems(plman.ActivePlaylist);
methodWORKERMAIN THREAD

InsertPlaylistItems

js/foo_uie_jsplitter.js:1946
InsertPlaylistItems(playlistIndex, base, handle_list, select)

Parameters

NameTypeDescription
playlistIndexnumber
basenumber

Position in playlist

handle_listFbMetadbHandleList

Items to insert

select = falseoptionalboolean

If true then inserted items will be selected

Throws

Error —

If handles is null.

Examples

Add all library tracks to the beginning of playlist.
let ap = plman.ActivePlaylist;
plman.InsertPlaylistItems(ap, 0, fb.GetLibraryItems());
Add all library tracks to end of playlist.
let ap = plman.ActivePlaylist;
plman.InsertPlaylistItems(ap, plman.PlaylistItemCount(ap), fb.GetLibraryItems());
methodWORKERMAIN THREAD

InsertPlaylistItemsFilter

js/foo_uie_jsplitter.js:1965
InsertPlaylistItemsFilter(playlistIndex, base, handle_list, select)

Same as plman.InsertPlaylistItems except any duplicates contained in handle_list are removed.

Parameters

NameTypeDescription
playlistIndexnumber
basenumber

Position in playlist

handle_listFbMetadbHandleList

Items to insert

select = falseoptionalboolean

If true then inserted items will be selected

Throws

Error —

If handles is null.

methodWORKERMAIN THREAD

InvertSelection

js/foo_uie_jsplitter.js:1978
InvertSelection(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

If playlistIndex is invalid.

methodWORKERMAIN THREAD

IsAutoPlaylist

js/foo_uie_jsplitter.js:1986
IsAutoPlaylist(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

IsPlaylistItemSelected

js/foo_uie_jsplitter.js:1995
IsPlaylistItemSelected(playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber

Returns

boolean
methodWORKERMAIN THREADdeprecated

IsPlaylistLocked

js/foo_uie_jsplitter.js:2004
IsPlaylistLocked(playlistIndex)
Deprecated.

Note: returns true, if the playlist is an autoplaylist. To determine if a playlist is not an autoplaylist, but locked with something like foo_utils or foo_playlist_attributes, use with conjunction of plman.IsAutoPlaylist.
Deprecated: use plman.GetPlaylistLockedActions.

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

IsRedoAvailable

js/foo_uie_jsplitter.js:2020
IsRedoAvailable(playlistIndex)

Returns whether a redo restore point is available for specified playlist.
Related methods: plman.IsUndoAvailable, plman.Redo, plman.Undo, plman.UndoBackup

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

IsUndoAvailable

js/foo_uie_jsplitter.js:2033
IsUndoAvailable(playlistIndex)

Returns whether an undo restore point is available for specified playlist.
Related methods: plman.IsRedoAvailable, plman.Redo, plman.Undo, plman.UndoBackup

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

MovePlaylist

js/foo_uie_jsplitter.js:2046
MovePlaylist(from, to)

Parameters

NameTypeDescription
fromnumber
tonumber

Returns

boolean
methodWORKERMAIN THREAD

MovePlaylistSelection

js/foo_uie_jsplitter.js:2055
MovePlaylistSelection(playlistIndex, delta)

Parameters

NameTypeDescription
playlistIndexnumber
deltanumber

Returns

boolean

Example

// Moves selected items to end of playlist.
plman.MovePlaylistSelection(plman.ActivePlaylist, plman.PlaylistItemCount(plman.ActivePlaylist));
methodWORKERMAIN THREAD

MovePlaylistSelectionV2

js/foo_uie_jsplitter.js:2068
MovePlaylistSelectionV2(playlistIndex, new_pos)

Unlike plman.MovePlaylistSelection, this has full support for non-contiguous selections and all you have to do is supply the new position index.

Parameters

NameTypeDescription
playlistIndexnumber
new_posnumber

Throws

Error —

If playlistIndex is invalid.

methodWORKERMAIN THREAD

PlaylistItemCount

js/foo_uie_jsplitter.js:2079
PlaylistItemCount(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

number

Example

console.log(plman.PlaylistItemCount(plman.PlayingPlaylist)); // 12
methodWORKERMAIN THREAD

Redo

js/foo_uie_jsplitter.js:2090
Redo(playlistIndex)

Reverts specified playlist to the next redo restore point and generates an undo restore point.
Note: revert operation may be not applied if the corresponding action is locked. Use plman.GetPlaylistLockedActions to check if there are any locks present.

Related methods: plman.IsRedoAvailable, plman.IsUndoAvailable, plman.Undo, plman.UndoBackup

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

If playlistIndex is out of bounds or redo is not available.

methodWORKERMAIN THREAD

RemoveItemFromPlaybackQueue

js/foo_uie_jsplitter.js:2429
RemoveItemFromPlaybackQueue(index)

Parameters

NameTypeDescription
indexnumber
methodWORKERMAIN THREAD

RemoveItemsFromPlaybackQueue

js/foo_uie_jsplitter.js:2436
RemoveItemsFromPlaybackQueue(affectedItems)

Parameters

NameTypeDescription
affectedItemsArray<number>

Array like [1, 3, 5]

methodWORKERMAIN THREAD

RemovePlaylist

js/foo_uie_jsplitter.js:2104
RemovePlaylist(playlistIndex)

Removes the specified playlist.
Note: if removing the active playlist, no playlist will be active after using this. You'll need to set it manually or use plman.RemovePlaylistSwitch instead.

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean
methodWORKERMAIN THREAD

RemovePlaylistSelection

js/foo_uie_jsplitter.js:2116
RemovePlaylistSelection(playlistIndex, crop)

Parameters

NameTypeDescription
playlistIndexnumber
crop = falseoptionalboolean

If true, then removes items that are NOT selected.

Examples

<Remove selected items from playlist>
plman.RemovePlaylistSelection(plman.ActivePlaylist);
<Remove items that are NOT selected>
plman.RemovePlaylistSelection(plman.ActivePlaylist, true);
methodWORKERMAIN THREAD

RemovePlaylistSwitch

js/foo_uie_jsplitter.js:2130
RemovePlaylistSwitch(playlistIndex)

Removes the specified playlist.
This automatically sets another playlist as active if removing the active playlist.

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean
methodWORKERMAIN THREAD

RenamePlaylist

js/foo_uie_jsplitter.js:2141
RenamePlaylist(playlistIndex, name)

Parameters

NameTypeDescription
playlistIndexnumber
namestring

Returns

boolean
methodWORKERMAIN THREAD

ReorderPlaylistItems

js/foo_uie_jsplitter.js:2150
ReorderPlaylistItems(playlistIndex, order)

Reorders all items in the specified playlist according to the supplied permutation.
The order array must contain exactly one entry for each playlist item. Each value specifies the old item index that should appear at the corresponding new position.
The array must:
- have the same length as the playlist item count
- contain only valid item indices
- contain each item index exactly once

Parameters

NameTypeDescription
playlistIndexnumber

zero-based playlist index

orderArray<number>

permutation describing the new playlist item order

Returns

boolean —

true if the playlist was reordered successfully

Throws

Error —

If playlistIndex is invalid or order is not a valid permutation of the playlist items.

Example

// Changes the order from [A, B, C] to [C, A, B]
const success = ReorderPlaylistItems(0, [2, 0, 1])
methodWORKERMAIN THREAD

ReplacePlaylistItem

js/foo_uie_jsplitter.js:2170
ReplacePlaylistItem(playlistIndex, playlistItemIndex, handle_or_handles)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber
handle_or_handlesFbMetadbHandle|FbMetadbHandleList

Throws

Error —

If handle, playlistIndex, or playlistItemIndex is invalid.

methodWORKERMAIN THREAD

SelectQueryItems

js/foo_uie_jsplitter.js:2180
SelectQueryItems(playlistIndex, query)

This selects playlist items in a similar manner to the foobar2000 native playlist search.

Parameters

NameTypeDescription
playlistIndexnumber
querystring

Returns

Array<number> —

Array of selected indexes

Throws

Error —

If playlistIndex is invalid or the query cannot be parsed.

methodWORKERMAIN THREAD

SetActivePlaylistContext

js/foo_uie_jsplitter.js:2192
SetActivePlaylistContext()

Workaround so you can use the Edit menu or run fb.RunMainMenuCommand("Edit/Something...") when your panel has focus and a dedicated playlist viewer doesn't.

Example

plman.SetActivePlaylistContext(); // once on startup

function on_focus(is_focused) {
   if (is_focused) {
       plman.SetActivePlaylistContext(); // When the panel gets focus but not on every click
   }
}
methodWORKERMAIN THREAD

SetPlaylistFocusItem

js/foo_uie_jsplitter.js:2209
SetPlaylistFocusItem(playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber

Example

plman.SetPlaylistFocusItem(plman.ActivePlaylist, 0);
methodWORKERMAIN THREAD

SetPlaylistFocusItemByHandle

js/foo_uie_jsplitter.js:2220
SetPlaylistFocusItemByHandle(playlistIndex, handle)

Parameters

NameTypeDescription
playlistIndexnumber
handleFbMetadbHandle

Throws

Error —

If handle is null.

Example

let ap = plman.ActivePlaylist;
let handle = plman.GetPlaylistItems(ap)[1]; // 2nd item in playlist
plman.SetPlaylistFocusItemByHandle(ap, handle);
methodWORKERMAIN THREAD

SetPlaylistLockedActions

js/foo_uie_jsplitter.js:2234
SetPlaylistLockedActions(playlistIndex, lockedActions)

Blocks requested actions.
Note: the lock can be changed only if there is no lock or if it's owned by foo_uie_jsplitter. The owner of the lock can be checked via plman.GetPlaylistLockName.

Parameters

NameTypeDescription
playlistIndexnumber
lockedActionsArray<string>

May contain the following:
- 'AddItems'
- 'RemoveItems'
- 'ReorderItems'
- 'ReplaceItems'
- 'RenamePlaylist'
- 'RemovePlaylist'
- 'ExecuteDefaultAction'

Throws

Error —

If lockedActions is invalid, playlistIndex is out of bounds, the lock belongs to another component, or an action name is unknown.

methodWORKERMAIN THREAD

SetPlaylistSelection

js/foo_uie_jsplitter.js:2254
SetPlaylistSelection(playlistIndex, affectedItems, state)

Parameters

NameTypeDescription
playlistIndexnumber
affectedItemsArray<number>

An array of item indexes.

stateboolean

Example

// Selects first, third and fifth tracks in playlist. This does not affect other selected items.
plman.SetPlaylistSelection(plman.ActivePlaylist, [0, 2, 4], true);
methodWORKERMAIN THREAD

SetPlaylistSelectionSingle

js/foo_uie_jsplitter.js:2267
SetPlaylistSelectionSingle(playlistIndex, playlistItemIndex, state)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber
stateboolean

Examples

// Deselects first playlist item. Only works when it is already selected!
plman.SetPlaylistSelectionSingle(plman.ActivePlaylist, 0, false);
let ap = plman.ActivePlaylist;
// Selects last item in playlist. This does not affect other selected items.
plman.SetPlaylistSelectionSingle(ap, plman.PlaylistItemCount(ap) - 1, true);
method

ShowAutoPlaylistUI

js/foo_uie_jsplitter.js:2285
ShowAutoPlaylistUI(playlistIndex)

Shows popup window letting you edit certain autoplaylist properties.
Before using, check if your playlist is an autoplaylist by using plman.IsAutoPlaylist;

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

Example

fb.ShowAutoPlaylistUI(plman.ActivePlaylist);
method

ShowPlaylistLockUI

js/foo_uie_jsplitter.js:2298
ShowPlaylistLockUI(playlistIndex, window_id)

Shows popup window letting you set various locks on playlist with specified index

Parameters

NameTypeDescription
playlistIndexnumber
window_id = 0optionalnumber

Native window handle (HWND) to use as the dialog owner. Pass 0 to use the default foobar2000 window.

Throws

Error —

If playlistIndex is invalid or the panel host is not fully initialized.

Example

fb.ShowPlaylistLockUI(plman.ActivePlaylist);
methodWORKERMAIN THREAD

SortByFormat

js/foo_uie_jsplitter.js:2310
SortByFormat(playlistIndex, pattern, selected_items_only)

Parameters

NameTypeDescription
playlistIndexnumber

Index of playlist to alter.

patternstring

Title formatting pattern to sort by. Set to "" to randomise the order of items.

selected_items_only = falseoptionalboolean

Returns

boolean —

true on success, false on failure (playlist locked etc).

methodWORKERMAIN THREAD

SortByFormatV2

js/foo_uie_jsplitter.js:2320
SortByFormatV2(playlistIndex, pattern, direction)

Parameters

NameTypeDescription
playlistIndexnumber

Index of playlist to alter.

patternstring

Title formatting pattern to sort by.

direction = 1optionalnumber

1 - ascending
-1 - descending

Returns

boolean
methodWORKERMAIN THREAD

SortPlaylistsByName

js/foo_uie_jsplitter.js:2332
SortPlaylistsByName(direction)

Parameters

NameTypeDescription
direction = 1optionalnumber

1 - ascending
-1 - descending

methodWORKERMAIN THREAD

Undo

js/foo_uie_jsplitter.js:2341
Undo(playlistIndex)

Reverts specified playlist to the last undo restore point and generates a redo restore point.
Note: revert operation may be not applied if the corresponding action is locked. Use plman.GetPlaylistLockedActions to check if there are any locks present.

Related methods: plman.IsRedoAvailable, plman.IsUndoAvailable, plman.Redo, plman.UndoBackup

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

If playlistIndex is out of bounds or undo is not available.

methodWORKERMAIN THREAD

UndoBackup

js/foo_uie_jsplitter.js:2355
UndoBackup(playlistIndex)

Creates an undo restore point for the specified playlist. This will enable Edit>Undo menu item after calling other plman methods that change playlist content.
Note: this method should be called before performing modification to the playlist.

Related methods: plman.IsRedoAvailable, plman.IsUndoAvailable, plman.Redo, plman.Undo

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

If playlistIndex is out of bounds.