Tracking my location on TV

Location tracking on TV

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.

People following me on twitter may have noticed me talking about setting up a new home media server: a small Linux server that has become our Freeview box, PVR, home photo album, and music server.

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:

  1. Getting my location
  2. Putting my location on the TV screen
  3. Getting this to happen when you press a button on the remote

Getting my location

I use the Google Latitude badge that I embed in my blog to share my Latitude location, and scrape it to get my location information.

Bit of a cludgy and brittle hack, but this will do for my needs.

Putting my location on the TV screen

I’m using VDR as the base for our media server. (I was originally gonna use MythTV because I’d heard of it before, but Dom pointed me at VDR instead).

One of the things it supports is svdrp – basically it listens on port 2001 for commands. You can send it commands to do anything, such as change channels.

One of the svdrp commands is MESG:

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/`

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.

The file /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:

   button = Teletext
   prog = irexec
   config = svdrpsend mesg `python /home/dale/scripts/` &
   flags = quit

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. 🙂

Tags: , , , , , ,

3 Responses to “Tracking my location on TV”

  1. Darren says:

    This is cool, but I’m a little sad that you seem to have banished teletext for good. I spent a large part of my youth on page 302. Luckily, you can still get Ceefax here, you don’t even have to wait for the numbers to cycle around. That is a technological advancement. 🙂

  2. dale says:

    That’s very cool! 🙂

    I wonder how much of my childhood I spent waiting for Ceefax pages to go round again…

  3. Dom says:

    neat idea 🙂