Back-end server software - any suggestions?
#1
Big Grin 
First of all I'd like to give a huge THANKYOU to the developers working on the port. I can't believe how much progress you're making in such a short amount of time!

I've been using XBMC on my Xbox for nearly 4 years now (it's the sole reason the Xbox is still under my TV) but the lack of HD-capability of the hardware made me start looking at other solutions for network video playback. We've tried the Xbox 360 and PS3, but none compare to the functionality XBMC provides.

XBMC on OS X is pretty much my ideal media-playing machine - a very small computer (Mac Mini) with enough processing power to deliver HD content, all powered by the best media centre software available.

This combination got me thinking - the Xbox version of XBMC is great, but the Mac can run other software at the same time, so why not produce a server application running in the background?

I currently have a *very* hacked together solution working for the Xbox XBMC - a small Linux-powered NAS device with several USB drives attached. I've replaced the manufacturer's firmware with Debian and written several Python scripts to organise content across all the drives and present a fully organised folder structure to XBMC. This allows me much greater control than sharing the drives directly - for example, TV shows can appear in both the "Comedy" and "Drama" categories without having to have two copies on the drives, different episodes of a show or series can be scattered across different drives but presented in the same list, and reorganising the entire folder structure (renaming things, moving shows between categories etc.) can be done by editing an XML file.

The scripts also handle new uploads (saving video files on the drive that has the most free space & using regular expression checks on the filename to insert the file in the right place in the tree), and uses RSS feeds to download new torrent files. Unfortunately the NAS box isn't powerful enough to download torrents by itself, so these get handed off to my iMac for downloading, then copied back to the correct location on the server when completed (different items can have different seeding policies - most are set to a 1:1 ratio, but there are a few things like news programmes that are "free leech" on one of the sites I use). The script also supports auto-deleting shows after a set number of days (e.g. for news shows or soaps).

The "shared folder" presented to XBMC is simply a directory tree filled with symlinks to the video files. Each time the script set runs, it also iterates through each symlink checking that it's valid, and removing bad links and empty directories. This way, if a drive fails or is powered off, the script still carries on but removes all the links to the unavailable content.

I realise that a lot of the functionality here is offered by the XBMC library, but I could never get it working how I wanted it to - there were always shows it'd miss, put in incorrect genres, not number correctly etc, and it took WAY too long to update (I have a lot of video files Smile). I realise this isn't the fault of the XBMC devs - the information is only as accurate as the sites it's being scraped from. The Python scripts take about 45 seconds to go through all my drives, and it's all done automatically in the background without interrupting any open connections (if I'm watching a video on the Xbox while the script runs, nothing bad happens :p)

Although this works, it really isn't elegant at all, especially having to have the iMac involved for the downloading and setting the script to run every few minutes to check for changes. I'm fairly new to the Mac platform, and still trying to get my head round Cocoa & Objective-C, but I think I could create a much better solution running on the Mac.

So far it looks like the main advantage would be the FSEvents framework - instead of having to repeatedly scan the drives for new content, I could just wait for the OS to inform my application of changes. There's also the extra CPU power needed to integrate BitTorrent functionality, Core Data to manage the media tree, a rich set of GUI controls for producing a management interface, and Bonjour/CFNetwork for allowing control of the server from a different computer on the network (or maybe from a script within XBMC itself - who knows?).

I've already started trying to replicate the basic cataloguing features the Python scripts provide, but having a more powerful machine and a GUI available instead of a command line presents a lot more opportunities. Does anyone here have any suggestions for things they think would be useful? If anybody thinks the idea would be of use to them I'd be more than happy to share it (with source code) once I've actually got something working. I've got plenty from the XBMC community so it's only fair I give something back.

The Python scripts are too horrible & embarrassing to show to "real" developers though Wink
Reply

Logout Mark Read Team Forum Stats Members Help
Back-end server software - any suggestions?0