--- osdb.py.old 2010-08-19 14:03:05.357732613 -0300 +++ osdb.py 2010-08-19 16:48:48.647731556 -0300 @@ -5,6 +5,7 @@ import unzip import globals import RecursiveParser +import socket from xml.dom import minidom from utilities import * @@ -37,31 +38,31 @@ def connect( self, username, password ): LOG( LOG_INFO, "Connecting to server " + BASE_URL_XMLRPC + "..." ) try: + socket.setdefaulttimeout(60) self.server = xmlrpclib.Server(BASE_URL_XMLRPC) - info = self.server.ServerInfo() -# if username: -# LOG( LOG_INFO, "Logging in " + username + "..." ) -# login = self.server.LogIn(username, password, "en", "XBMC") -# else: -# LOG( LOG_INFO, "Logging in anonymously..." ) -# login = self.server.LogIn("", "", "en", "XBMC") - socket = urllib.urlopen( BASE_URL_OSTOK ) - result = socket.read() - socket.close() - xmldoc = minidom.parseString(result) - token = xmldoc.getElementsByTagName("token")[0].firstChild.data - LOG( LOG_INFO, "Fetching tocken " + token + "..." ) - if token: -# if (login["status"].find("200") > -1): + #info = self.server.ServerInfo() + if username: + LOG( LOG_INFO, "Logging in " + username + "..." ) + login = self.server.LogIn(username, password, "en", "XBMC") + else: + LOG( LOG_INFO, "Logging in anonymously..." ) + login = self.server.LogIn("", "", "en", "XBMC") + #socket = urllib.urlopen( BASE_URL_OSTOK ) + #result = socket.read() + #socket.close() + #xmldoc = minidom.parseString(result) + #token = xmldoc.getElementsByTagName("token")[0].firstChild.data + #LOG( LOG_INFO, "Fetching tocken " + token + "..." ) + if (login["status"].find("200") > -1): self.connected = True - self.osdb_token = token -# self.osdb_token = login["token"] +# self.osdb_token = token + self.osdb_token = login["token"] LOG( LOG_INFO, "Connected" ) return True, "" else: self.connected = False -# error = "Login " + login["status"] - error = _( 653 ) + error = "Login " + login["status"] +# error = _( 653 ) LOG( LOG_ERROR, error ) return False, error except Exception, e: