Documentation/plman
namespaceWORKER

plman

jsdoc/plman.js:1

Functions for managing foobar2000 playlists.

propertyWORKERMAIN THREAD

ActivePlaylist

jsdoc/plman.js:9
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

jsdoc/plman.js:25
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

jsdoc/plman.js:43
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

jsdoc/plman.js:56
PlaylistCount: number
propertyWORKERreadonly

PlaylistRecycler

jsdoc/plman.js:64
PlaylistRecycler: FbPlaylistRecycler

A Recycle Bin for playlists.

methodWORKERMAIN THREAD

AddItemToPlaybackQueue

jsdoc/plman.js:735
AddItemToPlaybackQueue(handle)

Parameters

NameTypeDescription
handleFbMetadbHandle

Throws

Error —

If handle is null.

methodWORKERMAIN THREAD

AddLocations

jsdoc/plman.js:73
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

jsdoc/plman.js:743
AddPlaylistItemToPlaybackQueue(playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber
methodWORKERMAIN THREAD

ClearPlaylist

jsdoc/plman.js:94
ClearPlaylist(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Example

plman.ClearPlaylist(plman.PlayingPlaylist);
methodWORKERMAIN THREAD

ClearPlaylistSelection

jsdoc/plman.js:104
ClearPlaylistSelection(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Example

plman.ClearPlaylistSelection(plman.ActivePlaylist);
methodWORKERMAIN THREAD

CreateAutoPlaylist

jsdoc/plman.js:114
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

jsdoc/plman.js:127
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

jsdoc/plman.js:144
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

jsdoc/plman.js:157
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

jsdoc/plman.js:167
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 —

true on success

methodWORKERMAIN THREAD

FindByGUID

jsdoc/plman.js:211
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

jsdoc/plman.js:178
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

jsdoc/plman.js:751
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

jsdoc/plman.js:191
FindPlaylist(name)

Parameters

NameTypeDescription
namestring

Case insensitive.

Returns

number —

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

methodWORKERMAIN THREAD

FlushPlaybackQueue

jsdoc/plman.js:762
FlushPlaybackQueue()
methodWORKERMAIN THREAD

GetGUID

jsdoc/plman.js:199
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

jsdoc/plman.js:769
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

jsdoc/plman.js:783
GetPlaybackQueueHandles()

Returns

FbMetadbHandleList

Example

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

GetPlayingItemLocation

jsdoc/plman.js:220
GetPlayingItemLocation()

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

Returns

FbPlayingItemLocation
methodWORKERMAIN THREAD

GetPlaylistFocusItemIndex

jsdoc/plman.js:230
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

jsdoc/plman.js:241
GetPlaylistItems(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

FbMetadbHandleList

Example

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

GetPlaylistLockedActions

jsdoc/plman.js:252
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

jsdoc/plman.js:270
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

jsdoc/plman.js:279
GetPlaylistName(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

string

Example

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

GetPlaylistSelectedIndexes

jsdoc/plman.js:290
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

jsdoc/plman.js:302
GetPlaylistSelectedItems(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

FbMetadbHandleList

Example

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

InsertPlaylistItems

jsdoc/plman.js:313
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

jsdoc/plman.js:332
InsertPlaylistItemsFilter(playlistIndex, base, handle_list, select)

Same as 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

jsdoc/plman.js:345
InvertSelection(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

If playlistIndex is invalid.

methodWORKERMAIN THREAD

IsAutoPlaylist

jsdoc/plman.js:353
IsAutoPlaylist(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

IsPlaylistItemSelected

jsdoc/plman.js:362
IsPlaylistItemSelected(playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber

Returns

boolean
methodWORKERMAIN THREADdeprecated

IsPlaylistLocked

jsdoc/plman.js:371
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 IsAutoPlaylist.
Deprecated: use GetPlaylistLockedActions.

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

IsRedoAvailable

jsdoc/plman.js:387
IsRedoAvailable(playlistIndex)

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

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

IsUndoAvailable

jsdoc/plman.js:400
IsUndoAvailable(playlistIndex)

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

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

methodWORKERMAIN THREAD

MovePlaylist

jsdoc/plman.js:413
MovePlaylist(from, to)

Parameters

NameTypeDescription
fromnumber
tonumber

Returns

boolean
methodWORKERMAIN THREAD

MovePlaylistSelection

jsdoc/plman.js:422
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

jsdoc/plman.js:435
MovePlaylistSelectionV2(playlistIndex, new_pos)

Unlike 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

jsdoc/plman.js:446
PlaylistItemCount(playlistIndex)

Parameters

NameTypeDescription
playlistIndexnumber

Returns

number

Example

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

Redo

jsdoc/plman.js:457
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 GetPlaylistLockedActions to check if there are any locks present.

Related methods: IsRedoAvailable, IsUndoAvailable, Undo, UndoBackup

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

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

methodWORKERMAIN THREAD

RemoveItemFromPlaybackQueue

jsdoc/plman.js:796
RemoveItemFromPlaybackQueue(index)

Parameters

NameTypeDescription
indexnumber
methodWORKERMAIN THREAD

RemoveItemsFromPlaybackQueue

jsdoc/plman.js:803
RemoveItemsFromPlaybackQueue(affectedItems)

Parameters

NameTypeDescription
affectedItemsArray<number>

Array like [1, 3, 5]

methodWORKERMAIN THREAD

RemovePlaylist

jsdoc/plman.js:471
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 RemovePlaylistSwitch instead.

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean
methodWORKERMAIN THREAD

RemovePlaylistSelection

jsdoc/plman.js:483
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

jsdoc/plman.js:497
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

jsdoc/plman.js:508
RenamePlaylist(playlistIndex, name)

Parameters

NameTypeDescription
playlistIndexnumber
namestring

Returns

boolean
methodWORKERMAIN THREAD

ReorderPlaylistItems

jsdoc/plman.js:517
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

jsdoc/plman.js:537
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

jsdoc/plman.js:547
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

jsdoc/plman.js:559
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

jsdoc/plman.js:576
SetPlaylistFocusItem(playlistIndex, playlistItemIndex)

Parameters

NameTypeDescription
playlistIndexnumber
playlistItemIndexnumber

Example

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

SetPlaylistFocusItemByHandle

jsdoc/plman.js:587
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

jsdoc/plman.js:601
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 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

jsdoc/plman.js:621
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

jsdoc/plman.js:634
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

jsdoc/plman.js:652
ShowAutoPlaylistUI(playlistIndex)

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

Parameters

NameTypeDescription
playlistIndexnumber

Returns

boolean

Throws

Error —

If playlistIndex is out of bounds.

Example

fb.ShowAutoPlaylistUI(plman.ActivePlaylist);
method

ShowPlaylistLockUI

jsdoc/plman.js:665
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

jsdoc/plman.js:677
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

jsdoc/plman.js:687
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

jsdoc/plman.js:699
SortPlaylistsByName(direction)

Parameters

NameTypeDescription
direction = 1optionalnumber

1 - ascending
-1 - descending

methodWORKERMAIN THREAD

Undo

jsdoc/plman.js:708
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 GetPlaylistLockedActions to check if there are any locks present.

Related methods: IsRedoAvailable, IsUndoAvailable, Redo, UndoBackup

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

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

methodWORKERMAIN THREAD

UndoBackup

jsdoc/plman.js:722
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: IsRedoAvailable, IsUndoAvailable, Redo, Undo

Parameters

NameTypeDescription
playlistIndexnumber

Throws

Error —

If playlistIndex is out of bounds.