Network bugfixs

This commit is contained in:
nrhck 2019-03-20 03:00:00 +01:00
parent eb5b9b25f2
commit 904f920a4d
10 changed files with 70 additions and 20 deletions

1
cli.py
View File

@ -116,6 +116,7 @@ def handle():
else: else:
gstt.oscIPin = '127.0.0.1' gstt.oscIPin = '127.0.0.1'
if args.nozoidIP != None: if args.nozoidIP != None:
gstt.nozoscIP = args.nozoidIP gstt.nozoscIP = args.nozoidIP
else: else:

View File

@ -112,6 +112,8 @@ wsPORT = 9001
# OSC Server : accept OSC message on port 8002 # OSC Server : accept OSC message on port 8002
#oscIPin = "192.168.1.10"s #oscIPin = "192.168.1.10"s
extoscIPin = serverIP extoscIPin = serverIP
print "extoscIPin", extoscIPin
extoscPORTin = 8002 extoscPORTin = 8002
# OSC Client : to send OSC message to an IP port 8001 # OSC Client : to send OSC message to an IP port 8001

View File

@ -340,8 +340,9 @@ def Starfield(hori=0,verti=0):
lj3.DrawPL(3) lj3.DrawPL(3)
def OSCidiotia(address, value): def OSCidiotia(address,value):
print("Pose bank idiotia got", address, "with value", value) print("idiotia",address,value)
def OSCfield(address, value): def OSCfield(address, value):
@ -401,6 +402,10 @@ anims =[[],[],[],[]]
color = lj3.rgb2int(255,255,255) color = lj3.rgb2int(255,255,255)
prepareIdiotIA() prepareIdiotIA()
#prepareSTARFIELD() #prepareSTARFIELD()

View File

@ -52,8 +52,8 @@ from osc4py3 import oscbuildparse
from osc4py3.oscmethod import * from osc4py3.oscmethod import *
redisIP = '127.0.0.1' #redisIP = '127.0.0.1'
r = redis.StrictRedis(host=redisIP, port=6379, db=0) #r = redis.StrictRedis(host=redisIP, port=6379, db=0)
ClientNumber = 0 ClientNumber = 0
@ -225,11 +225,12 @@ def rgb2int(r,g,b):
def Config(redisIP,client): def Config(redisIP,client):
global ClientNumber global ClientNumber, r
r = redis.StrictRedis(host=redisIP, port=6379, db=0) r = redis.StrictRedis(host=redisIP, port=6379, db=0)
ClientNumber = client ClientNumber = client
osc_udp_client(redisIP, 8002, "LJ 8002") osc_udp_client(redisIP, 8002, "LJ 8002")
return r
def LjClient(client): def LjClient(client):

View File

