conf template

This commit is contained in:
sam 2020-09-28 01:04:05 +02:00
parent 60da52df35
commit 4470cff98c
12 changed files with 216 additions and 69 deletions

View file

@ -22,7 +22,7 @@ def handle():
#have to be done before importing bhorosc.py to get correct port assignment
argsparser = argparse.ArgumentParser(description="LJ v0.8")
argsparser.add_argument("-r","--redisIP",help="IP address to bind builtin servers (OSC and websocket) also must be the Redis server IP ",type=str)
argsparser.add_argument("-L","--Lasers",help="Number of lasers requested (Autodetected by default).",type=int)
argsparser.add_argument("-L","--Lasers",help="Number of lasers requested (1 by default).",type=int)
argsparser.add_argument("-v","--verbose",help="Debug mode 0,1 or 2 (0 by default)",type=int)
argsparser.add_argument("-x","--invx",help="Invert laser 0 X axis again",action="store_true")
argsparser.add_argument("-y","--invy",help="Invert laser 0 Y axis again",action="store_true")
@ -113,7 +113,7 @@ def handle():
if args.Lasers != None:
gstt.LaserNumber = args.Lasers
else:
gstt.LaserNumber = -1
gstt.LaserNumber = 1
if args.bhoroscIP != None:

View file

@ -188,8 +188,8 @@ def NoteOn(note):
print("Only",gstt.LaserNumber,"lasers asked, you dum ass !")
plugins.sendWSall("/redstatus No Laser"+str(note-24))
plugins.sendWSall("/laser "+str(gstt.LaserNumber-1))
plugins.SendAll("/laser "+str(gstt.LaserNumber-1))
else:
gstt.Laser = note -24
plugins.sendWSall("/status Laser " + str(gstt.Laser))
@ -282,12 +282,6 @@ def handler(oscpath, args):
NoteOn(int(args[0]))
# regen index.html (python build.py)
elif oscpath[1] == "regen":
subprocess.Popen(["python", plugins.ljpath + "/webui/build.py"])
# todo
elif oscpath[1] == "CC":
CC(int(args[0]), int(args[1]))
@ -342,13 +336,14 @@ def handler(oscpath, args):
if oscpath[2] == "regen":
print()
print("Regen www pages...")
print("Regen www pages with",gstt.wwwIP,"...")
UpdateAllwww()
if oscpath[2] == "IP":
print()
print("new server IP for www regen",args[0])
gstt.wwwIP = args[0]
settings.Write()
if oscpath[2] == "debug":
@ -361,7 +356,6 @@ def handler(oscpath, args):
if oscpath[2] == "rescan":
print()
print("Rescanning DACs...")
DAChecks()
print("Done.")
@ -374,7 +368,11 @@ def handler(oscpath, args):
plugins.Restart(args[0])
print()
''' regen index.html (python build.py)
elif oscpath[1] == "regen":
print("new ui IP", args[0])
#subprocess.Popen(["python3", plugins.ljpath + "/webui/build.py"])
'''
#
@ -518,21 +516,25 @@ def handler(oscpath, args):
# Different useful codes for some commands
#
def Updatewww(file_name):
def Updatepage(file_name):
print("updating", file_name)
f=open(file_name,"r+")
a=f.readlines()
#print a
for line in a:
if "var LJ = " in line == True:
# python3
IPline = ("var LJ = " in line)
if IPline == True:
p=a.index(line)
#so now we have the position of the line which to be modified
a[p]=" var LJ = 'ws://"+gstt.wwwIP+":9001/'\n"
a[p]=" var LJ = 'ws://"+gstt.wwwIP+":9001/'\n"
#print(p, line, a[p])
f.seek(0)
f.truncate() #ersing all data from the file
f.close()
@ -543,20 +545,16 @@ def Updatewww(file_name):
o.close()
#now the modification is done in the file
# Change
def UpdateAllwww():
print("Updating all www pages...")
Updatewww(gstt.ljpath+"/www/LJ.js")
Updatewww(gstt.ljpath+"/www/trckr/trckrcam1.html")
Updatewww(gstt.ljpath+"/www/simu.html")
Updatewww(gstt.ljpath+"/www/align.html")
Updatewww(gstt.ljpath+"/www/gen0.html")
Updatewww(gstt.ljpath+"/www/aur0.html")
Updatewww(gstt.ljpath+"/www/aur0s.html")
Updatewww(gstt.ljpath+"/www/aur1.html")
Updatewww(gstt.ljpath+"/www/auralls.html")
Updatewww(gstt.ljpath+"/www/index.html")
print("Updating www files to use", gstt.wwwIP)
Updatepage(gstt.ljpath+"/www/LJ.js")
Updatepage(gstt.ljpath+"/www/trckr/trckrcam1.html")
Updatepage(gstt.ljpath+"/www/simu.html")
Updatepage(gstt.ljpath+"/www/align.html")
Updatepage(gstt.ljpath+"/www/auralls.html")
Updatepage(gstt.ljpath+"/www/index.html")
def isOpen(ip):
@ -589,7 +587,7 @@ def isconnected(IP):
return ipup
'''
# autodetect connected DACs. Will change gstt.LaserNumber. One at least
# autodetect DACs in LJ.conf.
def DAChecks():
gstt.dacs = [-1, -1, -1, -1]
@ -605,14 +603,14 @@ def DAChecks():
else:
print("DAC", dac, "at", gstt.lasersIPS[dac], ": DOWN")
'''
# At least one.
if gstt.dacnumber == 0:
gstt.dacs = [0, -1, -1, -1]
gstt.dacnumber = 1
gstt.LaserNumber = gstt.dacnumber
'''
'''

View file

@ -79,4 +79,3 @@ def Read():
config = configparser.ConfigParser()
config.read(gstt.ConfigName)