def handle(self): packet = ArtNetPacket.from_buffer(bytearray(self.request[0])) if (self.client_address[0] == "131.179.141.17"): # pretty print received packet T = strftime("%Y-%m-%d %H:%M:%S") print "%s Received from %s:%i %s \n" % (T, self.client_address[0], self.client_address[1], packet)
def handle(self): global lastr, lastg, lastb packet = ArtNetPacket.from_buffer(bytearray(self.request[0])) # make sure packet is coming from TV1 if (self.client_address[0] == "131.179.141.17"): print packet.payload if (packet.payload[9]!=lastr or packet.payload[10]!=lastg or packet.payload[11]!=lastb): T = strftime("%Y-%m-%d %H:%M:%S") print T print "rgb : ",packet.payload[9],packet.payload[10],packet.payload[11] seq.sendAllLights(packet.payload[9],packet.payload[10],packet.payload[11]) lastr = packet.payload[9] lastg = packet.payload[10] lastb = packet.payload[11]