Playlist class

Playlist

Hierarchy (view full)

Constructors

Properties

asJSON: string

Gets the object as serialized JSON string. Or sets serialized JSON (to fill this object's metadata by the metadata included within the JSON)

childrenCount: number

Gets count of child playlists

deleted: boolean

Set to true after deletion so that 'change' event is called and item is removed from UI lists.

dontNotify: boolean

Undocumented

id: number

Gets playlist id

idColl: number

Undocumented

inEdit: boolean

Undocumented

isAutoPlaylist: boolean

Gets/Sets whether the playlist is auto-playlist

isNew: boolean

Undocumented

isObservable: boolean

Whether this object can be listened (e.g. for 'change' event)

isStatusBarSource: boolean

Is source for status bar informations.

itemImageType: string

Undocumented

name: string

Gets/Sets title of this playlist.

objectType: string

Gets the object type as string

parent: Playlist

Gets playlist parent

parentID: number

Gets id of parent playlist

persistentID: string

Gets persistent id of the object

queryData: string

Undocumented

statusInfo: Promise<any>

Undocumented

supportPin: boolean

Whether object support pin to pinned list

title: string

Gets the object title

Methods

  • Add new external list associated with object.

    Parameters

    • linkType: string

      Type of a link

    • linkInfo: string

      Link information (like release or releaseGroup for musicbrainz link)

    • link: string

      Link string

    Returns Promise<any>

  • Add track into playlist

    Parameters

    Returns Promise<any>

  • Add track into playlist

    Parameters

    • Track: number

    Returns Promise<any>

  • Add tracks into playlist

    Parameters

    Returns Promise<any>

  • Lock object to update state. Events are not called when in update state.

    Returns void

  • Updates the object every X ms when called periodically. Useful e.g. when filling lists. Can be used only in the update lock! (i.e. between beginUpdate/endUpdate)

    Parameters

    • interval: number

    Returns void

  • Clears this playlist's tracks

    Returns Promise<any>

  • Commits this playlist

    Returns Promise<any>

  • Creates copy (clone) of this playlist

    Returns Promise<any>

    as promise

  • Deletes this playlist

    Returns Promise<any>

  • Parameters

    Returns Promise<any>

    Undocumented

  • Unlock object from update state. beginUpdate and endUpdate must be in pair. When endUpdate is called, change event is called.

    Returns boolean

  • Parameters

    • dimX: number
    • dimY: number

    Returns string

    Undocumented

  • Gets children playlists (sub-playlists)

    Parameters

    • Rest ...params: any[]

    Returns PlaylistList

  • Gets class name of the object.

    Returns string

  • Gets playlist last modified timestamp

    Returns Promise<any>

  • Get external link associated with the object. All link identifiers are (updated list is available in consts.js) : var LINK_MUSICBRAINZ = 'musicbrainz', LINK_ACOUSTID = 'acoustid', LINK_TVDB = 'tvdb', LINK_MAZE = 'maze', LINK_IMDB = 'imdb', LINK_WIKI = 'wiki', LINK_ECHOPRINT = 'echoprint', LINK_MOVIEDB = 'moviedb', LINK_DISCOGS = 'discogs';

    Parameters

    • Rest ...params: any[]

    Returns ExternalLinksList

  • Parameters

    • Rest ...params: any[]

    Returns number

    Undocumented

  • Gets tracks of this playlist

    Parameters

    • Rest ...params: any[]

    Returns Tracklist

    as promise

    Example

    var trcklist = Playlist.getTracklist(); <br>
    trcklist.whenLoaded().then(function () { <br>
    // all tracks are loaded here <br>
    }); <br>
  • Inserts track into playlist

    Parameters

    • Index: number
    • Track: Track

      Track to insert

    Returns Promise<any>

  • Inserts tracks into playlist

    Parameters

    • Index: number
    • Tracks: Tracklist

      Tracks to insert

    Returns Promise<any>

  • Parameters

    • id: number

    Returns boolean

    Undocumented

  • Object is pinned in pinned list

    Returns Promise<any>

  • Call defined method with locked data so user can access them.

    Parameters

    • func: (() => any)

      Method to call

        • (): any
        • Returns any

    Returns void

  • Call defined method with the item locked for modifications.

    Parameters

    • Rest ...params: any[]

    Returns Promise<any>

  • Moves a track in the playlist

    Parameters

    Returns Promise<any>

  • Creates new sub-playlist of this playlist

    Returns Playlist

  • Notifies that the object was changed (e.g. to force visual update etc.)

    Parameters

    • Rest ...params: any[]

    Returns void

  • Remove external link from object.

    Parameters

    • Rest ...params: any[]

    Returns Promise<any>

  • Removes selected tracks from playlist

    Parameters

    Returns Promise<void>

  • Removes track from playlist

    Parameters

    • Track: Track

      Track to remove

    Returns Promise<any>

  • Saves re-ordered playlist's tracks into DB.

    Does not function with Auto-Playlists. Auto-Playlists use QueryData for their sorting. See searchEditor.js and playlistHeader.js for an example on how to manipulate QueryData for sorting.

    Parameters

    Returns Promise<any>

  • Parameters

    • imageLink: string

    Returns Promise<any>

    Undocumented

  • Parameters

    • id: number
    • value: boolean

    Returns void

    Undocumented

  • Set object is pinned in pinned list.

    Parameters

    • pinned: boolean

      Object is pinned

    • collID: number

      ID of collection where object is pinned

    Returns void

  • Add tracks into playlist, but clears the existing tracks at first.
    NOTE: Introduced in version 5.0.4

    Parameters

    Returns Promise<any>

Events

event_change: ((changeType, ...additionalArgs) => void)

Event is called when object is somehow changed

See App.listen

Type declaration

    • (changeType, ...additionalArgs): void
    • Parameters

      • changeType: string

        additional change type (can have values like 'tracklist', 'deleted', 'title' or undefined)

      • Rest ...additionalArgs: any[]

      Returns void

Example

app.listen(object, 'change', (changeType) => {  });
event_destroying: (() => void)

Event is called when object is going to destroy

See App.listen

Type declaration

    • (): void
    • Returns void

event_playlistAdded: ((playlistID, playlist) => void)

Event is called when a child playlist is created. Most useful with app.playlists.root.

See App.listen

Type declaration

    • (playlistID, playlist): void
    • Parameters

      • playlistID: number

        ID of created playlist. (pre version 5.0.4. use app.playlists.getByIDAsync(playlistID) to get the Playlist object).

      • playlist: Playlist

      Returns void

event_playlistChanged: ((playlistID, playlist) => void)

Event is called when a child playlist is modified. Most useful with app.playlists.root.

See App.listen

Type declaration

    • (playlistID, playlist): void
    • Parameters

      • playlistID: number

        ID of changed playlist (pre version 5.0.4. use app.playlists.getByIDAsync(playlistID) to get the Playlist object).

      • playlist: Playlist

      Returns void

event_playlistRemoved: ((playlist) => void)

Event is called when a child playlist is removed. Most useful with app.playlists.root.

See App.listen

Type declaration

    • (playlist): void
    • Parameters

      • playlist: Playlist

        Object containing info of the playlist that was removed.

      Returns void

event_statuschange: (() => void)

Event is called when status info of the object is changed

See App.listen

Type declaration

    • (): void
    • Returns void