|
@@ -1014,182 +1014,182 @@ def set_dmx_fine_ch(Admx,dmx_fine_nr):
|
|
|
cprint(x,color="red")
|
|
|
cprint("except 3455",e,color="red")
|
|
|
|
|
|
-def parse_cmds(cmds,clock=0,master_fx=None):
|
|
|
- c=clock
|
|
|
- out = {}
|
|
|
- for x in cmds:
|
|
|
- Admx = DMXCH()
|
|
|
-
|
|
|
- _fix_id=0
|
|
|
- _attr = ""
|
|
|
- if "CMD" in x:
|
|
|
- print("CMD:",x)
|
|
|
-
|
|
|
- if "EXEC-SPEED-MASTER" == x["CMD"]:
|
|
|
- exec_speed_master.val(x["NR"],x["VALUE"])
|
|
|
- if "EXEC-SIZE-MASTER" == x["CMD"]:
|
|
|
- exec_size_master.val(x["NR"],x["VALUE"])
|
|
|
- if "EXEC-OFFSET-MASTER" == x["CMD"]:
|
|
|
- exec_offset_master.val(x["NR"],x["VALUE"])
|
|
|
-
|
|
|
- if "SPEED-MASTER" == x["CMD"]:
|
|
|
- speed_master.val(x["NR"],x["VALUE"])
|
|
|
- if "SIZE-MASTER" == x["CMD"]:
|
|
|
- size_master.val(x["NR"],x["VALUE"])
|
|
|
+def _parse_cmds(cmds,clock=0,master_fx=None):
|
|
|
+ c=clock
|
|
|
+ out = {}
|
|
|
+ for x in cmds:
|
|
|
+ Admx = DMXCH()
|
|
|
+
|
|
|
+ _fix_id=0
|
|
|
+ _attr = ""
|
|
|
+ if "CMD" in x:
|
|
|
+ print("CMD:",x)
|
|
|
+
|
|
|
+ if "EXEC-SPEED-MASTER" == x["CMD"]:
|
|
|
+ exec_speed_master.val(x["NR"],x["VALUE"])
|
|
|
+ if "EXEC-SIZE-MASTER" == x["CMD"]:
|
|
|
+ exec_size_master.val(x["NR"],x["VALUE"])
|
|
|
+ if "EXEC-OFFSET-MASTER" == x["CMD"]:
|
|
|
+ exec_offset_master.val(x["NR"],x["VALUE"])
|
|
|
+
|
|
|
+ if "SPEED-MASTER" == x["CMD"]:
|
|
|
+ speed_master.val(x["NR"],x["VALUE"])
|
|
|
+ if "SIZE-MASTER" == x["CMD"]:
|
|
|
+ size_master.val(x["NR"],x["VALUE"])
|
|
|
|
|
|
+ else:
|
|
|
+
|
|
|
+
|
|
|
+ if "DMX" in x:
|
|
|
+ DMX = int(x["DMX"])
|
|
|
+ else:
|
|
|
+ continue
|
|
|
+
|
|
|
+ if "VALUE" in x:
|
|
|
+ v = x["VALUE"]
|
|
|
+ else:
|
|
|
+ continue
|
|
|
+
|
|
|
+ _inc = 0
|
|
|
+ _fix_id = 0
|
|
|
+ _val = 0
|
|
|
+ _clock = 0
|
|
|
+ exec_id = None
|
|
|
+
|
|
|
+ if "VALUE" in x:
|
|
|
+ _val = x["VALUE"]
|
|
|
+ if "INC" in x:
|
|
|
+ _inc = x["INC"]
|
|
|
+ if "FIX" in x:
|
|
|
+ _fix_id = x["FIX"]
|
|
|
+ if "clock" in x:
|
|
|
+ _clock=x["clock"]
|
|
|
+ if "ATTR" in x:
|
|
|
+ _attr = x["ATTR"]
|
|
|
+
|
|
|
+ if DMX <= 0:
|
|
|
+ DMX = "FIX"+str(_fix_id)
|
|
|
+ ok = 0
|
|
|
+ if "ATTR" in x:
|
|
|
+ _attr = x["ATTR"]
|
|
|
+ if "DIM" == x["ATTR"]:
|
|
|
+ if _fix_id not in V_MASTER:
|
|
|
+ V_MASTER[_fix_id] = DMXCH()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ok = 1
|
|
|
+
|
|
|
+
|
|
|
+ if _fix_id in V_MASTER:
|
|
|
+ Admx = V_MASTER[_fix_id]
|
|
|
+
|
|
|
+ if not ok:
|
|
|
+ continue
|
|
|
+ else:
|
|
|
+ if DMX < len(Bdmx):
|
|
|
+ Admx = Bdmx[DMX-1]
|
|
|
else:
|
|
|
-
|
|
|
-
|
|
|
- if "DMX" in x:
|
|
|
- DMX = int(x["DMX"])
|
|
|
- else:
|
|
|
- continue
|
|
|
-
|
|
|
- if "VALUE" in x:
|
|
|
- v = x["VALUE"]
|
|
|
- else:
|
|
|
- continue
|
|
|
-
|
|
|
- _inc = 0
|
|
|
- _fix_id = 0
|
|
|
- _val = 0
|
|
|
- _clock = 0
|
|
|
- exec_id = None
|
|
|
-
|
|
|
- if "VALUE" in x:
|
|
|
- _val = x["VALUE"]
|
|
|
- if "INC" in x:
|
|
|
- _inc = x["INC"]
|
|
|
- if "FIX" in x:
|
|
|
- _fix_id = x["FIX"]
|
|
|
- if "clock" in x:
|
|
|
- _clock=x["clock"]
|
|
|
- if "ATTR" in x:
|
|
|
- _attr = x["ATTR"]
|
|
|
-
|
|
|
- if DMX <= 0:
|
|
|
- DMX = "FIX"+str(_fix_id)
|
|
|
- ok = 0
|
|
|
- if "ATTR" in x:
|
|
|
- _attr = x["ATTR"]
|
|
|
- if "DIM" == x["ATTR"]:
|
|
|
- if _fix_id not in V_MASTER:
|
|
|
- V_MASTER[_fix_id] = DMXCH()
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ok = 1
|
|
|
-
|
|
|
-
|
|
|
- if _fix_id in V_MASTER:
|
|
|
- Admx = V_MASTER[_fix_id]
|
|
|
-
|
|
|
- if not ok:
|
|
|
- continue
|
|
|
- else:
|
|
|
- if DMX < len(Bdmx):
|
|
|
- Admx = Bdmx[DMX-1]
|
|
|
- else:
|
|
|
- print("DMX ADDRESS too BIG",DMX)
|
|
|
- continue
|
|
|
-
|
|
|
-
|
|
|
- if "DMX-FINE" in x and DMX > 0:
|
|
|
- set_dmx_fine_ch(Admx, x["DMX-FINE"])
|
|
|
-
|
|
|
-
|
|
|
- if "EXEC" in x:
|
|
|
- exec_id = x["EXEC"]
|
|
|
-
|
|
|
- if "ATTR" in x:
|
|
|
- _attr = x["ATTR"]
|
|
|
- if "FIX" in x:
|
|
|
- _fix_id = x["FIX"]
|
|
|
-
|
|
|
-
|
|
|
- fx=""
|
|
|
- fx2={}
|
|
|
- ftime=0
|
|
|
- delay=0
|
|
|
- if "FX" in x:
|
|
|
- fx = x["FX"]
|
|
|
- if "FX2" in x:
|
|
|
- fx2 = x["FX2"]
|
|
|
- if "FADE" in x:
|
|
|
- ftime = x["FADE"]
|
|
|
- if "DELAY" in x:
|
|
|
- delay = x["DELAY"]
|
|
|
-
|
|
|
-
|
|
|
- if "FLASH" in x:
|
|
|
- if v == "off" and Admx.exec_id() != exec_id:
|
|
|
- continue
|
|
|
-
|
|
|
-
|
|
|
- Admx.exec_id(exec_id)
|
|
|
- out[DMX] = {"flash":{},"fade":{},"fx":{},"flash_fx":{},"fix_id":_fix_id,"attr":_attr,"DMXCH":Admx}
|
|
|
- if v is not None:
|
|
|
- if "FLASH" in x:
|
|
|
- out[DMX]["flash"] = {"target":v,"ftime":ftime, "clock":c,"delay":delay,"DMXCH":Admx}
|
|
|
- else:
|
|
|
- out[DMX]["fade"] = {"target":v,"ftime":ftime, "clock":c,"delay":delay,"DMXCH":Admx}
|
|
|
-
|
|
|
- if type(fx2) is dict and fx2:
|
|
|
- xtype="fade"
|
|
|
- size = 10
|
|
|
- speed = 10
|
|
|
- start = 0
|
|
|
- offset= 0
|
|
|
- width=100
|
|
|
- invert=0
|
|
|
- base = "-"
|
|
|
- if "TYPE" in fx2:
|
|
|
- xtype = fx2["TYPE"]
|
|
|
- if "SIZE" in fx2:
|
|
|
- size = fx2["SIZE"]
|
|
|
- if "SPEED" in fx2:
|
|
|
- speed = fx2["SPEED"]
|
|
|
- if "OFFSET" in fx2:
|
|
|
- offset = fx2["OFFSET"]
|
|
|
- if "BASE" in fx2:
|
|
|
- base = fx2["BASE"]
|
|
|
- if "INVERT" in fx2:
|
|
|
- invert = fx2["INVERT"]
|
|
|
- if "WIDTH" in fx2:
|
|
|
- width = fx2["WIDTH"]
|
|
|
-
|
|
|
- if "off" == x["VALUE"]:
|
|
|
- xtype= "off"
|
|
|
-
|
|
|
- if "alloff" == xtype.lower():
|
|
|
- for dmxch in Bdmx:
|
|
|
- if dmxch is not None:
|
|
|
- dmxch.flash_fx(xtype="off",clock=c)
|
|
|
- dmxch.fx(xtype="off",clock=c)
|
|
|
- for j in V_MASTER:
|
|
|
- dmxch = V_MASTER[j]
|
|
|
- if j is not None:
|
|
|
- dmxch.flash_fx(xtype="off",clock=c)
|
|
|
- dmxch.fx(xtype="off",clock=c)
|
|
|
-
|
|
|
- if "FLASH" in x:
|
|
|
- out[DMX]["flash_fx"] = {"xtype":xtype,"size":size,"speed":speed,
|
|
|
- "invert":invert,"width":width,"start":start
|
|
|
- ,"offset":offset,"base":base,"clock":c,"master":master_fx}
|
|
|
- else:
|
|
|
- out[DMX]["fx"] = {"xtype":xtype,"size":size,"speed":speed
|
|
|
- ,"invert":invert,"width":width,"start":start
|
|
|
- ,"offset":offset,"base":base,"clock":c,"master":master_fx}
|
|
|
-
|
|
|
- elif type(fx) is str and fx:
|
|
|
-
|
|
|
- ccm = str(DMX+1)+":"+fx
|
|
|
- print("fx",ccm)
|
|
|
- if "FLASH" in x:
|
|
|
- CB({"cmd":"fxf"+ccm})
|
|
|
- else:
|
|
|
- CB({"cmd":"fx"+ccm})
|
|
|
- return out
|
|
|
+ print("DMX ADDRESS too BIG",DMX)
|
|
|
+ continue
|
|
|
+
|
|
|
+
|
|
|
+ if "DMX-FINE" in x and DMX > 0:
|
|
|
+ set_dmx_fine_ch(Admx, x["DMX-FINE"])
|
|
|
+
|
|
|
+
|
|
|
+ if "EXEC" in x:
|
|
|
+ exec_id = x["EXEC"]
|
|
|
+
|
|
|
+ if "ATTR" in x:
|
|
|
+ _attr = x["ATTR"]
|
|
|
+ if "FIX" in x:
|
|
|
+ _fix_id = x["FIX"]
|
|
|
+
|
|
|
+
|
|
|
+ fx=""
|
|
|
+ fx2={}
|
|
|
+ ftime=0
|
|
|
+ delay=0
|
|
|
+ if "FX" in x:
|
|
|
+ fx = x["FX"]
|
|
|
+ if "FX2" in x:
|
|
|
+ fx2 = x["FX2"]
|
|
|
+ if "FADE" in x:
|
|
|
+ ftime = x["FADE"]
|
|
|
+ if "DELAY" in x:
|
|
|
+ delay = x["DELAY"]
|
|
|
+
|
|
|
+
|
|
|
+ if "FLASH" in x:
|
|
|
+ if v == "off" and Admx.exec_id() != exec_id:
|
|
|
+ continue
|
|
|
+
|
|
|
+
|
|
|
+ Admx.exec_id(exec_id)
|
|
|
+ out[DMX] = {"flash":{},"fade":{},"fx":{},"flash_fx":{},"fix_id":_fix_id,"attr":_attr,"DMXCH":Admx}
|
|
|
+ if v is not None:
|
|
|
+ if "FLASH" in x:
|
|
|
+ out[DMX]["flash"] = {"target":v,"ftime":ftime, "clock":c,"delay":delay,"DMXCH":Admx}
|
|
|
+ else:
|
|
|
+ out[DMX]["fade"] = {"target":v,"ftime":ftime, "clock":c,"delay":delay,"DMXCH":Admx}
|
|
|
+
|
|
|
+ if type(fx2) is dict and fx2:
|
|
|
+ xtype="fade"
|
|
|
+ size = 10
|
|
|
+ speed = 10
|
|
|
+ start = 0
|
|
|
+ offset= 0
|
|
|
+ width=100
|
|
|
+ invert=0
|
|
|
+ base = "-"
|
|
|
+ if "TYPE" in fx2:
|
|
|
+ xtype = fx2["TYPE"]
|
|
|
+ if "SIZE" in fx2:
|
|
|
+ size = fx2["SIZE"]
|
|
|
+ if "SPEED" in fx2:
|
|
|
+ speed = fx2["SPEED"]
|
|
|
+ if "OFFSET" in fx2:
|
|
|
+ offset = fx2["OFFSET"]
|
|
|
+ if "BASE" in fx2:
|
|
|
+ base = fx2["BASE"]
|
|
|
+ if "INVERT" in fx2:
|
|
|
+ invert = fx2["INVERT"]
|
|
|
+ if "WIDTH" in fx2:
|
|
|
+ width = fx2["WIDTH"]
|
|
|
+
|
|
|
+ if "off" == x["VALUE"]:
|
|
|
+ xtype= "off"
|
|
|
+
|
|
|
+ if "alloff" == xtype.lower():
|
|
|
+ for dmxch in Bdmx:
|
|
|
+ if dmxch is not None:
|
|
|
+ dmxch.flash_fx(xtype="off",clock=c)
|
|
|
+ dmxch.fx(xtype="off",clock=c)
|
|
|
+ for j in V_MASTER:
|
|
|
+ dmxch = V_MASTER[j]
|
|
|
+ if j is not None:
|
|
|
+ dmxch.flash_fx(xtype="off",clock=c)
|
|
|
+ dmxch.fx(xtype="off",clock=c)
|
|
|
+
|
|
|
+ if "FLASH" in x:
|
|
|
+ out[DMX]["flash_fx"] = {"xtype":xtype,"size":size,"speed":speed,
|
|
|
+ "invert":invert,"width":width,"start":start
|
|
|
+ ,"offset":offset,"base":base,"clock":c,"master":master_fx}
|
|
|
+ else:
|
|
|
+ out[DMX]["fx"] = {"xtype":xtype,"size":size,"speed":speed
|
|
|
+ ,"invert":invert,"width":width,"start":start
|
|
|
+ ,"offset":offset,"base":base,"clock":c,"master":master_fx}
|
|
|
+
|
|
|
+ elif type(fx) is str and fx:
|
|
|
+
|
|
|
+ ccm = str(DMX+1)+":"+fx
|
|
|
+ print("fx",ccm)
|
|
|
+ if "FLASH" in x:
|
|
|
+ CB({"cmd":"fxf"+ccm})
|
|
|
+ else:
|
|
|
+ CB({"cmd":"fx"+ccm})
|
|
|
+ return out
|
|
|
import hashlib
|
|
|
JCB_GLOB_BUF = {}
|
|
|
def JCB(data,sock=None):
|
|
@@ -1222,7 +1222,7 @@ def JCB(data,sock=None): #json client input
|
|
|
continue
|
|
|
|
|
|
try:
|
|
|
- out = parse_cmds(cmds,clock=c,master_fx=master_fx)
|
|
|
+ out = _parse_cmds(cmds,clock=c,master_fx=master_fx)
|
|
|
|
|
|
|
|
|
|