Skip to content

Playlist Commands

Landie edited this page Jun 17, 2022 · 14 revisions

Get Playlists

Returns an array of objects containing data of playlist(s).

Parameters

Box Name Type required? Description
Save Object Variable string Variable name to save the returned object to.

Responses

Value Type Description
.playlists[] Array Array containing objects of each playlist
.playlists[0-?] Object Object containing arrays of each playlist
.playlists[0-?].id string Playlist's ID
.playlists[0-?].index int Playlist's index (position) in list
.playlists[0-?].isCurrent boolean Returns true if playlist is currently selected
.playlists[0-?].itemCount int Number of songs inside playlist
.playlists[0-?].title string Title of playlist

Example 📝

{
  "playlists": [
    {
      "id": "p22",
      "index": 0,
      "isCurrent": true,
      "itemCount": 1871,
      "title": "Stream Playlist",
      "totalTime": 0.0
    },
    {
      "id": "p18",
      "index": 1,
      "isCurrent": false,
      "itemCount": 1,
      "title": "Personal Playlist",
      "totalTime": 0.0
    },
    {
      "id": "p4",
      "index": 2,
      "isCurrent": false,
      "itemCount": 0,
      "title": "Personal Playlist's Personal Playlist",
      "totalTime": 0.0
    }
  ]
}

Example LB

Get Playlist Songs

Returns an object with an array of objects containing an array of each song's column data (wtf).

Parameters

