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

30
LJ.conf
View File

@ -1,5 +1,5 @@
[General]
lasernumber = 2
lasernumber = 1
debug = 0
ljayserverip = 0.0.0.0
wwwip = 192.168.2.43
@ -11,11 +11,11 @@ autostart = artnet
color = -1
type = DS1000
ip = 192.168.2.4
kpps = 30156
kpps = 25000
centerx = 0
centery = 0
zoomx = 40.0
zoomy = 40.0
zoomx = 45.0
zoomy = 45.0
sizex = 32000
sizey = 32000
finangle = 0.0
@ -31,11 +31,11 @@ warpdest = [[-1500., 1500.],
color = -1
type = LOCAL
ip = 192.168.2.43
kpps = 0
kpps = 25000
centerx = 0
centery = 0
zoomx = 40.0
zoomy = 40.0
zoomx = 45.0
zoomy = 45.0
sizex = 32000
sizey = 32000
finangle = -30.0
@ -43,19 +43,19 @@ swapx = -1
swapy = -1
lsteps = [ (1.0, 2),(0.25, 1), (0.75, 1), (1.0, 5)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],
[ 1500.,-1500.],
[-1500.,-1500.]]
[ 1500., 1500.],
[ 1500.,-1500.],
[-1500.,-1500.]]
[laser2]
color = -1
type = LUKE400
ip = 192.168.2.4
ip = 192.168.2.6
kpps = 25000
centerx = 0
centery = 0
zoomx = 40.0
zoomy = 40.0
zoomx = 45.0
zoomy = 45.0
sizex = 30600
sizey = 32000
finangle = -4.0
@ -74,8 +74,8 @@ ip = 192.168.1.5
kpps = 25000
centerx = 0
centery = 0
zoomx = 40.0
zoomy = 40.0
zoomx = 45.0
zoomy = 45.0
sizex = 32000
sizey = 32000
finangle = 0.0

113
LJ_template..conf Normal file
View File

@ -0,0 +1,113 @@
[General]
lasernumber = 1
debug = 0
ljayserverip = 0.0.0.0
wwwip = 192.168.2.43
nozoscip = 127.0.0.1
bhoroscip = 127.0.0.1
autostart = artnet
[laser0]
color = -1
type = DS1000
ip = 192.168.2.4
kpps = 25000
centerx = 0
centery = 0
zoomx = 45.0
zoomy = 45.0
sizex = 32000
sizey = 32000
finangle = 0.0
swapx = 1
swapy = -1
lsteps = [ (1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],
[ 1500.,-1500.],
[-1500.,-1500.]]
[laser1]
color = -1
type = LOCAL
ip = 192.168.2.43
kpps = 25000
centerx = 0
centery = 0
zoomx = 45.0
zoomy = 45.0
sizex = 32000
sizey = 32000
finangle = -30.0
swapx = -1
swapy = -1
lsteps = [ (1.0, 2),(0.25, 1), (0.75, 1), (1.0, 5)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],
[ 1500.,-1500.],
[-1500.,-1500.]]
[laser2]
color = -1
type = LUKE400
ip = 192.168.2.6
kpps = 25000
centerx = 0
centery = 0
zoomx = 45.0
zoomy = 45.0
sizex = 30600
sizey = 32000
finangle = -4.0
swapx = -1
swapy = -1
lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],
[ 1500.,-1500.],
[-1500.,-1500.]]
[laser3]
color = -1
type = LUKE400
ip = 192.168.1.5
kpps = 25000
centerx = 0
centery = 0
zoomx = 45.0
zoomy = 45.0
sizex = 32000
sizey = 32000
finangle = 0.0
swapx = -1
swapy = -1
lsteps = [(1.0, 8),(0.25, 3), (0.75, 3), (1.0, 10)]
warpdest = [[-1500., 1500.],
[ 1500., 1500.],
[ 1500.,-1500.],
[-1500.,-1500.]]
[plugins]
plugins = {
"trckr": {"OSC": 8017, "command": "python3 plugins/VJing/trckr.py", "display": True},
"aurora": {"OSC": 8090, "command": "python3 plugins/aurora/aurora.py", "display": True},
"maxw": {"OSC": 8012, "command": "python3 plugins/maxwell.py", "display": True},
"square": {"OSC": 8013, "command": "python3 plugins/square.py", "display": True},
"custom1": {"OSC": 8014, "command": "python3 plugins/custom1.py", "display": True},
"mitraille": {"OSC": 8015, "command": "python3 plugins/audio/mitraille.py", "display": True},
"livecode": {"OSC": 8016, "command": "python3 plugins/livecoding.py", "display": True},
"nozoid": {"OSC": 8003, "command": "python3 plugins/audio/nozoids3.py", "display": True},
"glyph": {"OSC": 8004, "command": "python3 plugins/laserglyph.py", "display": True},
"planet": {"OSC": 8005, "command": "python3 plugins/planetarium/main.py", "display": True},
"words": {"OSC": 8006, "command": "python3 plugins/livewords3.py", "display": True},
"cycl": {"OSC": 8007, "command": "python3 plugins/textcycl.py", "display": True},
"simu": {"OSC": 8008, "command": "python plugins/pysimu.py", "display": False},
"artnet": {"OSC": 8009, "command": "python3 libs3/artnet.py", "display": False},
"livecode": {"OSC": 8016, "command": "python3 plugins/livecoding.py", "display": True},
"ljpong": {"OSC": 8020, "command": "python plugins/games/ljpong/main.py", "display": True},
"ljwars": {"OSC": 8021, "command": "python plugins/games/ljsw/main.py", "display": True},
"audiogen": {"OSC": 8030, "command": "python3 plugins/audio/audiogen.py", "display": False},
"midigen": {"OSC": 8031, "command": "python3 plugins/audio/midigen.py", "display": False},
"viewgen": {"OSC": 8032, "command": "python3 plugins/audio/viewgen.py", "display": True}
}

