Index: bindings/python/MythTV/database.py =================================================================== --- bindings/python/MythTV/database.py (revision 25483) +++ bindings/python/MythTV/database.py (working copy) @@ -907,12 +907,11 @@ # push data to new settings file self._writeXML(dbconn) - if 'DBPort' not in dbconn: - dbconn['DBPort'] = 3306 - else: - dbconn['DBPort'] = int(dbconn['DBPort']) + dbconn['DBPort'] = int(dbconn['DBPort']) if dbconn['DBPort'] == 0: dbconn['DBPort'] = 3306 + if dbconn['LocalHostName'] is None: + dbconn['LocalHostName'] = gethostname() self.dbconn = dbconn self.ident = "sql://%s@%s:%d/" % \ @@ -939,7 +938,7 @@ def _readXML(self, path): dbconn = { 'DBHostName':None, 'DBName':None, 'DBUserName':None, - 'DBPassword':None, 'DBPort':0} + 'DBPassword':None, 'DBPort':0, 'LocalHostName':None} try: config = etree.parse(path).getroot() for child in config.find('UPnP').find('MythFrontend').\ @@ -1011,6 +1010,9 @@ self.db = None raise MythDBError(MythError.DB_SCHEMAMISMATCH, value, sver, local) + def gethostname(self): + return self.dbconn['LocalHostName'] + def getStorageGroup(self, groupname=None, hostname=None): """ obj.getStorageGroup(groupname=None, hostname=None) @@ -1069,7 +1071,7 @@ def _evalwheredat(self, wheredat=None): DBData._evalwheredat(self, wheredat) - if (self.hostname == gethostname()) or \ + if (self.hostname == self._db.gethostname()) or \ os.access(self.dirname.encode('utf-8'), os.F_OK): self.local = True else: Index: bindings/python/MythTV/mythproto.py =================================================================== --- bindings/python/MythTV/mythproto.py (revision 25484) +++ bindings/python/MythTV/mythproto.py (working copy) @@ -109,7 +109,8 @@ self.be.reconnect() else: # no existing connection, create new - self.be = BEConnection(self.host, self.port, self.opts) + self.be = BEConnection(self.host, self.port, \ + self.db.gethostname(), self.opts) self.be.registeruser(self._uuid, self.opts) self._shared[self._ident] = self.be @@ -293,11 +294,11 @@ logmodule = 'Python FileTransfer' class BETransConn( BEConnection ): - def __init__(self, host, port, filename, sgroup, mode): + def __init__(self, host, port, localname, filename, sgroup, mode): self.filename = filename self.sgroup = sgroup self.mode = mode - BEConnection.__init__(self, host, port) + BEConnection.__init__(self, host, port, localname) def announce(self): if self.mode == 'r': @@ -342,8 +343,8 @@ # open control socket BEEvent.__init__(self, host, True, db=db) # open transfer socket - self.ftsock = self.BETransConn(self.host, self.port, self.filename, - self.sgroup, self.mode) + self.ftsock = self.BETransConn(self.host, self.port, \ + self.be.localname, self.filename, self.sgroup, self.mode) self.open = True self._sockno = self.ftsock._sockno Index: bindings/python/MythTV/connections.py =================================================================== --- bindings/python/MythTV/connections.py (revision 25483) +++ bindings/python/MythTV/connections.py (working copy) @@ -258,7 +258,8 @@ res[key] = True return res - def __init__(self, backend, port, opts=None, deadline=10.0): + def __init__(self, backend, port, localname=None, \ + opts=None, deadline=10.0): """ BEConnection(backend, type, db=None) -> backend socket connection @@ -276,9 +277,12 @@ self.host = backend self.port = port self.hostname = None - self.localname = socket.gethostname() self.deadline = deadline + self.localname = localname + if self.localname is None: + self.localname = socket.gethostname() + self.opts = opts if self.opts is None: self.opts = self.BEConnOpts() @@ -436,7 +440,7 @@ def eventloop(self): self.threadrunning = True while (len(self._regevents) > 0) and self.connected: - self.backendCommand(deadline=0.) + self.backendCommand(deadline=0.1) sleep(0.1) self.threadrunning = False Index: bindings/python/MythTV/system.py =================================================================== --- bindings/python/MythTV/system.py (revision 25484) +++ bindings/python/MythTV/system.py (working copy) @@ -10,7 +10,6 @@ from database import DBCache from subprocess import Popen -from socket import gethostname import xml.etree.cElementTree as etree class System( DBCache ): @@ -29,7 +28,7 @@ if path is not None: self.path = path elif setting is not None: - host = gethostname() + host = self.gethostname() self.path = self.settings[host][setting] if self.path is None: raise MythDBError(MythError.DB_SETTING, setting, host) Index: bindings/python/MythTV/static.py =================================================================== --- bindings/python/MythTV/static.py (revision 25484) +++ bindings/python/MythTV/static.py (working copy) @@ -4,7 +4,7 @@ Contains any static and global variables for MythTV Python Bindings """ -OWN_VERSION = (0,23,0,19) +OWN_VERSION = (0,23,0,20) SCHEMA_VERSION = 1262 MVSCHEMA_VERSION = 1036 NVSCHEMA_VERSION = 1007