|
@@ -93,7 +93,7 @@ def memcachd_index_clear():
|
|
|
|
|
|
memcachd_index_clear()
|
|
|
|
|
|
-def memcachd_index(key,val=""):
|
|
|
+def update_memcachd_index(key,val="",active=-1):
|
|
|
try:
|
|
|
_index = mc.get("index")
|
|
|
|
|
@@ -101,17 +101,25 @@ def memcachd_index(key,val=""):
|
|
|
_index = {}
|
|
|
|
|
|
|
|
|
- if key in _index:
|
|
|
- _index[key] += 1
|
|
|
- else:
|
|
|
- _index[key] = 1
|
|
|
+ if key not in _index:
|
|
|
+ _index[key] = [0,-33]
|
|
|
+ _index[key][0] += 1
|
|
|
+ _index[key][1] = active
|
|
|
+
|
|
|
+
|
|
|
mc.set("index",_index)
|
|
|
except Exception as e:
|
|
|
print("memcach exception",e)
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+def count_active_dmx_ch(dmx):
|
|
|
+ active = 0
|
|
|
+ for i,v in enumerate(dmx):
|
|
|
+ if type(v) is int and v>=1:
|
|
|
+ if active < 0:
|
|
|
+ active = 0
|
|
|
+ active += 1
|
|
|
+ return active
|
|
|
|
|
|
|
|
|
|
|
@@ -559,7 +567,6 @@ class UniversBuffer():
|
|
|
dmxframe_old = self.__universes_dmx[host]
|
|
|
|
|
|
self._next_frame(host)
|
|
|
-
|
|
|
|
|
|
if cython:
|
|
|
if len(dmxframe) <= 512:
|
|
@@ -592,6 +599,7 @@ class UniversBuffer():
|
|
|
|
|
|
tmp["uni"] = self.__univers_nr
|
|
|
tmp["fps"] = self.__universes_fps[host]
|
|
|
+ tmp["active"] = count_active_dmx_ch(dmxframe)
|
|
|
self.__universes_info[host] = tmp
|
|
|
if update_flag:
|
|
|
|
|
@@ -1055,7 +1063,9 @@ class Main():
|
|
|
try:
|
|
|
k = "{}:{}".format(x["host"],x["univ"])
|
|
|
mc.set(k, x["dmx"])
|
|
|
- memcachd_index(key=k)
|
|
|
+
|
|
|
+ active = count_active_dmx_ch(x["dmx"])
|
|
|
+ update_memcachd_index(key=k,active=active)
|
|
|
except Exception as e:
|
|
|
print("exception:",e)
|
|
|
time.sleep(.1)
|
|
@@ -1074,10 +1084,6 @@ class Main():
|
|
|
screen.sel_univ.data = ohost.univs()
|
|
|
screen.sel_host.data = ohost.hosts()
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if ohost_timer.check():
|
|
|
for i in ohost_buf:
|
|
|
for j in ohost_buf[i]:
|
|
@@ -1090,34 +1096,25 @@ class Main():
|
|
|
|
|
|
|
|
|
info=ohost.info()
|
|
|
-
|
|
|
jinfo = ""
|
|
|
+
|
|
|
for i in info:
|
|
|
univ = i
|
|
|
-
|
|
|
if str(univ) == "54":
|
|
|
break
|
|
|
xl = json.dumps(univ) + "======= "
|
|
|
ltp=ohost.get(univ=i)
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
try:
|
|
|
k="ltp-out:{}".format(univ)
|
|
|
mc.set(k,ltp)
|
|
|
- memcachd_index(key=k)
|
|
|
+ active = count_active_dmx_ch(ltp)
|
|
|
+ update_memcachd_index(key=k,active=active)
|
|
|
except Exception as e:
|
|
|
- pass
|
|
|
-
|
|
|
+ print("Exc memcachd_index1 ",e)
|
|
|
|
|
|
-
|
|
|
artnet_out.univ=int(univ)
|
|
|
artnet_out.send(ltp)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
if not poll_flag:
|
|
|
time.sleep(.001)
|