Hack: SoundBridge Services for PHP

What is this?

Some PHP scripts which run on my NSLU2 Linux box to provide services on the SoundBridge. Right now, I'm only putting up the RSS sources, since the Weather package does not yet work with a service which has sufficient licensing terms.

An RSS feed:

The current weather:

Tomorrow's weather:

A 6-day outlook:

Disclaimer

This is highly experimental software, and these installation instructions are untested. Use at your own risk, etc. If the app fails during "sketch" it will likely appear to hang your SoundBridge. This can be repaired either by telnetting into port 4444 and doing a sketch/exit or a reboot, or just pulling the power and doing a hard reboot of the device. Please send fixes/suggestions to apeller at rcn dot com.

Prerequisites

Installation

  1. Grab services.tar and upack it

  2. If using mt-daapd, backup mt-daapd-ssc.sh (usually in /opt/sbin?), replace it with the copy from the tar file, and make sure the permissions are correct. Edit the new script and change SERVICEDIR to point at the sbservices directory inside the tar file you just unpacked, or wherever you decide to put it. Also change the address of the SoundBridge (192.168.0.101) to whatever yours is. Make sure all the contents are readable by the mt-daapd process.

  3. You will need to make sure the PEAR XML_RSS is installed (pear install XML_RSS) along with all its dependencies. I found that the dependencies were not always properly declared, so you may need more. Getting pear installed properly was the most difficult part of the project for me. See pear-list for the list of pear packages installed on my machine. This is a superset of what you will need as it includes packages necessary for Weather app deployment.

Using the application

  1. You should now be able to manually launch the service from the shell with a command like
    $ cd sbservices/nyt
    $ php run.php <address of your soundbridge>
    This is going to be the best way to debug, should you have trouble.

  2. If you wish to have your service spawned from the SoundBridge, try putting a file called 'nyt.svc' somewhere in your scanned music directory and rescan. Browse or search this file on the SoundBridge and choose “Play Song”. You'll see the following unfortunate side-effects (let me know if you can improve on this)

    1. The service is referred to as a 'song', and if you play it as part of a list, the next song/service will immediately be triggered

    2. No music is played (perhaps a small .wav file can be streamed from the service() function?

    3. An error appears immediately after choosing the song (wait a few seconds and the service should kick in

    4. After the service is done, you get a screen that says playback stopped

    5. Because of the way the irwait command is designed, it is not possible to make this very interactive. At best, you can pause the output and wait for a key (and even take action based on that key...)

    6. There is no way for an application to bring the device out of standby mode without using the remote.

  3. If you want to create a different feed, duplicate the nyt directory by a different name, change the feed inside run.php, and create a file by the same name as the new directory + ".svc" inside your music directory