I wanted something that would let me query the status of my Myth box through Google Talk, so I wrote Myth Jabberbot. Since Google Talk uses Jabber to communicate Myth Jabberbot should work with any IM service using Jabber protocol.

Anyone who knows the Google Talk ID of your bot can communicate with it, so the bot is confined to providing status information. If you want to schedule or delete recordings, you should consider using MythWeb.

Requirements.

  • Python - any recent version should work.
  • xmppy - a Python library for creating Jabber clients. This can be downloaded from http://xmpppy.sourceforge.net/
  • pydns - on Debian or Ubuntu systems install with apt-get install pydns
  • MythTV python bindings.

There are already python bindings which may be built into your version of Myth. However, the version included with Myth 0.21 don’t contain the additional functions used by Myth Jabberbot and you will need to install the version of the bindings included with Myth Jabberbot.

The updated bindings simply extend the existing bindings, so shouldn’t interfere with any existing applications you may have that use the python bindings. The updated bindings should be part of the next release of MythTV.

Installing the Python Bindings.

Unpack the bindings:

tar -xvzf MythTV-0.21.1.tar.gz

cd MythTV-0.21.1

sudo python setup.py install

You can check if the bindings are installed from a python shell:

python
from MythTV.MythTV import *

If you don’t get any errors the bindings should be installed correctly. Type ctrl-D to exit the python shell.

Installing myth_jabberbot.

Copy myth_jabberbot.py and jabberbot.py to a suitable directory. Make sure that myth_jabberbot.py is executable.

The configuration options are stored in a text file called .mythjabberbot in your home directory. If the file doesn’t exist mythjabberbot will create it. However, you will need to edit it to fill in your bot’s jabber id and password:

[jabber]
jabberid = your_jabber_id@googlemail.com
jabber_password = your_password

Creating a Channel List.

In order to get program listings, you need to enter channel names and ID’s in te channels section of .mythjabberbot. The format is:

identifier = channel_id

Identifier can be any string you want eg. BBC1. The channel_id is the value from the chanid column of the channel table in mythconverg which corresponds to the channel you want to get listings for.

Here is an example from my own .mythjabberbot:

[channels]
bbc1 = 1001
bbc2 = 1003

Running mythjabberbot.

Start the bot:

./myth_jabber.py

If all goes well you should see the following message:

SystemInfoJabberBot: bot connected. serving forever.

You should now be able to query the bot using your favourite IM client. The available commands are:

  • help: show list of available commands
  • upcoming: list of the next 10 programs to be recorded.
  • expiring: show the next 10 programs that will expire, excluding Live

TV.

  • recorders: show information about your tuners.
  • recorded: information about the last 10 recorded programs.
  • list [channel]: List of today’s programs for the selected channel

e.g. list BBC1.

To stop the bot type ctrl-C in the terminal where it is running.