[WIP] 90% rewritten to an XBMC add-on.  Not tested.

Needs a XBMC patch - will commit later if it compiles successfully.