From 904f920a4dfe73a1eed72a73a22fe0f29a449e26 Mon Sep 17 00:00:00 2001 From: nrhck Date: Wed, 20 Mar 2019 03:00:00 +0100 Subject: [PATCH] Network bugfixs --- cli.py | 1 + main.py | 2 ++ plugins/VJing/idiotia.py | 9 +++++++-- plugins/VJing/lj3.py | 7 ++++--- plugins/laserglyph.py | 19 +++++++++++++++---- plugins/livewords.py | 12 ++++++++++-- plugins/lj3.py | 7 ++++--- plugins/planetarium/lj3.py | 6 +++--- plugins/pysimu.py | 15 +++++++++++++-- plugins/textcycl.py | 12 +++++++++++- 10 files changed, 70 insertions(+), 20 deletions(-) diff --git a/cli.py b/cli.py index 6179cfb..ec72206 100644 --- a/cli.py +++ b/cli.py @@ -115,6 +115,7 @@ def handle(): gstt.oscIPin = args.bhoroscIP else: gstt.oscIPin = '127.0.0.1' + if args.nozoidIP != None: gstt.nozoscIP = args.nozoidIP diff --git a/main.py b/main.py index 446ac9b..1310df7 100755 --- a/main.py +++ b/main.py @@ -112,6 +112,8 @@ wsPORT = 9001 # OSC Server : accept OSC message on port 8002 #oscIPin = "192.168.1.10"s extoscIPin = serverIP + +print "extoscIPin", extoscIPin extoscPORTin = 8002 # OSC Client : to send OSC message to an IP port 8001 diff --git a/plugins/VJing/idiotia.py b/plugins/VJing/idiotia.py index c1298c8..0518489 100644 --- a/plugins/VJing/idiotia.py +++ b/plugins/VJing/idiotia.py @@ -340,8 +340,9 @@ def Starfield(hori=0,verti=0): lj3.DrawPL(3) -def OSCidiotia(address, value): - print("Pose bank idiotia got", address, "with value", value) +def OSCidiotia(address,value): + print("idiotia",address,value) + def OSCfield(address, value): @@ -401,6 +402,10 @@ anims =[[],[],[],[]] color = lj3.rgb2int(255,255,255) + + + + prepareIdiotIA() #prepareSTARFIELD() diff --git a/plugins/VJing/lj3.py b/plugins/VJing/lj3.py index 3060693..219b3e5 100644 --- a/plugins/VJing/lj3.py +++ b/plugins/VJing/lj3.py @@ -52,8 +52,8 @@ from osc4py3 import oscbuildparse from osc4py3.oscmethod import * -redisIP = '127.0.0.1' -r = redis.StrictRedis(host=redisIP, port=6379, db=0) +#redisIP = '127.0.0.1' +#r = redis.StrictRedis(host=redisIP, port=6379, db=0) ClientNumber = 0 @@ -225,11 +225,12 @@ def rgb2int(r,g,b): def Config(redisIP,client): - global ClientNumber + global ClientNumber, r r = redis.StrictRedis(host=redisIP, port=6379, db=0) ClientNumber = client osc_udp_client(redisIP, 8002, "LJ 8002") + return r def LjClient(client): diff --git a/plugins/laserglyph.py b/plugins/laserglyph.py index 5a50844..9d2378f 100644 --- a/plugins/laserglyph.py +++ b/plugins/laserglyph.py @@ -21,6 +21,7 @@ from osc4py3 import oscbuildparse from osc4py3.oscmethod import * OSCinPort = 8004 +myIP = "192.168.2.52" print ("") print ("Arguments parsing if needed...") @@ -29,6 +30,7 @@ argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int) argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int) argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int) +argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str) args = argsparser.parse_args() @@ -49,6 +51,15 @@ if args.redisIP != None: else: redisIP = '127.0.0.1' +print("redisIP",redisIP) + +# myIP +if args.myIP != None: + myIP = args.myIP +else: + myIP = '127.0.0.1' + +print("redisIP",redisIP) if args.verbose: debug = args.verbose @@ -159,12 +170,12 @@ def Run(): Left = [] Right = [] counter =0 - WebStatus("LaserGlyph") + lj3.WebStatus("LaserGlyph") # OSC Server callbacks - print("Starting OSC at 127.0.0.1 port",OSCinPort,"...") + print("Starting OSC at",myIP," port",OSCinPort,"...") osc_startup() - osc_udp_server("127.0.0.1", OSCinPort, "InPort") + osc_udp_server(myIP, OSCinPort, "InPort") osc_method("/ping*", lj3.OSCping) osc_method("/glyph/ljclient", OSCljclient) @@ -227,7 +238,7 @@ def Run(): finally: - WebStatus("Glyph Exit") + lj3.WebStatus("Glyph Exit") print("Stopping OSC...") lj3.OSCstop() pass diff --git a/plugins/livewords.py b/plugins/livewords.py index d0d48c1..e57fbf6 100644 --- a/plugins/livewords.py +++ b/plugins/livewords.py @@ -15,6 +15,7 @@ from osc4py3 import oscbuildparse #from osc4py3 import oscmethod as osm from osc4py3.oscmethod import * +myIP = "127.0.0.1" duration = 300 @@ -35,6 +36,7 @@ else: print ("Words is checking arguments parsing if needed...") argsparser = argparse.ArgumentParser(description="Text Cycling for LJ") argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str) +argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str) argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int) argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int) @@ -52,6 +54,12 @@ if args.redisIP != None: else: redisIP = '127.0.0.1' +# myIP +if args.myIP != None: + myIP = args.myIP +else: + myIP = '127.0.0.1' + if args.verbose: debug = args.verbose @@ -116,9 +124,9 @@ def OSCquit(): def Run(): # OSC Server callbacks - print("Words starting its OSC server at 127.0.0.1 port",OSCinPort,"...") + print("Words starting its OSC server at", myIP, "port",OSCinPort,"...") osc_startup() - osc_udp_server("127.0.0.1", OSCinPort, "InPort") + osc_udp_server(myIP, OSCinPort, "InPort") osc_method("/words/text/0*", OSCword0) osc_method("/words/text/1*", OSCword1) osc_method("/words/text/2*", OSCword2) diff --git a/plugins/lj3.py b/plugins/lj3.py index 3060693..219b3e5 100644 --- a/plugins/lj3.py +++ b/plugins/lj3.py @@ -52,8 +52,8 @@ from osc4py3 import oscbuildparse from osc4py3.oscmethod import * -redisIP = '127.0.0.1' -r = redis.StrictRedis(host=redisIP, port=6379, db=0) +#redisIP = '127.0.0.1' +#r = redis.StrictRedis(host=redisIP, port=6379, db=0) ClientNumber = 0 @@ -225,11 +225,12 @@ def rgb2int(r,g,b): def Config(redisIP,client): - global ClientNumber + global ClientNumber, r r = redis.StrictRedis(host=redisIP, port=6379, db=0) ClientNumber = client osc_udp_client(redisIP, 8002, "LJ 8002") + return r def LjClient(client): diff --git a/plugins/planetarium/lj3.py b/plugins/planetarium/lj3.py index 115f2db..22cb4af 100644 --- a/plugins/planetarium/lj3.py +++ b/plugins/planetarium/lj3.py @@ -28,8 +28,8 @@ from osc4py3.as_eventloop import * from osc4py3 import oscbuildparse -redisIP = '127.0.0.1' -r = redis.StrictRedis(host=redisIP, port=6379, db=0) +#redisIP = '127.0.0.1' +#r = redis.StrictRedis(host=redisIP, port=6379, db=0) ClientNumber = 0 @@ -67,7 +67,7 @@ def SendLJ(oscaddress,oscargs=''): # Answer to LJ pings def OSCping(value): - + print("I got /ping with value", value) SendLJ("/pong",value) diff --git a/plugins/pysimu.py b/plugins/pysimu.py index 0d28226..f953dcf 100755 --- a/plugins/pysimu.py +++ b/plugins/pysimu.py @@ -31,8 +31,10 @@ import pdb import types, ast, argparse from OSC import OSCServer, OSCClient, OSCMessage + pl = [[],[],[],[]] + print ("") print ("LJ v0.8.0 : Pygame simulator") print ("") @@ -44,6 +46,7 @@ print ("Arguments parsing if needed...") argsparser = argparse.ArgumentParser(description="Available commands") argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str) +argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str) argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int) argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int) argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int) @@ -76,14 +79,22 @@ else: r = redis.StrictRedis(host=redisIP, port=6379, db=0) +# myIP +if args.myIP != None: + myIP = args.myIP +else: + myIP = '127.0.0.1' + + + # # OSC # -oscIPin = "127.0.0.1" +oscIPin = myIP oscPORTin = 8008 -ljIP = "127.0.0.1" +ljIP = redisIP ljPort = 8002 print ("") diff --git a/plugins/textcycl.py b/plugins/textcycl.py index 4ac34e6..ce33b84 100644 --- a/plugins/textcycl.py +++ b/plugins/textcycl.py @@ -35,6 +35,7 @@ else: print ("Arguments parsing if needed...") argsparser = argparse.ArgumentParser(description="Text Cycling for LJ") argsparser.add_argument("-r","--redisIP",help="IP of the Redis server used by LJ (127.0.0.1 by default) ",type=str) +argsparser.add_argument("-m","--myIP",help="Local IP (127.0.0.1 by default) ",type=str) argsparser.add_argument("-c","--client",help="LJ client number (0 by default)",type=int) argsparser.add_argument("-l","--laser",help="Laser number to be displayed (0 by default)",type=int) argsparser.add_argument("-v","--verbose",help="Verbosity level (0 by default)",type=int) @@ -64,6 +65,14 @@ if args.redisIP != None: else: redisIP = '127.0.0.1' + +# myIP +if args.myIP != None: + myIP = args.myIP +else: + myIP = '127.0.0.1' + + lj3.Config(redisIP,ljclient) #r = redis.StrictRedis(host=redisIP, port=6379, db=0) @@ -101,8 +110,9 @@ def OSCquit(): lj3.OSCquit("cycl") +print("Cycl starting its OSC server at", myIP, "port",OSCinPort,"...") osc_startup() -osc_udp_server("127.0.0.1", OSCinPort, "InPort") +osc_udp_server(myIP, OSCinPort, "InPort") osc_method("/ping*", OSCping) osc_method("/quit", OSCquit)