@ -21,6 +21,7 @@ from osc4py3 import oscbuildparse
from osc4py3.oscmethod import * from osc4py3.oscmethod import *
OSCinPort = 8004 OSCinPort = 8004
myIP = "192.168.2.52"
print ("") print ("")
print ("Arguments parsing if needed...") 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("-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("-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("-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() args = argsparser.parse_args()
@ -49,6 +51,15 @@ if args.redisIP != None:
else: else:
redisIP = '127.0.0.1' 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: if args.verbose:
debug = args.verbose debug = args.verbose
@ -159,12 +170,12 @@ def Run():
Left = [] Left = []
Right = [] Right = []
counter =0 counter =0
WebStatus("LaserGlyph") lj3.WebStatus("LaserGlyph")
# OSC Server callbacks # OSC Server callbacks
print("Starting OSC at 127.0.0.1 port",OSCinPort,"...") print("Starting OSC at",myIP," port",OSCinPort,"...")
osc_startup() osc_startup()
osc_udp_server("127.0.0.1", OSCinPort, "InPort") osc_udp_server(myIP, OSCinPort, "InPort")
osc_method("/ping*", lj3.OSCping) osc_method("/ping*", lj3.OSCping)
osc_method("/glyph/ljclient", OSCljclient) osc_method("/glyph/ljclient", OSCljclient)
@ -227,7 +238,7 @@ def Run():
finally: finally:
WebStatus("Glyph Exit") lj3.WebStatus("Glyph Exit")
print("Stopping OSC...") print("Stopping OSC...")
lj3.OSCstop() lj3.OSCstop()
pass pass

View File

@ -15,6 +15,7 @@ from osc4py3 import oscbuildparse
#from osc4py3 import oscmethod as osm #from osc4py3 import oscmethod as osm
from osc4py3.oscmethod import * from osc4py3.oscmethod import *
myIP = "127.0.0.1"
duration = 300 duration = 300
@ -35,6 +36,7 @@ else:
print ("Words is checking arguments parsing if needed...") print ("Words is checking arguments parsing if needed...")
argsparser = argparse.ArgumentParser(description="Text Cycling for LJ") 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("-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("-c","--client",help="LJ client number (0 by default)",type=int)
argsparser.add_argument("-v","--verbose",help="Verbosity level (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: else:
redisIP = '127.0.0.1' redisIP = '127.0.0.1'
# myIP
if args.myIP != None:
myIP = args.myIP
else:
myIP = '127.0.0.1'
if args.verbose: if args.verbose:
debug = args.verbose debug = args.verbose
@ -116,9 +124,9 @@ def OSCquit():
def Run(): def Run():
# OSC Server callbacks # 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_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/0*", OSCword0)
osc_method("/words/text/1*", OSCword1) osc_method("/words/text/1*", OSCword1)
osc_method("/words/text/2*", OSCword2) osc_method("/words/text/2*", OSCword2)

View File

@ -52,8 +52,8 @@ from osc4py3 import oscbuildparse
from osc4py3.oscmethod import * from osc4py3.oscmethod import *
redisIP = '127.0.0.1' #redisIP = '127.0.0.1'
r = redis.StrictRedis(host=redisIP, port=6379, db=0) #r = redis.StrictRedis(host=redisIP, port=6379, db=0)
ClientNumber = 0 ClientNumber = 0
@ -225,11 +225,12 @@ def rgb2int(r,g,b):
def Config(redisIP,client): def Config(redisIP,client):
global ClientNumber global ClientNumber, r
r = redis.StrictRedis(host=redisIP, port=6379, db=0) r = redis.StrictRedis(host=redisIP, port=6379, db=0)
ClientNumber = client ClientNumber = client
osc_udp_client(redisIP, 8002, "LJ 8002") osc_udp_client(redisIP, 8002, "LJ 8002")
return r
def LjClient(client): def LjClient(client):

View File

@ -28,8 +28,8 @@ from osc4py3.as_eventloop import *
from osc4py3 import oscbuildparse from osc4py3 import oscbuildparse
redisIP = '127.0.0.1' #redisIP = '127.0.0.1'
r = redis.StrictRedis(host=redisIP, port=6379, db=0) #r = redis.StrictRedis(host=redisIP, port=6379, db=0)
ClientNumber = 0 ClientNumber = 0

View File

@ -31,8 +31,10 @@ import pdb
import types, ast, argparse import types, ast, argparse
from OSC import OSCServer, OSCClient, OSCMessage from OSC import OSCServer, OSCClient, OSCMessage
pl = [[],[],[],[]] pl = [[],[],[],[]]
print ("") print ("")
print ("LJ v0.8.0 : Pygame simulator") print ("LJ v0.8.0 : Pygame simulator")
print ("") print ("")
@ -44,6 +46,7 @@ print ("Arguments parsing if needed...")
argsparser = argparse.ArgumentParser(description="Available commands") 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("-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("-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("-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("-v","--verbose",help="Verbosity level (0 by default)",type=int)
@ -76,14 +79,22 @@ else:
r = redis.StrictRedis(host=redisIP, port=6379, db=0) r = redis.StrictRedis(host=redisIP, port=6379, db=0)
# myIP
if args.myIP != None:
myIP = args.myIP
else:
myIP = '127.0.0.1'
# #
# OSC # OSC
# #
oscIPin = "127.0.0.1" oscIPin = myIP
oscPORTin = 8008 oscPORTin = 8008
ljIP = "127.0.0.1" ljIP = redisIP
ljPort = 8002 ljPort = 8002
print ("") print ("")

View File

@ -35,6 +35,7 @@ else:
print ("Arguments parsing if needed...") print ("Arguments parsing if needed...")
argsparser = argparse.ArgumentParser(description="Text Cycling for LJ") 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("-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("-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("-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("-v","--verbose",help="Verbosity level (0 by default)",type=int)
@ -64,6 +65,14 @@ if args.redisIP != None:
else: else:
redisIP = '127.0.0.1' redisIP = '127.0.0.1'
# myIP
if args.myIP != None:
myIP = args.myIP
else:
myIP = '127.0.0.1'
lj3.Config(redisIP,ljclient) lj3.Config(redisIP,ljclient)
#r = redis.StrictRedis(host=redisIP, port=6379, db=0) #r = redis.StrictRedis(host=redisIP, port=6379, db=0)
@ -101,8 +110,9 @@ def OSCquit():
lj3.OSCquit("cycl") lj3.OSCquit("cycl")
print("Cycl starting its OSC server at", myIP, "port",OSCinPort,"...")
osc_startup() osc_startup()
osc_udp_server("127.0.0.1", OSCinPort, "InPort") osc_udp_server(myIP, OSCinPort, "InPort")
osc_method("/ping*", OSCping) osc_method("/ping*", OSCping)
osc_method("/quit", OSCquit) osc_method("/quit", OSCquit)