MythTV alarm clock

This morning my alarm clock didn’t go off, and I didn’t make it to work. That’s gotta be fixed. Since this weekend I got a whizzy new MythTV setup around my house, that seems like the ideal thing to wake me up. However, MythTV plugins are written in C++, and I don’t do C++ because I’m a Python guy. So, something of a hack. It is possible to add a menu item to MythTV which runs an external program. So, thought I, that’d be one way to do it, and indeed it works. You create a new “menu theme” which launches an external program by name. The Myth menu theme development guide explains how. Then, write a small program to accept user input to set an alarm (I used pygame, which seems more in keeping with the MythTV approach than Gtk), and pow, Bob’s your uncle. Actually, I used pygame primarily because I needed the MythTV keys to navigate around the little alarm-setting program. I’ve got some weird keys bound to do navigation in MythTV (2, 4, 6, 8 for up, left, right, down) and I’ve got no idea how you can make the 6 key mean “go to the next field” like Tab does in a Gtk application. In pygame that’s easy, so I did it that way; at some point in the future it should also allow me to theme the app so it looks like your MythTV theme, but I didn’t get around to that. The way it actually creates alarms is by putting them in your crontab, which is easy and satisfying and what cron is for. Anyway, code in Subversion at http://svn.kryogenix.org/svn/mythtv-alarm-clock/ if you want to have a play. I suspect the MythTV people would be horrified by this approach. A few of them tried to convince me that I should learn C++ because it’s not that hard…

More in the discussion (powered by webmentions)

  • (no mentions, yet.)