<?sphp $this->text('pagetitle') ?>
 
Home of the Squeezebox™ & Transporter® network music players.

Netcontrol

From SqueezeboxWiki

Jump to: navigation, search

To control and automate a player connected to Squeezenetwork, there is the netcontrol method available. This way many CLI commands can be executed.

Before going any further, here is a very simple example showing how this works, doing it manually, and assuming we are using Firefox as the Web Browser, connecting to http://www.beta.squeezenetwork.com/:

1. Connect your player to Squeezenetwork.

2. Log on to http://www.beta.squeezenetwork.com/, and put a valid username and password.

3. Copy-paste this link: http://www.beta.squeezenetwork.com/netcontrol/netcontrolxml into your Web Browser.

4. An XML structure should show up, find the <players> tag, and copy the id attribute of the player you are trying to manipulate, in this case it would be '12345':

[=<player id="12345" serviceip="xxx.xxx.xxx.xx:xxxxx" bestname="SBPlayer" />]

5. Copy-paste this link: http://www.beta.squeezenetwork.com/netcontrol/netcontrolxml?player=12345&p0=power&p1=0 , changing the player atribute with the id you copied from step 4. This should turn off your player. To turn it back on, change the p1 attribute from 0 to 1, and execute the URL link again.

In order to use this method in our programming language of choice, we must find a way to take care of 3 main things:

  1. Authenticate a session with Squeezenetwork.
  2. Parse a XML structure.
  3. Execute Web URL.

Here is an example using PERL: NetcontrolPerlExamples