Ejemplo n.º 1
0
    def __init__(self, client):
        self.client = client
        self.state = "closed"
        self.uid = 0

        # Add signal handlers
        self.client.gameInfo.connect(self.processGameInfo)
        self.client.gameExit.connect(self.processGameExit)
        self.client.viewingReplay.connect(self.processViewingReplay)

        # Update registry settings for Mumble
        # For the mumbleconnector to work, mumble needs positional audio enabled, and link-to-games enabled. We also need the link 1.20 dll enabled,
        # but that cannot be set in registry and is also the default
        try:
            key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, "Software\\Mumble\\Mumble\\audio", 0, _winreg.KEY_ALL_ACCESS)
            _winreg.SetValueEx(key, "postransmit", 0, _winreg.REG_SZ, "true")
            _winreg.SetValueEx(key, "positional", 0, _winreg.REG_SZ, "true")
            _winreg.CloseKey(key)
        except:
            logger.info("Updating Mumble registry settings failed.")

        # Start Mumble (Starting it now instead of when faf is launched will make sure mumble's overlay works, and prevent that mumble causes faf to minimize when it pops up
        self.linkMumble()
        
        logger.info("MumbleConnector instantiated.")
Ejemplo n.º 2
0
    def __init__(self, client):
        self.client = client
        self.state = "closed"
        self.uid = 0

        # Add signal handlers
        self.client.gameInfo.connect(self.processGameInfo)
        self.client.gameExit.connect(self.processGameExit)
        self.client.viewingReplay.connect(self.processViewingReplay)

        # Update registry settings for Mumble
        # For the mumbleconnector to work, mumble needs positional audio enabled, and link-to-games enabled. We also need the link 1.20 dll enabled,
        # but that cannot be set in registry and is also the default
        try:
            key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
                                  "Software\\Mumble\\Mumble\\audio", 0,
                                  _winreg.KEY_ALL_ACCESS)
            _winreg.SetValueEx(key, "postransmit", 0, _winreg.REG_SZ, "true")
            _winreg.SetValueEx(key, "positional", 0, _winreg.REG_SZ, "true")
            _winreg.CloseKey(key)
        except:
            logger.info("Updating Mumble registry settings failed.")

        # Start Mumble (Starting it now instead of when faf is launched will make sure mumble's overlay works, and prevent that mumble causes faf to minimize when it pops up
        self.linkMumble()

        logger.info("MumbleConnector instantiated.")
Ejemplo n.º 3
0
    def processViewingReplay(self, url):
        logger.debug("viewingReplay message: " + str(url.path()))

        match = re.match('^([0-9]+)/', str(url.path()))

        if match:
            logger.info("Watching livereplay: " + match.group(1))
            self.mumbleIdentity = match.group(1) + "--2"
            self.updateMumbleState()

        return
Ejemplo n.º 4
0
    def processViewingReplay(self, url):
        logger.debug("viewingReplay message: " + str(url.path()))

        match = re.match('^([0-9]+)/', str(url.path()))

        if match:
            logger.info("Watching livereplay: " + match.group(1))
            self.mumbleIdentity = match.group(1) + "--2"
            self.updateMumbleState()

        return
Ejemplo n.º 5
0
    def launchMumble(self):
        url = QtCore.QUrl()
        url.setScheme("mumble")
        url.setHost(self.mumbleHost)
        url.setPath(self.mumbleChannelRoot)
        url.setUserName(self.client.login)
        url.addQueryItem("version", "1.2.0")

        logger.info("Opening " + url.toString())

        if QtGui.QDesktopServices.openUrl(url):
            logger.debug("Lauching Mumble successful")
            return 1

        logger.debug("Lauching Mumble failed")
        return 0
Ejemplo n.º 6
0
    def launchMumble(self):
        url = QtCore.QUrl()
        url.setScheme("mumble")
        url.setHost(self.mumbleHost)
        url.setPath(self.mumbleChannelRoot)
        url.setUserName(self.client.login)
        url.addQueryItem("version", "1.2.0")

        logger.info("Opening " + url.toString())
        
        if QtGui.QDesktopServices.openUrl(url):
            logger.debug("Lauching Mumble successful")
            return 1

        logger.debug("Lauching Mumble failed")
        return 0
Ejemplo n.º 7
0
    def linkMumble(self):

        # Launch mumble and connect to correct server
        if not self.launchMumble():
            self.mumbleFailed = 1
            return 0

        # Try to link. This may take up to 40 seconds until we bail out
        for i in range(1, 8):
            logger.debug("Trying to connect link plugin: " + str(i))

            if mumble_link.setup(self.pluginName, self.pluginDescription):
                logger.info("Mumble link established")
                self.mumbleSetup = 1
                return 1

            # FIXME: Replace with something nonblocking?
            time.sleep(i)

        logger.info("Mumble link failed")
        self.mumbleFailed = 1
        return 0
Ejemplo n.º 8
0
    def linkMumble(self):
        
        # Launch mumble and connect to correct server
        if not self.launchMumble():
            self.mumbleFailed = 1
            return 0

        # Try to link. This may take up to 40 seconds until we bail out
        for i in range (1,8):
            logger.debug("Trying to connect link plugin: " + str(i))

            if mumble_link.setup(self.pluginName, self.pluginDescription):
                logger.info("Mumble link established")
                self.mumbleSetup = 1
                return 1

            # FIXME: Replace with something nonblocking?
            time.sleep(i)
            
            
        logger.info("Mumble link failed")
        self.mumbleFailed = 1
        return 0