Writing a Media Server Website

2008/04/02 - media%20server

This is a task that I have redone and return to many times. Here are some of the experiences I have gained when trying to accomplish this feat again.

Problem:

The ability to access my media (music, video, pictures) from any computer or device that I currently own. This is made more difficult because I keep expanding my array of devices, so I need something can I can use on any of them.

Goals:

I want something that can run on multiple devices with completely different environments driving them. I have a Treo with a very small touch screen, an iPod Touch. Both devices have a web-browser and supporting internet connection that will make it possible for me to access my dream site.

The iPod and Treo do not have mouse pointers which make some features like the MouseOver event unnecessary or impossible.

I want a site that will enable me to manage my media and view it in different ways. I want to combine features from file management systems, and add aesthetically pleasing interfaces to that.

Possible Solutions:

I have seen many file managers out there. Many of them have the features I am looking for as far as managing files goes. You can upload files, re-organize, create, and download. But all of them are lacking features that are critical for my server to be useful. For example, media type recognition. My application should recognize which files are downloadable and which files are viewable by the browser.

Microsoft Live and Folder Share. This is an excellent solution for viewing files on remote platforms. I cannot praise it enough. Not to mention it is so pretty! The icons are beautiful and the mouse over shows a nice effect. It is fast despite all the information transferring it has to do. But you can’t move around and manage the remote files through the interface.

Resolutions:

I will never have a website that does everything. But I should still be able to add onto it as time goes on and technologies or libraries change.

A concept that I really took into realization is from my Game Development class, Model/View/Controller. This can definitely be applied here. Separate your data from how it is displayed.

Abstracting away concepts of how other people will use my website, and how I will use my website. I want to be able to manage files, but no one else. Other people can view my files, but only some. I have resolved to not deal with this issue currently.

The site should select how to display something, as opposed to being hardcoded into a specific system. Each module should be responsible for handling its type of data. The modules should handle how to display their type of data.

Modularity/Abstraction:

I have always supported open source. And I plan to post my application on my website as well as a community development site (yet to be determined. suggestions?). A key requirement for making this site useful to others is abstracting my code so that it can be understood and modified by others.

The media server website should have to ability to be changed and added to. For example, I may only need to view music, pictures, and videos, but another person may want to view source code files or compressed files or Word documents. The site should be modular enough so that another programmer (future me) can add a module for viewing those types of file.

My solution for this is simple. I call each different module to handle a file, each module determines if it wants to handle the file otherwise it quits. Input is handled using only a file path. That should be a sufficient amount of information for it to read the file and determine some properties and store it however it needs to.

Output is the fun part, and I have a pretty good idea on how I want to handle that. Each module will be called and a priority system will be used. For example I have my Pictures module that can handle all picture file types, but my browser cannot view certain picture types like Photoshop PSD files. So I could have a Browser_Pictures module that will determine whether to display the picture or just download the picture when it is accessed. So Browser_Pictures replaces the standard Picture module when it comes to viewing.

Mobility. I need to be able to use this site on my devices, so I have come up with a system that will enable me to view the site in different ways. I will use a numeric value to determine the level of graphical displaying. Each module will of course be responsible for outputting the right way. The values will range from 1 which will display the files in a manner compatible with text based browsers, similar to the apache file list. The highest visual output is 10 which will hopefully be a nice mesh between iTunes, Windows Media Player, Windows Live, Vista, and OS X. Somewhere in there, there is a nice way to display files of different mediums.

Displaying (cont.):

Since this system is abstracted and modular it will be easy to display data in different way. I would like to have an RSS feed that will show recently added or modified files. Or a torrent file or everything selected compressed into a zip file or simply a link to a VLC server that is started at the same time. My solution for this is again allowing each module to handle its type of file. So when a file is accessed the module will output the appropriate links that it can understand for generating other content.

Again, since the site will be selective, a user can chose to display files in any way, even if it isn’t compatible with their browser. The modules will also support different modes of displaying, for example a Details view, as opposed to Tile view. The individual modules should understand the different type of view, and if they don’t then of course a default view will be used.

Also I love AJAX, so my website will be able to display little parts of media, instead of having a huge folder tree loaded all at once; it can add folder contents when it is clicked on. Very handy when you have the amount of media I do.

Feature List:

Conclusion:

I have created a method for putting data into the database. Now I have to get data out. I have a lot of work ahead of me.

To Be Continued...