This is what you see if you press the “Find Dale” button on my TV remote control.
(Well, actually the “Teletext” button… cos I wasn’t using it, and there isn’t another button that makes any more sense!)
The on-screen-display adds a message at the bottom of the screen for a few seconds, saying my last recorded location and when I was there.
And now it’s set up, it is surprisingly easy to do amazingly useful, and not-at-all annoying things like this!
In my defence, I stopped just short of making the script poll for my location and display an on-screen message whenever my location changes. Which would’ve been very cool, but probably drive my family nuts. So I compromised with a script that runs when you press a button on the remote.
There are three bits to this:
- Getting my location
- Putting my location on the TV screen
- Getting this to happen when you press a button on the remote
Getting my location
Bit of a cludgy and brittle hack, but this will do for my needs.
Putting my location on the TV screen
One of the svdrp commands is
Displays the given message on the OSD. If message is omitted, the currently pending message (if any) will be returned. The message will be displayed for a few seconds as soon as the OSD has become idle. If a new MESG command is entered while the previous message has not yet been displayed, the old message will be overwritten.
svdrpsend MESG "Hello World"
will display “Hello World” on your TV.
And so running:
svdrpsend MESG `python /home/dale/scripts/googlatitude.py`
displays the output of my Python script (which is what downloads the contents of my Latitude embed page, scrapes the text description of my location and prints it to stdout).
Running this command displays my location on the TV.
Getting this to happen when you press a button on the remote
The last bit is getting this command to run from the remote control.
The vdr installer also installed LIRC which handles decoding instructions from my infra-red remote control.
As a result, I already had a
lircd daemon running, and the runvdr script that starts vdr uses the
--lirc switch to enable lirc support.
/var/lib/vdr/remote.conf maps buttons on the physical remote (identified in
/etc/lirc/lircd.conf) to functions in VDR. I chose one of the buttons not used by VDR (and not mentioned in
/var/lib/vdr/remote.conf) – “Teletext”.
I use irexec to use the remote to run other non-VDR commands.
Firstly, I create the file
~/.lircrc with the following:
begin button = Teletext prog = irexec config = svdrpsend mesg `python /home/dale/scripts/googlatitude.py` & flags = quit end
Then I start the irexec daemon with
irexec --daemon. This does the job of running my command when the Teletext button is pressed.
Job done – location tracking on telly.