How to Control Music Remotely

Controlling your music remotely is pretty simple, when you get right down to it. Assuming you're using winamp as your music player, there are a great many available plugins, with various sets of features, which can make network based control over your player a reality. For this site, the goal has always been to allow someone to select a song, play that song, lock it, and hopefully not do anything TOO foolish. Originally I had the option to upload music, but this feature is no longer available for a couple of reasons. First off, I didn't have the means in place to easily moderate what was uploaded. Secondly, back then, the server for uploaded music and the network the played music was stored on was the same location. Now it would require a double automated transfer, since I'm not willing to allow ftp access to any local servers, for security reasons. I could probably handle the automated transfer, but with all of the abuse I got with uploaded music, I'm not terribly eagar to resume that feature.

Although I have tried several plugins, I ended up using the httpq plugin for Winamp. This plugin provides a VERY low level http interface. It's designed, not to be used as an end-user interface itself, but instead as a simple interface to use for cgi scripts or other programs. The responses are very terse in nature, with the expectation that you will build a more colorful application around it. It's simple to use and the source code is available. The only downside is that it doesn't contain functionality to get directory listings off of the filesystem it has access to. From the sounds of things, this is a feature that will never be available in official releases as it's a potential security risk, at least according to the developer.

As with music uploading, this problem was easy to solve when the filesystem with the MP3s directly accessible on the same server as the webserver. In my current configuration, I would either need to do a nfs mount, which doesn't work well over the internet, or set up a vpn. I opted for another choice. I created a simple script that grabbed the full path of each of the mp3's in my mp3 directory, and created a new directory with all of the filenames, but with 0 length. I was then able to create an iso image of the new directory, which turned out to only be a few hundred K in size, and transfer that file to the server. I mounted that file on the server as the mp3 directory, and the music control application would then traverse those directories and present the available filenames. All that was necessary was to create a new iso image anytime I added/deleted something. It's not foolproof, still has its variety of issues, but it's the cleanest way to deal with it with my present choice of plugins.

Configuring the plugin is pretty simple. Once you've downloaded and installed it, you access the configuration from Winamp by going to Options/Preferences/Plugins/General Purpose and select Winamp httpQ Plugin. Then click on the Configure Selected Plugin button.

A new window will pop up for the configuration. From the General tab, select a password and a TCP port if the default isn't to your liking. If you want this to be active when you start winamp, click the checkbox.

The Security menu allows you to select who can access the server. Assuming you've got your own script accessing it from your webserver with a static ip address, you will want to select Deny all addresses except and click the Add button and type in the address of your server. This way nobody other then the one authorized host will be able to connect to the plugin. While you are testing it, however, you may wish to add in your local ip addresses or even leave it open by selecting Allow all addresses except.

The Advanced menu has just a connection timeout (which you shouldn't need to mess with) and a checkbox to enable HTTP headers. If you select the Enable HTTP Headers option, you will be able to use a web browser to send commands to the plugin and receive response codes and other data back from it. If you do not select the headers, you will only get the data itself. What you choose here depends on what will be reading the data and how complicated you wish for it to be.

Once you've got it configured, simply click Start and you're in business. Assuming your access restrictions allow it, try to connect a browser to http://localhost:4800/play?p=PASSWORD and winamp should start playing. Refer to the httpQ Reference Guide for a full list of commands and the proper format to send them in, along with what data you should expect back from each one.

Other plugins ARE available however, but they are complete solutions, which creates a problem for me because I want to tie in my site's security features with the music interface, for abuse prevention and other things. However, they might work well for you.

Important Links

Winamp
httpQ

Alternative Plugins

Winamp Web Interface