def surround(self, dummyEvent, osdCatEnabled, cycle): """cycle surround things between our preferred values""" commands = cycle[self.surroundIdx] onlyShowStatus = osdCatEnabled and self.lastSurroundTime is None or elapsedSince(self.lastSurroundTime) > 10 self.lastSurroundTime = datetime.datetime.now() if onlyShowStatus: return self.ask('MS') self.surroundIdx += 1 if self.surroundIdx == len(cycle): self.surroundIdx = 0 if not isinstance(commands, list): commands = list([commands]) def gotStatus(answerMsg): """got current status""" result = succeed(None) def gotChange(answerMsg): """check again after each command""" answer = answerMsg.decoded for command in commands: if command == answer: continue if command == 'MSDTS NEO:6' and answer.startswith('MSDOLBY D'): continue if command == 'MSDOLBY PL2' and answer.startswith('MSDOLBY'): continue if command == 'PSMODE:CINEMA' and answer.endswith('C'): continue if command == 'PSMODE:MUSIC' and answer.endswith('M'): continue result.addCallback(self.push, command).addCallback(gotChange) return return gotChange(answerMsg) return self.ask('MS').addCallback(gotStatus)
def close(self): """close connection if open""" if self.protocol: if not (self.tasks.running or self.tasks.queued): if elapsedSince(self.tasks.allRequests[-1].sendTime) > self.closeTimeout - 1: logDebug(self, None, 'closing Yamaha') self.protocol.transport.loseConnection() self.protocol = None
def close(self): """close connection if open""" if self.protocol: if not (self.tasks.running or self.tasks.queued): if elapsedSince(self.tasks.allRequests[-1].sendTime ) > self.closeTimeout - 1: logDebug(self, None, 'closing Yamaha') self.protocol.transport.loseConnection() self.protocol = None
def close(self): """close connection if open""" if self.protocol: if not (self.tasks.running or self.tasks.queued): if elapsedSince(self.tasks.allRequests[-1].sendTime) > self.closeTimeout - 1: LOGGER.debug('closing vdr') self.write('quit\n') self.protocol.transport.loseConnection() self.protocol = None
def close(self): """close connection if open""" if self.protocol: if not (self.tasks.running or self.tasks.queued): if elapsedSince(self.tasks.allRequests[-1].sendTime) > self.closeTimeout - 1: logDebug(self, None, 'closing vdr after closeTimeout {}'.format(self.closeTimeout)) self.write('quit\n') self.protocol.transport.loseConnection() self.protocol = None
def surround(self, dummyEvent, osdCatEnabled, cycle): """cycle surround things between our preferred values""" commands = cycle[self.surroundIdx] onlyShowStatus = osdCatEnabled and self.lastSurroundTime is None or elapsedSince( self.lastSurroundTime) > 10 self.lastSurroundTime = datetime.datetime.now() if onlyShowStatus: return self.ask('MS') self.surroundIdx += 1 if self.surroundIdx == len(cycle): self.surroundIdx = 0 if not isinstance(commands, list): commands = list([commands]) def gotStatus(answerMsg): """got current status""" result = succeed(None) def gotChange(answerMsg): """check again after each command""" answer = answerMsg.decoded for command in commands: if command == answer: continue if command == 'MSDTS NEO:6' and answer.startswith( 'MSDOLBY D'): continue if command == 'MSDOLBY PL2' and answer.startswith( 'MSDOLBY'): continue if command == 'PSMODE:CINEMA' and answer.endswith('C'): continue if command == 'PSMODE:MUSIC' and answer.endswith('M'): continue result.addCallback(self.push, command).addCallback(gotChange) return return gotChange(answerMsg) return self.ask('MS').addCallback(gotStatus)
def standbyIfUnused(self): """if we are muted long enough, go to standby""" if self.videoMuted and elapsedSince(self.videoMuted) + 1 > self.tvTimeout: return self.standby(None)
def standbyIfUnused(self): """if we are muted long enough, go to standby""" if self.videoMuted and elapsedSince( self.videoMuted) + 1 > self.tvTimeout: return self.standby(None)