Saturday, September 4, 2010

Writing the Music Server software

Having decided that I was going to write my own Music Server software from scratch I had to then figure out a number of core issues that were fundamental to succeeding.
  1. Create some form of database of track information to allow easy selection via a user interface.
  2. Decode and play the media files on the server and access track metadata (MP3 tags etc) to populate the track database.
  3. Create a User Interface that was accessible via the devices I had available (PC based browser running on lo resolution NetBook and an iTouch)
  4. Provide some form of service middleware to allow the UI to obtain data and control whats going on on the Server.
1) The direction I took was decided by what I planned to use for 3). The User Interface was going to be HTML based supporting and number of different devices. I'm pretty familiar with writing DHTML and Ajax based applications. With that in mind one of the easiest data formats to deal with in javascript is JSON. I decided to create a database around JSON structures.

2) As I was going to be writing java code the most straight forward answer was to use an implementation of the javax.sound API.  As luck would have it there is a very nice implementation available http://www.javazoom.net/index.shtml. Using JLayer, MP3SPI, VorbisSPI and Tritonus I was able to write java code that could obtain the metadata stored in the media files and also decode and play these files on the PC.

3) I'm very familar with the dojotoolkit framework (http://www.dojotoolkit.org/) and I have also contributed a javascript serverside templating framework (http://www.zazl.org/) that allows easy dynamic creation of HTML via DTL (Django Template Language). Using both of these together I was able to put together a flexible HTML Web UI that supports regualar browsers and also Apple devices such as the iPhone and iTouch.

4) As I was already writing java code in the form of a Web Application the solution for 4) was to write the service layer with servlets supporting a REST like API. The response format is JSON.

No comments:

Post a Comment