Page 1 of 1

Opening a playlist via REST API

Posted: 31 Mar 2023 23:39
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?

Re: Opening a playlist via REST API

Posted: 01 Apr 2023 11:05
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

Re: Opening a playlist via REST API

Posted: 01 Apr 2023 19:08
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.

Re: Opening a playlist via REST API

Posted: 01 Apr 2023 23:54
by radio42
No, it existed for a very long time, but was never really documented;-)