[mythtv] Notice: Python binding rewrite

Raymond Wagner raymond at wagnerrp.com
Sat Jan 2 18:03:35 UTC 2010


On 1/2/2010 5:03 AM, Hadley Rich wrote:
> On Sat, 02 Jan 2010 22:48:31 Ian Barton wrote:
>    
>> One of my scripts runs in Apache under mod-python. ATM I am having
>> trouble trying to work out how to pass database information in the
>> MythTV() object's init method. This is probably obvious, but ATM I have
>> a stinking cold and am not thinking clearly:)
>>      
> The MythTV class isn't made to accept connection information on
> initialisation, only to look for it in a config file.
>    

Note that the MythTV class does not exist in the new bindings, and has 
been renamed to MythBE.

I was talking about this to someone a month back who had me fix exactly 
that problem for exactly that scenario.  The MythBEConn (and MythBE 
through it) both take three optional values: backend address, connection 
type, and database object.
    --  The address is a string, and can be an IP or hostname.
    --  Connection type is a string and can be either 'Monitor' or 
'Playback'.  If you want another form of socket, you have to write your 
own announce function (see FileTransfer class).
    --  The database object is any initialized object of type 
MythDBConn, or any subclassed form of it. Technically, it can be any 
object which as the attribute 'dbconn', which is a dictionary with the 
values 'DBUserName', 'DBHostName', 'DBName', and 'DBPassword'.  It will 
only fall back to reading 'config.xml' if this is not given.

http://mythtv.org/wiki/User:Wagnerrp/Bindings/Programming_Guidelines#Database_Access

All classes which access the database now accept a 'db' value to allow 
you to specify the database to connect to, rather than always relying on 
the configuration file.  All uses of those classes in the current 
bindings will also be supplied that value, with the single exception of 
MythLog and MythDBConn, as doing so would result in infinite recursion.


More information about the mythtv-dev mailing list