Пример #1
0
    def onFadeStep(self, seconds, startColor, endColor, progress):
        if self.finishTrigger.type != constants.CONDITION_ITERATE and not self.finishTrigger.check():
            self.finish()
        p = self.finishTrigger.progress() if self.progress == 'louder' else 1.0-self.finishTrigger.progress()
        p = p*100
        if self.progress == 'louder':
            p = min(self.limit, p)
        else:
            p = max(self.limit, p)

        xbmcremote.setVolume(int(p))
Пример #2
0
    def execute(self):
        super(XBMCRequest, self).execute()

        if self.action == constants.REQUEST_XBMC_ACTION_GET:
            if self.cmd == 'player':
                self.answer = xbmcremote.getActivePlayer()
            if self.cmd == 'volume':
                self.answer = xbmcremote.getVolume()

        if self.action == constants.REQUEST_XBMC_ACTION_SET:
            if self.cmd == 'notification':
                self.answer = xbmcremote.showNotification(self.request['params'][0], self.request['params'][1])
            if self.cmd == 'playpause':
                self.answer = xbmcremote.playPause()
            if self.cmd == 'stop':
                self.answer = xbmcremote.stop()
            if self.cmd == 'next':
                self.answer = xbmcremote.next()
            if self.cmd == 'previous':
                self.answer = xbmcremote.previous()
            if self.cmd == 'volume':
                self.answer = xbmcremote.setVolume(int(self.request['params'][0]))
            if self.cmd == 'volup':
                self.answer = xbmcremote.volumeUp()
            if self.cmd == 'voldown':
                self.answer = xbmcremote.volumeDown()

        if self.action == constants.REQUEST_XBMC_ACTION_CMD:
            self.answer = xbmcremote.sendCommand(self.cmd)

        answer = {"type":self.type, self.action:self.cmd, "answer":self.answer}
        return answer