本文整理汇总了Python中OSC.getUrlStr方法的典型用法代码示例。如果您正苦于以下问题:Python OSC.getUrlStr方法的具体用法?Python OSC.getUrlStr怎么用?Python OSC.getUrlStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSC
的用法示例。
在下文中一共展示了OSC.getUrlStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: all_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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')
示例2: all_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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')
示例3: osc_printing_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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
示例4: handle_root
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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 "---"
示例5: printer
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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 "---"
示例6: countsHandler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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 '---'
示例7: forward_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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)
示例8: _drop
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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)
示例9: transport_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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 "---"
示例10: printing_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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 "---"
示例11: no_match_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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')
示例12: trata
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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)
示例13: fader_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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
示例14: printing_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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'
示例15: bgblue_handler
# 需要导入模块: import OSC [as 别名]
# 或者: from OSC import getUrlStr [as 别名]
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 "---"