Exemplo n.º 1
0
 def updateMumbleState(self):
     if self.mumbleIdentity:
         if self.checkMumble():
             if self.client.activateMumbleSwitching:
                 logger.debug("Updating mumble state")
                 mumble_link.set_identity(self.mumbleIdentity)
             else:
                 logger.debug("Automatic channel switching disabled")
 def updateMumbleState(self):
     if self.mumbleIdentity:
         if self.checkMumble():
             if self.client.activateMumbleSwitching:
                 logger.debug("Updating mumble state")
                 mumble_link.set_identity(self.mumbleIdentity)
             else:
                 logger.debug("Automatic channel switching disabled")
Exemplo 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
    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
Exemplo n.º 5
0
    def state_playing(self, gameInfo):

        # Check if our game just launched
        if self.state != "playing":
            self.state = "playing"
            self.uid = gameInfo["uid"]

            logger.debug(gameInfo["teams"])

            # Team -1 is observers, team 0 is "team unset", and the rest is the team number
            # Our default team is unset. If we find ourselves in a different team, we set
            # it below
            for team in gameInfo["teams"]:
                # Ignore 1-person-teams
                if len(gameInfo['teams'][team]) < 2:
                    logger.debug("Not putting 1 person team " + team +
                                 " in a channel")
                    continue

                for player in gameInfo['teams'][team]:
                    if self.client.login == player:
                        logger.debug(player + " is in team " + str(team))
                        if team != "0":
                            self.mumbleIdentity = str(
                                gameInfo["uid"]) + "-" + str(team)
                        else:
                            self.mumbleIdentity = "0"

                        logger.debug("Set mumbleIdentity: " +
                                     self.mumbleIdentity)
    def state_playing(self, gameInfo):

        # Check if our game just launched
        if self.state != "playing":
            self.state = "playing"
            self.uid = gameInfo["uid"]

            logger.debug(gameInfo["teams"])

            # Team -1 is observers, team 0 is "team unset", and the rest is the team number
            # Our default team is unset. If we find ourselves in a different team, we set
            # it below
            for team in gameInfo["teams"]:
                # Ignore 1-person-teams
                if len(gameInfo['teams'][team]) < 2:
                    logger.debug("Not putting 1 person team " + team + " in a channel")
                    continue
                
                for player in gameInfo['teams'][team]:
                    if self.client.login == player:
                        logger.debug(player + " is in team " + str(team))
                        if team != "0":
                            self.mumbleIdentity = str(gameInfo["uid"]) + "-" + str(team)
                        else:
                            self.mumbleIdentity = "0"
                            
                        logger.debug("Set mumbleIdentity: " + self.mumbleIdentity)
Exemplo n.º 7
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
    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
Exemplo n.º 9
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
Exemplo n.º 10
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
Exemplo n.º 11
0
    def checkMumble(self):

        if self.mumbleFailed:
            # If there was a failure linking to mumble before, don't bother anymore.
            logger.debug("Mumble link failed permanently")
            return 0

        elif not self.mumbleSetup:
            # Mumble link has never been set up
            logger.debug("Mumble link has never been set up")
            return self.linkMumble()

        elif mumble_link.get_version() == 0:
            # Mumble was shut down in the meantime
            logger.debug("Mumble link has been reset")
            return self.linkMumble()

        else:
            # Mumble link is active
            logger.debug("Mumble link is active")
            return 1
Exemplo n.º 12
0
    def checkMumble(self):

        if self.mumbleFailed:
            # If there was a failure linking to mumble before, don't bother anymore.
            logger.debug("Mumble link failed permanently")
            return 0
        
        elif not self.mumbleSetup:
            # Mumble link has never been set up
            logger.debug("Mumble link has never been set up")
            return self.linkMumble()

        elif mumble_link.get_version() == 0:
            # Mumble was shut down in the meantime
            logger.debug("Mumble link has been reset")
            return self.linkMumble()

        else:
            # Mumble link is active
            logger.debug("Mumble link is active")
            return 1
Exemplo n.º 13
0
    def playerInTeam(self, gameInfo):
        # Check whether this gameInfo signal is about a game we are in
        for team in gameInfo["teams"]:
            for player in gameInfo['teams'][team]:
                if self.client.login == player:
                    logger.debug("We think we are in this game:")
                    logger.debug("self.client.login: "******"gameInfo['teams']: " +
                                 str(gameInfo['teams']))
                    logger.debug("self.uid: " + str(self.uid))
                    logger.debug("gameInfo['uid']: " + str(gameInfo['uid']))
                    logger.debug(str(gameInfo))
                    return 1

        return 0
Exemplo n.º 14
0
 def processGameExit(self):
     logger.debug("gameExit signal")
     self.state = "closed"
     self.mumbleIdentity = "0"
     self.updateMumbleState()
Exemplo n.º 15
0
    def playerInTeam(self, gameInfo):
        # Check whether this gameInfo signal is about a game we are in
        for team in gameInfo["teams"]:
            for player in gameInfo['teams'][team]:
                if self.client.login == player:
                    logger.debug("We think we are in this game:")
                    logger.debug("self.client.login: "******"gameInfo['teams']: " + str(gameInfo['teams']))
                    logger.debug("self.uid: " + str(self.uid))
                    logger.debug("gameInfo['uid']: " + str(gameInfo['uid']))
                    logger.debug(str(gameInfo))
                    return 1

        return 0
Exemplo n.º 16
0
 def processGameExit(self):
     logger.debug("gameExit signal")
     self.state = "closed"
     self.mumbleIdentity = "0"
     self.updateMumbleState()