playlist_add_map_song

🟢 Stable

This API is stable since festivald v1.0.0.


Add a Song to a Playlist.

If the specified playlist does not already exist, it will be created.

This method errors if there was an index error.

Inputs

FieldTypeDescription
artiststringArtist name
albumstringAlbum title
songstringSong title
playliststringThe name of the Playlist
appendstring, one of front, back or indexSee Playlist/Append
indexoptional (maybe-null) unsigned integerIf the index append is chosen, this will be the index used

Outputs

FieldTypeDescription
existedbooleanIf playlist already existed or not
old_lenunsigned integerThe old length of playlist
new_lenunsigned integerThe new length of playlist

Example Request 1

Add to back of the playlist "Hello".

festival-cli playlist_add_map_song --playlist Hello --artist TWICE --album "PAGE TWO" --song "CHEER UP" --append back
curl http://localhost:18425 -d '{"jsonrpc":"2.0","id":0,"method":"playlist_add_map_song","params":{"playlist":"Hello","artist":"TWICE","album":"PAGE TWO","song":"CHEER UP","append":"back"}}'

Example Request 2

Append at playlist index 4.

festival-cli playlist_add_map_song --playlist Hello --artist TWICE --album "PAGE TWO" --song "CHEER UP" --append index --index 4
curl http://localhost:18425 -d '{"jsonrpc":"2.0","id":0,"method":"playlist_add_map_song","params":{"playlist":"Hello","artist":"TWICE","album":"PAGE TWO","song":"CHEER UP","append":"index","index":4}}'

Example Response

{
  "jsonrpc": "2.0",
  "result": {
    "existed": false,
    "old_len": 0,
    "new_len": 17
  },
  "id": 0
}