Using more than one stream & toggle event

You have a question or need an advice about how to do something? Ask it here!
Post Reply
User avatar
Adger
Posts: 122
Joined: 10 Apr 2012 20:09

Using more than one stream & toggle event

Post by Adger » 10 Apr 2012 20:26

This is probably a simple question but to me... I'm lost (again :D )

Via Settings and Options -> Events/Commands -> Streaming I have defined an "OnServerStarted" and an "OnServerStopped" event, that reliably start and stop Autoplay. For this I am using a simple PLS_CURRENT_AUTOPLAY_ON (or ..._OFF respectively). This is cool and works perfectly for my needs as long as I am streaming to one server. But every now and then I am streaming to two servers. Whenever I stop one of those servers my defined events would switch off Autoplay all together.

My question is: How do I set up a condition that would check wether or not other servers are started?

User avatar
Adger
Posts: 122
Joined: 10 Apr 2012 20:09

Re: Using more than one stream & toggle event

Post by Adger » 11 Apr 2012 12:43

Great, thank you!

Online
User avatar
radio42
Site Admin
Posts: 5577
Joined: 05 Apr 2012 16:26

Re: Using more than one stream & toggle event

Post by radio42 » 11 Apr 2012 21:08

Theoretically this might be achieved by the conditional control-command "EXEC_COMMAND2".
This control-command evaluates a given 'parameter' against a given 'criterion' and only if that matches the given 'command' is executed.
The syntax is:

Code: Select all

EXEC_COMMAND2 <parameter>|<criterion>|<command>
As a possible <parameter> you might use any of the available macros (see the appendix in the User Manual).
As a possible <criterion> you might use any of the available criterion conditions (see the appendix in the User Manual).
The <command> would then be the control-command to execute, if the 'parameter' value matches against the 'criterion'.
Example:

Code: Select all

EXEC_COMMAND2 ${cplisplaying}|Equals(1)|SHOW_ALERT_WINDOW Currently Playing|${cpltracknamecurrent}
This would execute the control-command "SHOW_ALERT_WINDOW Currently Playing|${cpltracknamecurrent}" if the parameter value (the resolved macro value) "${cplisplaying}" would be equal to "1" - which would be the case, if the current playlist is playling.

However, I am affraid, that there is currently no macro available to check if 'any streaming server' is currently started/connected.
I will add such missing macro to the next version!
As such I am going to add the following macros to v3.0.10.31:
${streamingstartedservers} : the number of started streaming servers
${streamingisanyconnected} : is any streaming server connected (1/True=yes, 0/False=no)
Once added to a new version your conditional control-command would look like this:
For OnServerStarted:

Code: Select all

EXEC_COMMAND2 ${streamingisanyconnected}|Equals(1)|PLS_CURRENT_AUTOPLAY_ON 
or
EXEC_COMMAND2 ${streamingstartedservers}|Greater(0)|PLS_CURRENT_AUTOPLAY_ON 
For OnServerStopped:

Code: Select all

EXEC_COMMAND2 ${streamingisanyconnected}|Equals(0)|PLS_CURRENT_AUTOPLAY_OFF 
or
EXEC_COMMAND2 ${streamingstartedservers}|Equals(0)|PLS_CURRENT_AUTOPLAY_OFF 
Note, that since v3.0.10.30 it is possible to assign control-commands to individual Streaming Server events, instead of using the global events (see the 'Streaming Server Configuration' dialog).
But I guess this wouldn't help much in your case.

Online
User avatar
radio42
Site Admin
Posts: 5577
Joined: 05 Apr 2012 16:26

Re: Using more than one stream & toggle event

Post by radio42 » 13 Apr 2012 16:27

The above mentioned new macros are now available in the new v3.0.10.31!
So "Check for Updates..."

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests