def all_handler(addr, tags, stuff, source):
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    f_out.write(OSC.getUrlStr(source)+'; ')
    print "with addr : %s" % addr
    f_out.write(addr+'; ')
    print "typetags %s" % tags
    print "data %s" % stuff
    f_out.write(addr+'; ')
    f_out.write(str(stuff[0])+'; ')
    f_out.write(str(time.time())+'; ')
    f_out.write('humanreadable: '+datetime.fromtimestamp(int(time.time())).strftime('%Y-%m-%d %H:%M:%S'))
    f_out.write('\n')
Exemplo n.º 2
0
def all_handler(addr, tags, stuff, source):
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    f_out.write(OSC.getUrlStr(source)+'; ')
    print "with addr : %s" % addr
    f_out.write(addr+'; ')
    print "typetags %s" % tags
    print "data %s" % stuff
    for smth in stuff:
        print smth
        f_out.write(str(smth))
        f_out.write('; ')
    f_out.write(str(time.time())+'; ')
    f_out.write('\n')
Exemplo n.º 3
0
def all_handler(addr, tags, stuff, source):
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    f_out.write(OSC.getUrlStr(source) + '; ')
    print "with addr : %s" % addr
    f_out.write(addr + '; ')
    print "typetags %s" % tags
    print "data %s" % stuff
    for smth in stuff:
        print smth
        f_out.write(str(smth))
        f_out.write('; ')
    f_out.write(str(time.time()) + '; ')
    f_out.write('\n')
Exemplo n.º 4
0
 def osc_printing_handler(self, addr, tags, stuff, source):
     msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
     sys.stdout.write("OSCServer Got: '%s' from %s\n" % (msg_string, OSC.getUrlStr(source)))
     # send a reply to the client.
     msg = OSC.OSCMessage("/printed")
     msg.append(msg_string)
     return msg
Exemplo n.º 5
0
def trata(addr, tags, dados, origem):
    m = "%s [%s] %s" % (addr, tags, str(dados))
    #t="%s enviou: %s\n" % (osc.getUrlStr(origem), m)
    t=str((osc.getUrlStr(origem), m))
    print t
    with open("log-golly.txt", "a") as f:
        f.write(t)
Exemplo n.º 6
0
 def _drop(self, message, addr, tags, packet, source, route=None):
     logging.debug("DROPPED (%s) from %s" % (message, OSC.getUrlStr(source)))
     logging.debug("\taddr: %s" % addr)
     logging.debug("\ttypetags: %s" % tags)
     logging.debug("\tdata: %s" % packet)
     if route:
         logging.debug("\troute: %s" % route)
Exemplo n.º 7
0
def transport_handler(addr, tags, args, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "args %s" % args
    print "---"
Exemplo n.º 8
0
def printer(addr, tags, stuff, source):
   	print "---"
    	print "received new osc msg from %s" % OSC.getUrlStr(source)
    	print "with addr : %s" % addr
    	print "typetags %s" % tags
    	print "data %s" % stuff
    	print "---"
def trata(addr, tags, dados, origem):
    m = "%s [%s] %s" % (addr, tags, str(dados))
    #t="%s enviou: %s\n" % (osc.getUrlStr(origem), m)
    t = str((osc.getUrlStr(origem), m))
    print t
    with open("log-golly.txt", "a") as f:
        f.write(t)
Exemplo n.º 10
0
def countsHandler(addr,tags,stuff,source):
    print '---'
    print 'new msg from %s' % OSC.getUrlStr(source)
    print 'with addr: %s' % addr
    print 'typetags %s' % tags
    print 'data %s' %stuff
    print '---'
Exemplo n.º 11
0
 def printMsg(self, addr, tags, stuff, source):
     self.flag = True
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
Exemplo n.º 12
0
def forward_handler(addr, tags, data, source):
    global prefix
    global scake
    global offset

    if debug > 1:
        print("---")
        print("source %s" % OSC.getUrlStr(source))
        print("addr   %s" % addr)
        print("tags   %s" % tags)
        print("data   %s" % data)

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    if tags == 'f' or tags == 'i':
        # it is a single scalar value
        key = prefix + addr.replace('/', '.')
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        patch.setvalue(key, val)

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            # append the index to the key, this starts with 1
            key = prefix + addr.replace('/', '.') + '.%i' % (i + 1)
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            patch.setvalue(key, val)
Exemplo n.º 13
0
def python2_message_handler(addr, tags, data, source):
    global monitor, patch, prefix, output_scale, output_offset

    monitor.debug("addr = %s, tags = %s, data = %s, source %s" %
                  (addr, tags, data, OSC.getUrlStr(source)))

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    if tags == 'f' or tags == 'i':
        # it is a single scalar value
        key = prefix + addr.replace('/', '.')
        val = EEGsynth.rescale(data[0],
                               slope=output_scale,
                               offset=output_offset)
        patch.setvalue(key, val)

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            # append the index to the key, this starts with 1
            key = prefix + addr.replace('/', '.') + '.%i' % (i + 1)
            val = EEGsynth.rescale(data[i],
                                   slope=output_scale,
                                   offset=output_offset)
            patch.setvalue(key, val)
            monitor.update(key, val)
Exemplo n.º 14
0
def handle_root(addr, tags, data, source):
	print "---"
	print "received new osc msg from %s" % OSC.getUrlStr(source)
	print "with addr : %s" % addr
	print "typetags %s" % tags
	print "data %s" % data
	print "---"
Exemplo n.º 15
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received from :  %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags : %s" % tags
    print "data : %s" % stuff
    print "---"
Exemplo n.º 16
0
def forward_handler(addr, tags, data, source):
    global prefix
    global scake
    global offset

    if debug > 1:
        print "---"
        print "source %s" % OSC.getUrlStr(source)
        print "addr   %s" % addr
        print "tags   %s" % tags
        print "data   %s" % data

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    key = prefix + addr.replace('/', '.')

    if tags == 'f' or tags == 'i':
            # it is a single value
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        r.set(key, val)             # send it as control value
        if addr in button_list:
            r.publish(key, val)      # send it as trigger

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            # append the index to the key, this starts with 0
            r.set(key + '.%i' % i, val)
Exemplo n.º 17
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    url="http://www.musicalturk.com/loops/add"
 

    shutil.move('/Users/Kleeb2/Documents/MaxPatches/MusicalTurk/'+ str(stuff[0]), "/Users/Kleeb2/Documents/Web/Python/Thesis/"+str(stuff[0])) 
    filename = str(stuff[0])
    #filename =  '/Users/Kleeb2/Documents/Web/Python/LocalThesis/max.py'
    title = 'test'#str(count).zfill(3)
    date = str(datetime.date.today()) 
    values = [('title', title), ('postedby',date)]
    try:
    	files = {'loop': open(filename, 'rb')}
    except:
    	print 'no file'
    try:
    	r = requests.post(url, files=files, data=values)
    	print r.text
    except:
    	print 'Fail'
Exemplo n.º 18
0
def forward_handler(addr, tags, data, source):
    if debug>1:
      print "---"
      print "source %s" % OSC.getUrlStr(source)
      print "addr   %s" % addr
      print "tags   %s" % tags
      print "data   %s" % data

    if addr[0]!='/':
      # ensure it starts with a slash
      addr = '/' + addr

    # the scale and offset are used to map OSC values to Redis values
    scale  = patch.getfloat('output', 'scale', default=1)
    offset = patch.getfloat('output', 'offset', default=0)

    # the results will be written to redis as "osc.1.faderA" etc.
    key = patch.getstring('output', 'prefix') + addr.replace('/', '.')

    if tags=='f' or tags=='i':
        # it is a single value
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        r.set(key, val)             # send it as control value
        if addr in button_list:
            r.publish(key,val)      # send it as trigger

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            # append the index to the key, this starts with 0
            r.set(key + '.%i' % i, val)
Exemplo n.º 19
0
def printer(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
Exemplo n.º 20
0
def handle_root(addr, tags, data, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    print "---"
Exemplo n.º 21
0
def fader_handler(addr, tags, data, source):
    print "---"
    print "received FADER new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    split = addr.split("/")
    print "split", split
    # split[2] is nu faderx, we want the id
    fadernr = int(split[2][-1:])
    print "fadernr = ", fadernr
    # Add one and loop aftre we are at 5
    next_fader = (fadernr % 5) + 1
    return_addr = "/1/fader%s" % next_fader
    print "Return addres", return_addr
    msg = OSC.OSCMessage()
    msg.setAddress(return_addr)
    msg.append(data)
    c.send(msg)
    print "return message %s" % msg
    print "---"
    if 1 <= fadernr <= 4 and data[0] >= 0.5:
        msg = OSC.OSCMessage()
        toggle_addr = "/1/toggle%s" % fadernr
        msg.setAddress(toggle_addr)
        msg.append(1.0)
        c.send(msg)
        print "return message %s" % msg
    else:
        msg = OSC.OSCMessage()
        toggle_addr = "/1/toggle%s" % fadernr
        msg.setAddress(toggle_addr)
        msg.append(0.0)
        c.send(msg)
        print "return message %s" % msg
Exemplo n.º 22
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received from :  %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags : %s" % tags
    print "data : %s" % stuff
    print "---"
Exemplo n.º 23
0
def forward_handler(addr, tags, data, source):
    global prefix
    global scake
    global offset

    if debug > 1:
        print("---")
        print("source %s" % OSC.getUrlStr(source))
        print("addr   %s" % addr)
        print("tags   %s" % tags)
        print("data   %s" % data)

    if addr[0] != '/':
        # ensure it starts with a slash
        addr = '/' + addr

    if tags == 'f' or tags == 'i':
        # it is a single value
        key = prefix + addr.replace('/', '.')
        val = EEGsynth.rescale(data[0], slope=scale, offset=offset)
        patch.setvalue(key, val)

    else:
        for i in range(len(data)):
            # it is a list, send it as multiple scalar control values
            # append the index to the key, this starts with 0
            key = prefix + addr.replace('/', '.') + '.%i' % i
            val = EEGsynth.rescale(data[i], slope=scale, offset=offset)
            patch.setvalue(key, val)
Exemplo n.º 24
0
def forward_handler(addr, tags, data, source):
    print "---"
    print "source %s" % OSC.getUrlStr(source)
    print "addr   %s" % addr
    print "tags   %s" % tags
    print "data   %s" % data

    scale = EEGsynth.getfloat('processing', 'scale', config, r)
    if scale is None:
        scale = 1

    offset = EEGsynth.getfloat('processing', 'offset', config, r)
    if offset is None:
        offset = 0

    # apply the scale and offset
    for i in range(len(data)):
        data[i] = EEGsynth.rescale(data[i], scale, offset)

    # the results will be written to redis as "osc.1.faderA" etc.
    key = config.get('output', 'prefix') + addr.replace('/', '.')

    if tags == 'f' or tags == 'i':
        # it is a single value
        val = data[0]
        r.set(key, val)  # send it as control value
        if addr in button_list:
            r.publish(key, val)  # send it as trigger

    else:
        # it is a list, send it as a list of control values
        val = data
        r.set(key, val)
Exemplo n.º 25
0
 def no_match_handler(self,addr, tags, stuff, source):
     text=''
     text+= "no match for new osc msg from %s" % OSC.getUrlStr(source)+'\n'
     text+= "with addr : %s" % addr+'\n'
     text+= "typetags %s" % tags+'\n'
     text+= "data %s" % stuff+'\n'
     self.add_status(text+'\n')
Exemplo n.º 26
0
 def no_match_handler(self, addr, tags, stuff, source):
     text = ''
     text += "no match for new osc msg from %s" % OSC.getUrlStr(
         source) + '\n'
     text += "with addr : %s" % addr + '\n'
     text += "typetags %s" % tags + '\n'
     text += "data %s" % stuff + '\n'
     self.add_status(text + '\n')
Exemplo n.º 27
0
 def _drop(self, message, addr, tags, packet, source, route=None):
     logging.debug("DROPPED (%s) from %s" %
                   (message, OSC.getUrlStr(source)))
     logging.debug("\taddr: %s" % addr)
     logging.debug("\ttypetags: %s" % tags)
     logging.debug("\tdata: %s" % packet)
     if route:
         logging.debug("\troute: %s" % route)
Exemplo n.º 28
0
Arquivo: go2.py Projeto: knyar/pieva2
def printing_handler(addr, tags, stuff, source):
    msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
    print "OSCServer Got: '%s' from %s\n" % (msg_string, OSC.getUrlStr(source))
            
            # send a reply to the client.
    msg = OSC.OSCMessage("/printed")
    msg.append(msg_string)
    return msg
Exemplo n.º 29
0
def bgblue_handler(addr, tags, stuff, source):
    if layer.PRINT_BLUE:
        print "---"
        print "received new osc bgrgb msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
Exemplo n.º 30
0
def finger_handler(addr, tags, stuff, source):
    if layer.PRINT_FINGER:
        print "---"
        print "received new osc finger msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
        time.sleep(.5)
Exemplo n.º 31
0
def shape_handler(addr, tags, stuff, source):
    if layer.PRINT_SHAPE:
        print "---"
        print "received new osc shape msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "shape=" + stuff[0]
        print "---"
Exemplo n.º 32
0
def polydelay_handler(addr, tags, args, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "args %s" % args
    print "---"
    method = args.pop(0)
    getattr(poly, method)(args)    
Exemplo n.º 33
0
def boundary_handler(addr, tags, stuff, source):
    if layer.PRINT_BOUNDARY:
        print "---"
        print "received new osc boundary msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
        time.sleep(.5)
Exemplo n.º 34
0
def printing_handler(addr, tags, data, source):
""" A useful handler for dbugging. Prints the OSC message
"""
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    print "---"
Exemplo n.º 35
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
    #leds = stuff[0].encode('string-escape').split('\\x')
    #print leds
    sleep(2)
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
    str1 = "".join(str(x) for x in stuff)
    global oscString
    oscString = str1
Exemplo n.º 37
0
def pair_handler(addr, tags, data, client_address):
    print "osc://%server%server ->" % (OSC.getUrlStr(client_address), addr),
    print "(tags, data): (%server, %server)" % (tags, data)
    unicode_str1 = data[0][2:]
    ut8_1 = eval("u'\u" + unicode_str1 + "'").encode("utf8")
    unicode_str2 = data[1][2:]
    ut8_2 = eval("u'\u" + unicode_str2 + "'").encode("utf8")
    c.morphLoopTile(ut8_1, ut8_2).save("./out/" + unicode_str1 + "_" +
                                       unicode_str2 + ".png")
    return
Exemplo n.º 38
0
def printing_handler (addr, tags, stuff, source):
	print "---"
	print "received new osc msg from %s" % OSC.getUrlStr(source)
	print "with addr : %s" % addr
	print "typetags %s" % tags
	print "data %s" % stuff
	global test 
	test = stuff
	print len(test)
	print "---"	
Exemplo n.º 39
0
def polydelay_handler(addr, tags, data, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    # Call any function that's input stuff = ['function', 'data']
    function = stuff.pop(0)
    getattr(p, function)(stuff)
Exemplo n.º 40
0
def test_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    msg = OSC.OSCMessage()
    msg.setAddress(addr)
    msg.append(stuff)
    print "return message %s" % msg
    print "---"
def test_handler(addr, tags, stuff, source):
	print "---"
	print "received new osc msg from %s" % OSC.getUrlStr(source)
	print "with addr : %s" % addr
	print "typetags %s" % tags
	print "data %s" % stuff
	msg = OSC.OSCMessage()
	msg.setAddress(addr)
	msg.append(stuff)
	print "return message %s" % msg
	print "---"
Exemplo n.º 42
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"
    d = {}
    addr = addr.replace('/1/','')
    d[addr] = stuff[0]
    conn.send(simplejson.dumps(d), destination='/topic/test')
Exemplo n.º 43
0
def printing_handler(addr, tags, stuff, source):
    print "---"
    print "received from :  %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags : %s" % tags
    print "data : %s" % stuff
    print "---"
    print "gpio is %s" % stuff[1]
    GPIO.output(4, stuff[0])
    GPIO.output(17, stuff[1])
    GPIO.output(27, stuff[2])
Exemplo n.º 44
0
def repeater_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    count = stuff[0]
    message = stuff[1]
    full_message = repeater(count, message)
    osc_client.send( OSC.OSCMessage("/repeater/message", full_message ) )
Exemplo n.º 45
0
def test_handler(addr, tags, stuff, source):
	print("---")
	print("received new osc msg from %s" % OSC.getUrlStr(source))
	print("with addr : %s" % addr)
	print("typetags %s" % tags)
	print("data %s" % stuff)
	msg = OSC.OSCMessage()
	msg.setAddress(addr)
	msg.append(stuff)
	c.send(msg)
	print("return message %s" % msg)
	print("---")
Exemplo n.º 46
0
def repeater_handler(addr, tags, stuff, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % stuff
    print "---"

    count = stuff[0]
    message = stuff[1]
    full_message = repeater(count, message)
    osc_client.send(OSC.OSCMessage("/repeater/message", full_message))
Exemplo n.º 47
0
 def msg_data(self, addr, tags, stuff, source):
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
     try:
         if len(stuff) > 1:
             self.d[stuff[0]] = stuff[1]
     except:
         print("error")
     return
Exemplo n.º 48
0
 def kill(self, addr, tags, stuff, source):
     self.flag = False
     try:
         self.pipeline.stop()
         print "[PY] stop pyrealsense"
     except:
         print "[PY] error stop pyrealsense"
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
Exemplo n.º 49
0
def alone_handler(addr, tags, data, client_address):
    print "gan osc://%server%server ->" % (OSC.getUrlStr(client_address),
                                           addr),
    print "(tags, data): (%server, %server)" % (tags, data)
    unicode_str1 = data[0][2:]
    print unicode_str1
    ut8_1 = eval("u'\u" + unicode_str1 + "'").encode("utf8")
    print ut8_1
    log.append(ut8_1)
    if len(log) > 1:
        img = c.morphLoopTile(log[-1], log[-2])
        img.save("./out/" + unicode_str1 + "_.png")
    return
Exemplo n.º 50
0
def launchpad_handler(addr, tags, args, source):
    print "---"
    print "received new osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "args %s" % args
    print "---"
    method = args.pop(0)
    if method == 'refresh':
        launch.refresh(poly)
    elif method == 'press':
        launch.press(poly,args)
    else:
        getattr(launch, method)(*args)
Exemplo n.º 51
0
def attractor_handler(addr, tags, stuff, source):
    print "---"
    print "Received new osc msg from %s" % OSC.getUrlStr(source)
    print "With addr : %s" % addr
    print "Typetags %s" % tags
    global attractors
    attractor = random.choice(attractors) #modify a random attractor
    for item in stuff:
        print "data %f" % item
    # Assign dimension values
    for i in range(NDIMS):
        attractor.position.x[i] = int( min(max(stuff[i],0.0),1.0) * DIMLIMIT )
    print "Dim %d val: %d" % (i,attractor.position.x[i])
    print "---"
def message_handler(addr, tags, stuff, source):
    # ECHO MESSAGE TO MACHINES
    msg = OSC.OSCMessage()
    msg.setAddress(addr)
    msg.append(stuff)
    for i in range(len(machinesIP)) : 
        oscClients[i].send(msg)
    # PRINT MESSAGE
    if printMessage :    
        print "---"
        print "received new osc msg from %s" % OSC.getUrlStr(source)
        print "with addr : %s" % addr
        print "typetags %s" % tags
        print "data %s" % stuff
        print "---"
Exemplo n.º 53
0
def random_multi(addr, tags, data, source):
    print "---"
    print "received random_multi osc msg from %s" % OSC.getUrlStr(source)
    print "with addr : %s" % addr
    print "typetags %s" % tags
    print "data %s" % data
    if randommulti is None and data[0] == 1:
        # Start random thread
        print "Start RandomMulti"
        rm = RandomMulti()
        global randommulti

        randommulti = threading.Thread(target=rm.run)
        randommulti.daemon = True
        randommulti.start()
Exemplo n.º 54
0
	def ping_handler(self,addr, tags, stuff, source):
		
		# save address where ping came from
		pingSource = OSC.getUrlStr(source).split(':')[0]
		if settings.get('remoteControlAddress') != pingSource:
			settings.set('remoteControlAddress',pingSource)
		
		# read the port of the remote control programm from settings
		port = settings.get('remoteControlPort')
		
		# send pong message back
		client = OSC.OSCClient()
		msg = OSC.OSCMessage()
		msg.setAddress("/vega/pong")
		msg.append(1234)
		client.sendto(msg, (pingSource, port))
Exemplo n.º 55
0
def osc_parse(addr, tags, stuff, source):
    global new_osc_msg, msg_tg
    print('<----- OSC in: ')
    print("	received new OSC msg from %s" % OSC.getUrlStr(source))
    print("	with addr : %s" % addr)
    print("	typetags %s" % tags)
    print("	data %s" % stuff)
    print("	---")
    if addr in configure.osc_subscriber:
        print('address pattern: pass')
        if (tags == 's'):
            print('typetag: pass')
            #m = addr + ' ' + stuff[0].strip()
            #bot.sendMessage(masterId, m)
            new_osc_msg = True
            msg_tg = addr + ' ' + stuff[0].strip()
Exemplo n.º 56
0
Arquivo: go.py Projeto: knyar/pieva2
    def pairing_handler(self, addr, tags, stuff, source):

        msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
        print "Got pairing message: '%s' from %s\n" % (msg_string, OSC.getUrlStr(source))
        self.paired = 1
        global updateMode

        print "Subscribing in", ("continuous" if updateMode else "event" ), "mode"
        #self.c2 = OSC.OSCClient()
        #self.c2.connect(send_address)
        subreq = OSC.OSCMessage("/MashMachine/Global/subscribeObjectsID")
        #  /MashMachine/Global/subscribeObjectsPosition
        subreq.append(listen_address[0])

        #subreq.append(updateMode)
        self.c2.send(subreq)
Exemplo n.º 57
0
Arquivo: go.py Projeto: knyar/pieva2
    def pairing_handler(self, addr, tags, stuff, source):

        msg_string = "%s [%s] %s" % (addr, tags, str(stuff))
        print "Got pairing message: '%s' from %s\n" % (msg_string,
                                                       OSC.getUrlStr(source))
        self.paired = 1
        global updateMode

        print "Subscribing in", ("continuous"
                                 if updateMode else "event"), "mode"
        #self.c2 = OSC.OSCClient()
        #self.c2.connect(send_address)
        subreq = OSC.OSCMessage("/MashMachine/Global/subscribeObjectsID")
        #  /MashMachine/Global/subscribeObjectsPosition
        subreq.append(listen_address[0])

        #subreq.append(updateMode)
        self.c2.send(subreq)
Exemplo n.º 58
0
 def imageSaved(self, addr, tags, stuff, source):
     print "---"
     print "received new osc msg from %s" % OSC.getUrlStr(source)
     print "with addr : %s" % addr
     print "typetags %s" % tags
     print "data %s" % stuff
     filename = stuff[0]
     qrname = uploadImgur(filename)
     if (qrname == "none"):
         msg2 = OSC.OSCMessage()
         msg2.setAddress("/image/uploaderror")
         msg2.append(qrname)
         self.c.send(msg2)
     msg = OSC.OSCMessage()
     msg.setAddress("/image/uploaded")
     msg.append(qrname)
     self.c.send(msg)
     return