[mythtv-users] MythTV remote control with Telnet, Perl, and PerlTk
Jerome Yuzyk
jerome at supernet.ab.ca
Mon Sep 29 18:33:32 UTC 2008
I watch TV while I work at my computer. I used to keep my MCE remote next to
my mouse, because it is easier than reaching over to the MythTV keyboard. I
have been getting annoyed by having it in the way, because I use it a lot
when watching sports - gotta love that 30-second skip at every play-stop
whistle during {C,N}FL Football games - it's like watching game tape. Plus I
only use a small fraction of the buttons on the remote, and there are a
couple functions it doesn't support so I have to use the keyboard anyway. The
keyboard is black, part of the package when I got the machine and MythTV
coming on 2 years of 24/7 next week. I've put white Post-It(TM) tape on the
keys I use the most to help find them easily.
For a short while I wanted a programmable remote, but still, that's another
gizmo in the way with too many buttons. Since I'm at my computer, and using
the mouse anyway, I wanted a mousable remote, on the computer I'm usually
working on. So call me lazy...
I looked at a few alternatives: one from the command line, one through a
browser, and one using Flash. They didn't fit my ad hoc and particular
requirements, so I lived with it until I upgraded to 0.21. Then I tried out
the Telnet interface, and found it to be pretty reliable and even better when
connected up with Perl for some logic. I wrote about that a couple Fridays
ago.
Now that I had a reliable way to control the MythTV box remotely I needed a
mousable interface. An interface that would be readily available from any of
my virtual desktops and not be very big. My KDE menu provided me with one - I
made a menu folder and put an entry for each call to the script. I only made
entries for my most-common functions because it was a pain to do. And I still
wanted a better interface - something widgety - a small panel I could put in
the corner of the screen.
I figured Perl/Tk would do the job - all I wanted were a bunch of buttons on a
panel. So after an hour or so while I watched our local football team pull
defeat from the jaws of victory I learned enough to make a panel with a
vertical stack of (14 at the moment, but I see the need for others now that
it works, and that's going to get ugly) buttons for the functions I use most,
activated from a system tray button which could really use a remote-control
icon (if I could find one).
Yes, a tall strip of buttons, while functional, is not so pretty, or easy to
use. So, back to the Tk docs to find a better layout, and a grid seems to
provide what I need. Another hour or so while I watch the Singapore Grand
Prix and I'm liking it! I have a panel that's laid out like the customizable
remote I envisioned. Not fully developed yet, and tailored to my specific
idea of what I want, but functional enough to make it through a few football
games, the news, a few other shows, and allowing me to leave my physical
remote out of the way.
The CLI script is 205 lines, the simple Tk script is 159 lines and the Tk grid
script is 176 lines. They both use Perl modules that I think are in the base
package. They could probably be used with just a little modification in any
other environment that has Perl and Tk. It's all proof-of-concept (read:
incomplete, undocumented but good enough for me now) but you may want to have
a look or try it out as a basis for making your own. Maybe even good enough to
make it into /contribs some day. Enjoy!
http://www.bss.ab.ca/mythtv/MythRemote_TelnetPerlTk_20080929.zip
More information about the mythtv-users
mailing list