|
@@ -367,46 +367,7 @@ try:
|
|
|
except Exception as e:
|
|
|
cprint("Exception IMPORT ERROR",e)
|
|
|
|
|
|
-class MC_FIX():
|
|
|
- def __init__(self,server="127.0.0.1",port=11211):
|
|
|
- cprint("MC.init() ----------" ,server,port,color="red")
|
|
|
- try:
|
|
|
- self.mc = memcache.Client(['{}:{}'.format(server,port)], debug=0)
|
|
|
- except Exception as e:
|
|
|
- cprint("-- Exception",e)
|
|
|
-
|
|
|
- def set(self,index="fix",data=[]):
|
|
|
- index = self.mc.get("index")
|
|
|
- self.mc.set("fix", data)
|
|
|
-
|
|
|
-class MC_PATCH():
|
|
|
- def __init__(self,server="127.0.0.1",port=11211):
|
|
|
- cprint("MC.init() ----------" ,server,port,color="red")
|
|
|
- try:
|
|
|
- self.mc = memcache.Client(['{}:{}'.format(server,port)], debug=0)
|
|
|
- except Exception as e:
|
|
|
- cprint("-- Exception",e)
|
|
|
- def loop(self):
|
|
|
- time.sleep(10)
|
|
|
- print("start loop MC_PATCH ...")
|
|
|
- while 1:
|
|
|
- try:
|
|
|
-
|
|
|
- index_patch = []
|
|
|
- for fix,val in FIXTURES.fixtures.items():
|
|
|
- #print("FIX",fix,val)
|
|
|
- val = json.dumps(val).encode()
|
|
|
- self.mc.set("PATCH-"+str(fix),val)
|
|
|
- index_patch.append(fix)
|
|
|
-
|
|
|
- val = json.dumps(index_patch).encode()
|
|
|
- self.mc.set("PATCH-INDEX",val)
|
|
|
- except Exception as e:
|
|
|
- print(e)
|
|
|
- time.sleep(5)
|
|
|
|
|
|
-mc_patch = MC_PATCH()
|
|
|
-thread.start_new_thread(mc_patch.loop,())
|
|
|
|
|
|
class MC():
|
|
|
def __init__(self,server="127.0.0.1",port=11211):
|
|
@@ -1803,6 +1764,9 @@ thread.start_new_thread(refresh_exec_mc,())
|
|
|
|
|
|
FIXTURES = fixlib.Fixtures()
|
|
|
|
|
|
+from lib import mc_api
|
|
|
+thread.start_new_thread(mc_api.mc_set_patch_loop,(FIXTURES,))
|
|
|
+
|
|
|
def LOAD_SHOW():
|
|
|
EXEC.load_exec()
|
|
|
FIXTURES.load_patch()
|
|
@@ -1871,7 +1835,6 @@ def open_sdl_window():
|
|
|
|
|
|
thread.start_new_thread(open_sdl_window,())
|
|
|
|
|
|
-mc_fix = MC_FIX()
|
|
|
def mc_fix_loop():
|
|
|
global master
|
|
|
time.sleep(5)
|
|
@@ -1888,7 +1851,7 @@ def mc_fix_loop():
|
|
|
c+=1
|
|
|
try:
|
|
|
data = FIXTURES.fixtures
|
|
|
- mc_fix.set(index="fix",data=data)
|
|
|
+ mc_api.mc_set_fix(index="fix",data=data)
|
|
|
except Exception as e:
|
|
|
print("MC_FIX EXCEPTION",e)
|
|
|
time.sleep(1/10)
|