Opening a playlist via REST API

You have a question or need an advice about how to do something? Ask it here!
Post Reply
phonic
Posts: 327
Joined: 06 Mar 2019 14:45
Opening a playlist via REST API

Post by phonic »

What is the best way to open an existing playlist and set as current in ProppFrexx?

I've tested using:
eg: ["PLS_CURRENT_NEW","PLS_CURRENT_LOAD_PLAYLIST ...showname\current_playlist.pfp"]
As it's sending two commend and not waiting for the first to complete in ProppFrexx even though it's sending an OK response, and second command would fail as no current blank playlist is open:

OK
ERROR: no current playlist available

Is there a command or option I've over looked?
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Opening a playlist via REST API

Post by radio42 »

ProppFrexx is highly multi-threaded and uses asynchronous programming internally to not block any real time audio processing resp to make the UI as fluent as possible. And you just discovered an effect of this.
What happens is the following:
The first command (to create a new playlist window) is executed asynchronously, i.e. it is triggered, but did not fully finish, while already the second command is also triggered to be executed. Or in other words, the commands are not executed synchronous, i.e. they do NOT wait until the previous command finishes before the next command is executed.
In most cases you will never recognize it, but particular case it matters.

You can solve it in two ways:

1. Simply use the single command

Code: Select all

["PLS_CURRENT_NEW C:\showname\current_playlist.pfp"]
I.e. you can directly specify the playlist filename to open and load with the PLS_CURRENT_NEW command.

2. You just wait some time between the first and second command to ensure, that the first command fully finished. How long that is depends on the speed of your PC, e.g. 5 seconds should be fine in most cases. This results in the following sequence of 4 commands:

Code: Select all

["ASYNC", "PLS_CURRENT_NEW", "SLEEP 5000", "PLS_CURRENT_LOAD_PLAYLIST C:\showname\current_playlist.pfp"]
But all this has nothing to do with the REST API - the same will happen, e.g. when you test the commands in the User Command window panel and write the commands seperate lines...
E.g.:
Original (not working):

Code: Select all

PLS_CURRENT_NEW
PLS_CURRENT_LOAD_PLAYLIST C:\Music\Test.pfp
New (single command):

Code: Select all

PLS_CURRENT_NEW C:\showname\current_playlist.pfp
New (four command with waiting):

Code: Select all

ASYNC
PLS_CURRENT_NEW
SLEEP 5000
PLS_CURRENT_LOAD_PLAYLIST C:\showname\current_playlist.pfp
phonic
Posts: 327
Joined: 06 Mar 2019 14:45
Re: Opening a playlist via REST API

Post by phonic »

Thanks for your reply.

Is the added file name parameter something that's been recently added(PLS_CURRENT_NEW <fileName>)? I checked the manual beforehand and it stated it has no parameters:
PLS_CURRENT NEW:
Creates a new and empty playlist (and makes it the current one).
Parameter: none
Reply: OK|ERROR
Thanks again for your help.
User avatar
radio42
Site Admin
Posts: 8295
Joined: 05 Apr 2012 16:26
Location: Hamburg, Germany
Contact:
Re: Opening a playlist via REST API

Post by radio42 »

No, it existed for a very long time, but was never really documented;-)

Post Reply