Box Name Type required? Description
Save Object Variable string Variable name to save the returned object to.
Playlist ID string ID of the playlist you wish to retrieve songs from.
Offset int Starting index of songs to grab (if you don't want all songs)
Count int Total number of songs to grab
Columns string (special syntax) A comma delimited list of column data to return (e.g. "%artist%,%title%")

you may also not use colons, however, everything returns in one line which is not ideal.

If the amount of returned songs is huge, browsing it in the variable viewer can effectively softlock the application! please refer to the documentation to avoid using the variable viewer for massive amounts of returned songs!

Responses

Value Type Description
.offset int Returns the provided offset
.totalCount int Returns the total amount of songs inside the playlist (not using offset)
.items[] Array An Array of song objects using offset and count.
.items[0-?] Object Container to hold columns[] array.
.items[0-?].columns[] Array Array of column data requested
.items[0-?].columns[0-?] Array column data is in order of provided pattern. Depending on how many comma delimited entries, this array can have multiple entries.

e.g. %album%,%title%,%length% => columns[0],columns[1],columns[2]

Example 📝

Input Parameters:

Box Name Value
Save Object Variable ababaa
Playlist ID p18
Offset 0
Count 4
columns %artist%,%title%

Response:

{
  "ababaa": { //Object Variable Name
    "items": [
      {
        "columns": ["Vansire", "A Long Drive Back"] //%artist%,%title%
      },
      {
        "columns": ["Röyksopp", "Remind Me (someone else's radio remix)"]
      },
      {
        "columns": ["Clario", "4Ever"]
      },
      {
        "columns": ["Joji", "Gimme Love"]
      }
    ],
    "offset": 0,
    "totalCount": 4
  }
}

Example LB

Add Playlist

Adds a new playlist.

Box Name Type required? Description
Title string The title of the playlist
Index int position of where you wish to put your playlist. Leaving blank places the new playlist at the end.

Remove Playlist

This command is destructive! Make sure to save your playlists before using in more complicated scenarios!

Removes a playlist.

Box Name Type required? Description
playlistID/index string The Playlist ID or index of the playlist you wish to delete/remove.

Clear Playlist

This command is destructive! Make sure to save your playlists before using in more complicated scenarios!

Clears a playlist of it's songs.

Box Name Type required? Description
playlistID/index string The Playlist ID or index of the playlist you wish to clear/delete all songs from

Move Playlist

Moves a playlist from one position to another in the playlist list.

Box Name Type required? Description
Source playlistID/index string The Playlist ID or index of the playlist you wish to move
Destination Index int The position where you want the playlist to be moved to.

Example 📝

Before:

before ex pic move playlist command

Input Parameters:

Box Name Value
Source playlistID/index p22 (id of Upbeat Songs
Destination index 2

After:

after ex pic move playlist

Rename Playlist

Renames a specified playlist.

Box Name Type required? Description
New Title string New Title to rename the playlist to
playlistID/index string The Playlist ID or position of the playlist you are renaming

Move songs to Playlist

Moves songs from one playlist, to another using a specified stringified array.

Box Name Type required? Description
Source playlistID/index string The Playlist ID or position of the playlist you wish to move the song(s) from
Target playlistID/index string The Playlist ID or position of the playlist you wish to move the song(s) to
Target index string The position of where you want the moved song(s) to be in the target playlist. Leaving blank moves them to the end of the target playlist.
Stringified Songs Array string An array of song indexes/positions stringified using Stringify Array. A way to do this is to create a new array with Create Array, and use Array Insert to insert any song(s) you want via their index/position. The order in which they are displayed in the array is the pattern that will be reflected on the target playlist.

If confused, refer to the example below!

Example 📝

Goal: Move these four songs from the "Chill Songs" playlist into the "Upbeat Songs" playlist.

playlist to move songs from

Input Parameters:

Box Name Value
Source playlistID/index "p1" ("Chill Songs" playlist ID)
Target playlistID/index "p2" ("Upbeat Songs" playlist ID)
Target index 0
Stringified Songs Array "[6, 7, 11, 12]"

Using Stringify Array to create the stringified array

example lb move to playlist

Result:

result move to playlist

Copy songs to Playlist

Copies songs from one playlist, to another using a specified stringified array.

Box Name Type required? Description
Source playlistID/index string The Playlist ID or position of the playlist you wish to copy the song(s) from
Target playlistID/index string The Playlist ID or position of the playlist you wish to copy the song(s) to
Target index string The position of where you want the copied song(s) to be in the target playlist. Leaving blank copies them to the end of the target playlist.
Stringified Songs Array string An array of song indexes/positions stringified using Stringify Array. A way to do this is to create a new array with Create Array, and use Array Insert to insert any song(s) you want via their index/position. The order in which they are displayed in the array is the pattern that will be reflected on the target playlist.

If confused, refer to the example below!

Example 📝

Goal: Copy these six songs from the "Chill Songs" playlist into the "Upbeat Songs" playlist.

before copy songs to playlist

Input Parameters:

Box Name Value
Source playlistID/index "p1" ("Chill Songs" playlist ID)
Target playlistID/index "p2" ("Upbeat Songs" playlist ID)
Target index 0
Stringified Songs Array "[3, 4, 5, 6, 7, 8]"

Using Stringify Array to create the stringified array

example lb copy songs to playlist

Result:

result copy to playlist

Remove Songs

Remove songs from specified playlist.

Box Name Type required? Description
playlistID/index string The Playlist ID or position of the playlist you wish to delete song(s) from
Stringified Songs Array string An array of song indexes/positions stringified using Stringify Array. A way to do this is to create a new array with Create Array, and use Array Insert to insert any song(s) you want via their index/position.

If confused, refer to the example below!

Example 📝

Input Parameters:

Box Name Value
playlistID/index "p23" (a playlist ID)
Stringified Songs Array "[0, 1, 4, 5]"

Using Stringify Array to create the stringified array

example lb remove songs

Copy Songs

Copy songs from specified playlist into itself.

Box Name Type required? Description
playlistID/index string The Playlist ID or position of the playlist you wish to copy song(s) from and to
Target index string The position of where you want the copied song(s) to be in the playlist. Leaving blank copies them to the end of the playlist.
Stringified Songs Array string An array of song indexes/positions stringified using Stringify Array. A way to do this is to create a new array with Create Array, and use Array Insert to insert any song(s) you want via their index/position.

If confused, refer to the example below!

Example 📝

Copies first song to first position in playlist

Input Parameters:

Box Name Value
playlistID/index "p15" (a playlist ID)
Target Index 0
Stringified Songs Array "[0]"

Using Stringify Array to create the stringified array

example lb copy songs