コード例 #1
0
ファイル: oscapi.py プロジェクト: scowalt/chroma-scripts
    def toOSC(self, messagename):
        message = OSCMessage(messagename)
        message.append(8)
        message.append(os.getpid())
        message.append(self.title)
        message.append(self.streamclass)
        message.append(self.framenumber)
        message.append(time.time())
	message.append(self.creator)
	message.append(self.description)
        message.append(self.data)
        return message
コード例 #2
0
ファイル: run.py プロジェクト: milanocookies93/chroma-scripts
                    metavar='animation',
                    help='One of these animations: ' +
                    string.join(os.listdir('animations/'), ', '),
                    choices=os.listdir('animations/'))
args = parser.parse_args()
animation = args.animation

# Open emulator if there's no OSC responsive on that port already
try:
    sys.path.append("./osc")
    from osc import OSCClient, OSCMessage
    s = OSCClient()
    s.connect(('localhost', 11661))
    # asychronous, so send a bunch to get a potential exception.
    for x in range(10):
        s.send(OSCMessage("poop"))
except Exception, e:
    if '[Errno 61]' in str(e):
        print "Starting emulator, since it doesn't seem to be running yet."
        os.system('emulator/lights_emulator > /dev/null &')
        emu_up = False
        while not emu_up:
            try:
                # asychronous, so send a bunch to get a potential exception.
                for x in range(10):
                    s.send(OSCMessage("poop"))
                emu_up = True
            except Exception, e:
                if not '[Errno 61]' in str(e):
                    emu_up = True
                else:
コード例 #3
0
from osc import OSCMessage, OSCBundle, OSCClient, OSCServer

message = OSCMessage(address='/message/address')

# argument can be string, int, float, bool and binary
message.add('Some text argument')
message.add(3)
message.add(0.75)
message.add(True)

# create osc bundle and add a message
bundle = OSCBundle()
bundle.add(message)

# create client and send to 127.0.0.1:8000
client = OSCClient('127.0.0.1', 8000)
client.send(message)
client.send(bundle)

# bind server and listen for incoming messages at 127.0.0.1:8000
server = OSCServer('127.0.0.1', 8000)
server.serve_forever()
コード例 #4
0
ファイル: oscapi.py プロジェクト: RobertPieta/chroma-scripts
 def diff(self, pixels):
     message = OSCMessage("/diffcolors")
     message.append(pixels)
     self.client.send( message )
コード例 #5
0
ファイル: oscapi.py プロジェクト: RobertPieta/chroma-scripts
 def write(self, pixels):
     message = OSCMessage("/setcolors")
     pixels = self.crazyMofoingReorderingOfLights(pixels)
     message.append(pixels)
     self.client.send( message )
コード例 #6
0
#!/usr/bin/python
from osc import OSCServer, OSCClient, OSCMessage
import sys








if __name__ == "__main__":
    if len(sys.argv) < 2:
        print """
sendcommand.py: sends commands to the running oscapi.py daemon.
usage: ./sendcommand.py command
available commands:
    reloadconfig - reloads config.py in the octoapi - usually reordering the lights
"""
        sys.exit(-1)
    messagename = sys.argv[1] 
    client = OSCClient()
    client.connect( ("localhost",11661) )
    message = OSCMessage('/'+messagename)
    for param in sys.argv[2:]:
        message.append(param)
    client.send( message )
コード例 #7
0
 def toOSC(self, messagename):
     message = OSCMessage(messagename)
     message.append(8)
     message.append(os.getpid())
     message.append(self.title)
     message.append(self.streamclass)
     message.append(self.framenumber)
     message.append(time.time())
     message.append(self.creator)
     message.append(self.description)
     message.append(self.data)
     return message