Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Access Playlists via API

1596454701
Nick O.
Forum Champion
I'd like to have a particular set of commands called any time a new playlist gets created, using an on "playlist:create" sort of command. Is that possible? I couldn't find documentation on a Playlist object, just the tracks themselves. 
1596455264
The Aaron
Roll20 Production Team
API Scripter
The API doesn't have access to an object that represents a playlist.  The jukeboxtrack is the only audio object the API can directly access.
1596455362
Nick O.
Forum Champion
Thanks, Aaron.
1596455579

Edited 1596455604
The Aaron
Roll20 Production Team
API Scripter
I verify the documentation isn't missing something with this: log(_.chain(getAllObjs()) .map((o)=>o.get('type')) .uniq() .value() .sort() ); Yielding: [    "ability",    "attribute",    "campaign",    "card",    "character",    "deck",    "graphic",    "hand",    "handout",    "jukeboxtrack",    "macro",    "page",    "path",    "player",    "rollabletable",    "tableitem" ]
1596458212
Nick O.
Forum Champion
Very cool! Thanks for the tip, Aaron!
1596493526

Edited 1596493661
Victor B.
Pro
Sheet Author
API Scripter
var lists        = JSON.parse(Campaign().get('jukeboxfolder')) gets all playlists and track names assigned to each playlist.  As Aaron said, you can't create a playlist in jukebox via API, only access jukebox playlist and tracks
1596494557
The Aaron
Roll20 Production Team
API Scripter
Oh hey!  You're right!!! So, you could create an event on: on('change:campaign:_jukeboxfolder', ...); Nice, Victor!
1596500628
Nick O.
Forum Champion
Very cool! Thanks, Victor!
1596513446
Victor B.
Pro
Sheet Author
API Scripter
I was so tempted to create on change events on jukebox.  The complication stopped me so I want with remove all, import jukebox.