Thursday 24 January 2008

(song ends) ... Mono!

Lanley: And so, "mono" means "one." And "rail" means "rail." And that concludes our intensive three week course. [Marge vs. the Monorail]
Recently, I've been trying to offload a lot of scheduled processing from my desktop computer to a Linux (ubuntu in this case) server. One task that I thought might cause me some pain was XMLTV generation.

The general idea of the daily XMLTV task is:
  1. Suck down the latest program listings with (the excellent) shepherd script. Unfortunately this is a necessary evil, since Australian copyright laws are pretty strange for television programming.
  2. Augment the description field for each programme with the extra information shepherd provides. These are things like release year, episode name, director, actors, user ratings, etc. MythTV shows these extra details in the UI, but the MediaPortal UI does not currently show all this extra info. So the workaround is to cram it all into the description element (which is shown in the UI).
The old way to achieve this was to perform (1) on a ubuntu virtual machine (now no longer required as I have a real machine), and perform (2) on my desktop computer (Windows) via a little .Net 2.0 console program I cobbled together. Now that little program (or the logic it contained) needs to run on a real ubuntu machine.

I knew about the mono project already, but I had never actually tried to run it from scratch on existing code. The end result, after an easy 5 minutes was my existing code working perfectly on ubuntu.
  1. Install the core mono package (mono) and the .Net 2.0 compiler (mono-gmcs)
    sudo apt-get install mono mono-gmcs
  2. Run my existing (compiled in Visual Studio on Windows) executable on ubuntu with no recompilation or any other screwing around.
    mono xmltvAugment.exe
So easy.

This example was of course with a trivial .Net 2.0 console program. The program only used standard assemblies. But regardless, I was still impressed.

No comments: