How the Server Works

Operating environment

The server PC runs under Microsoft Windows 7 Professional.

Apache web server

At the heart of the server PC is the Apache HTTP Server. It serves up pages to the iPad from two sources. The first source is relatively static and contains the basic operating software such as HTML files, icon images, and a few small CGI programs written in Perl. The second source relates to the music itself and contains HTML files and cover images for the main part of the iPad screen, together with search indexes and various cross-reference indexes. All those are on the PC's internal hard disk.

Winamp music player

For playing music the server runs Winamp.

Winamp was designed to be used as a desktop application and not as a server process. So there has to be some linking software to allow it to be controlled and monitored by other programs. That's the httpQ plugin, which allows other programs to send commands and request status information by sending HTTP requests to a designated IP address and port number.

The iPad controls Winamp by sending commands to httpQ over the Wi-Fi link. Although it would be possible for the iPad to monitor Winamp's status using the same route in reverse, it wouldn't be practical for a number of reasons. So I've written a program (llama.pl) that runs continuously, monitoring Winamp using httpQ, and writing status information to a file in JSON format. Whenever that file changes, its contents are "pushed" to the iPad using the Long Polling style of pseudo-push technology.

Monitor screen

The monitor display is created by the Apple Safari web browser, showing a page (monitor.html) in full screen mode. Like the iPad, it receives Winamp status whenever the JSON file changes.

The big picture

Below is a simplified view of the main paths that information travels along during a typical operation - touching "Play album" on the iPad.

Diagram

And here is a view of the server screen though RealVNC. (Most of the information in the Llama window is not relevant - it relates to previously-played music. Also the "Spotify" and "Landline" programs are not relevant to the Jukebox and can be ignored.

Screenshot