View File

@ -381,7 +381,7 @@ All these commands are available via OSC (port 8002) or websocket (port 9001)
Use the same syntax if you send your pointlist directly in redis : "/pl/0/0" is the key and value is "[(150.0,..."
Every point must be : (x,y,color). Color is the hex color #FFFFFF in decimal.
Every point must be : (x,y,color). Color is the hex color like #FFFFFF in decimal. For new laserist : if point A is green and next point B is red, line AB will be red.
/scale/X/lasernumber value

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)

15
main.py
View File

@ -155,17 +155,6 @@ NozoscPORTout = plugins.Port("nozoid")
planetIPout = nozoscIP
planetPORTout = plugins.Port("planet")
'''
# Bank0 OSC Client : to send OSC message to bank0 inport 8010
bank0IPout = nozoscIP
bank0PORTout = plugins.Port("bank0")
'''
#
# DACs available checks ?
#
import socket
@ -433,7 +422,7 @@ if __name__ == '__main__':
# Bug in 3.8.4 MacOS default multiprocessing start method is spawn. Spawn doesn't work properly
set_start_method('fork')
print("")
print("gstt.LaserNumber", gstt.LaserNumber)
if gstt.LaserNumber == -1:
log.infog("Autodetected DACs mode")
commands.DAChecks()
@ -485,7 +474,6 @@ if __name__ == '__main__':
# Launch OSC thread listening to oscserver
print("Launching OSC server...")
print("at", oscserverIPin, "port",str(oscserverPORTin))
#print("Will update webUI dac status every second")
oscserver.addMsgHandler( "/noteon", commands.NoteOn)
oscserver.addMsgHandler( "/scim", commands.Scim)
oscserver.addMsgHandler( "/line1", commands.Line1)
@ -494,7 +482,6 @@ if __name__ == '__main__':
oscserver.addMsgHandler("default", handler)
_thread.start_new_thread(osc_thread, ())
#print wserver
print("Launching webUI Websocket server...")
print("at", serverIP, "port",wsPORT)
wserver.set_fn_new_client(new_client)

View File

@ -624,7 +624,7 @@
},
onClose: function () {
_WS.showline1('<span style="color: red;">LJ2 DISCONNECTED</span> ');
_WS.showline1('<span style="color: red;">LJ DISCONNECTED</span> ');
document.getElementById("on").value = 0;
document.getElementById("lstt/0").value = 0;
document.getElementById("lstt/1").value = 0;
@ -673,6 +673,15 @@
divtext1.innerHTML='<span style="color: red;">'+ res[1]+" "+res[2]+'</span>';
break;
case "/lack/":
console.log("/lack "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
case "/lstt/":
console.log("/lstt "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
default:
//console.log("test "+res[0].slice(1)+" "+res[1]);

View File

@ -440,7 +440,7 @@
onClose: function () {
_WS.showline1('<span style="color: red;">LJ2 DISCONNECTED</span> ');
_WS.showline1('<span style="color: red;">LJ DISCONNECTED</span> ');
//var divtext1 = document.getElementById('line1');
///divtext1.innerHTML='DISCONNECTED';
document.getElementById("on").value = 0;
@ -497,9 +497,20 @@
//console.log(pl)
pl2 = eval(pl.replace(/[()]/g, ''));
break;
case "/lack/":
console.log("/lack "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
case "/lstt/":
console.log("/lstt "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
default:
//console.log("test "+res[0].slice(1)+" "+res[1]);
//console.log("default "+res[0].slice(1)+" "+res[1]);
//document.getElementById(res[0].slice(1)).value = res[1];
//_WS.showstatus(e.data);
}

View File

@ -300,6 +300,16 @@
console.log("/laser "+res[1])
newlaser(res[1])
break;
case "/lack/":
console.log("/lack "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
case "/lstt/":
console.log("/lstt "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
default:

View File

@ -287,6 +287,17 @@
case "/plpoi":
//console.log("plpoint");
break;
case "/lack/":
console.log("/lack "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
case "/lstt/":
console.log("/lstt "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
default:
//console.log("test "+res[0].slice(1)+" "+res[1]);
document.getElementById(res[0].slice(1)).value = res[1];

View File

@ -378,7 +378,6 @@
<script type="text/javascript">
var LJ = 'ws://192.168.2.43:9001/'
var LJ = 'ws://192.168.2.43:9001/'
var _WS = {
@ -399,7 +398,7 @@
},
onClose: function () {
_WS.showline1('<span style="color: red;">LJ2 DISCONNECTED</span> ');
_WS.showline1('<span style="color: red;">LJ DISCONNECTED</span> ');
},
@ -445,6 +444,16 @@
newlaser(res[1])
break;
case "/lack/":
console.log("/lack "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
case "/lstt/":
console.log("/lstt "+res[1])
document.getElementById(res[0].slice(1)).value = res[1];
break;
default:
//console.log("test "+res[0].slice(1)+" "+res[1]);
document.getElementById(res[0].slice(1)).value = res[1];