[mythtv-users] Myth Jabber bot

Michael T. Dean mtdean at thirdcontact.com
Sat Mar 8 00:02:22 UTC 2008


On 03/07/2008 06:08 PM, James Gutshall Jr wrote:
> On Fri, Mar 7, 2008 at 2:04 PM, Michael T. Dean wrote:
>> On 03/07/2008 01:47 PM, Ian Barton wrote:
>>     
>>> Over the last couple of days I have put together a very simple jabber
>>> bot. It's designed to do a few simple things to let me check on my Myth
>>> box via my mobile phone:
>>>
>>> * List of last 10 recorded programs.
>>> * List of next 10 upcoming recordings.
>>> * Per channel listings for the current day
>>> * Various bits of information from the Myth backend xml page.
>>>
>>> You can run it on your backend. However, if you can access your myth
>>> database remotely it should run on any system that can run Python. I
>>> have tested it with Googletalk and Openfire.
>>>
>>> In use you simply send send the bot an IM and it replies with whatever
>>> status info you requested.
>>>
>>> Would anyone be interested if I made this generally available? If so how
>>> do I go about submitting it to the contrib part of MythTV?
>>>
>>> This is my first ever Python program, so try to be kind:) One of the
>>> reasons for writing it was to learn Python. If anyone wants to help
>>> refactor it I can make it available via bzr or svn.
>>>       
>> Is it, by any chance, using the Python bindings?  IMH(non-developer)O,
>> we should refrain from accepting Perl/Python scripts for contrib if they
>> do not use the Perl/Python bindings.
>>
>> I don't know the current state of the Python bindings to know whether
>> they are sufficiently usable to require their use for Python scripts or
>> whether they require some additional work before that's feasible.  As
>> for the Perl bindings, though, they are definitely sufficiently usable
>> in 0.21-fixes/trunk to require their use in scripts.
> According to how I understand it works, it does not touch Mythbackend at
> all.  only reading the database directly.

That's exactly what should be avoided.  When a script reads the DB 
directly, any future changes to the DB schema or data format requires 
modification of the scripts.  If, instead, all scripts used the bindings 
to access the data, then changes to the DB/data only require updating 
the bindings to understand the new formats.

>   Is there code binding for
> database access?  I have similar scripts that I use for voip, etc but access
> the DB directly.  please advise for future reference.  If there is a set for
> perl (which I like to use rather than python) I would be interested in
> finding them for future code projects.

Basically, if information /can/ be retrieved from the backend rather 
than by accessing raw data in the database, it /should/ be retrieved 
from the backend.  The Perl bindings (and, I'm assuming, the Python 
bindings) make it possible to send commands to the backend just like any 
mythfrontend or mythbackend would--i.e. to retrieve a list of 
recordings, to retrieve a list of upcoming recordings, etc.

Anyway, again, this is just my opinion (which has developed as I watched 
scripts like myth.rebuilddatabase.pl and others bitrot during the 
development of 0.21).

Mike


More information about the mythtv-users mailing list