truncated logs

This commit is contained in:
art 2023-08-14 14:47:43 -07:00
parent ffabe5e3e8
commit 22c2e928d2

View File

@ -23,7 +23,8 @@ import sqlite3
HISTORY = {}
pairs = ["GBP_CAD","NZD_CAD","EUR_CHF","EUR_CAD","NZD_CHF","CHF_JPY","USD_CHF","AUD_JPY","EUR_USD","NZD_USD","USD_JPY","GBP_AUD","EUR_AUD","CAD_JPY","EUR_GBP","AUD_CAD","EUR_JPY","AUD_CHF","CAD_CHF","GBP_JPY","USD_CAD","NZD_JPY","USD_SGD","AUD_USD","GBP_CHF","AUD_NZD","GBP_USD"]
#pairs = ["GBP_CAD","NZD_CAD","EUR_CHF","EUR_CAD","NZD_CHF","CHF_JPY","USD_CHF","AUD_JPY","EUR_USD","NZD_USD","USD_JPY","GBP_AUD","EUR_AUD","CAD_JPY","EUR_GBP","AUD_CAD","EUR_JPY","AUD_CHF","CAD_CHF","GBP_JPY","USD_CAD","NZD_JPY","USD_SGD","AUD_USD","GBP_CHF","AUD_NZD","GBP_USD"]
pairs = ["GBP_JPY"]
curstamp = 0
@ -184,6 +185,7 @@ def log_file(file, verbose, message, message_type="system"):
file.write(f"{message}, \n")
def scrye_log(cur, verbose, message, message_type="system"):
return
#if verbose:
#print(f"{message} {message_type}")
@ -253,7 +255,7 @@ def process_colors(instr, img, CM):
mask = cv2.inRange(img, CM["COLOR"][0], CM["COLOR"][1])
mask = cv2.dilate(mask, kernel, iterations=1)
cv2.imwrite(f"pair_{instr}_{CM['name']}.png", mask)
sendfile(cur, f"oversite", f"pair_{instr}_{CM['name']}.png" , f"/{curstamp}/pair_{instr}_{CM['name']}.png", state.instr)
#sendfile(cur, f"oversite", f"pair_{instr}_{CM['name']}.png" , f"/{curstamp}/pair_{instr}_{CM['name']}.png", state.instr)
return ptlist(mask, CM["name"])
@ -305,7 +307,7 @@ while 1 > 0:
else:
error,diff = mse(imgx, pimg[pair_file])
if error == 0:
print("same same sony guts")
#print("same same sony guts")
continue
fcur = open(f"{instr}.txt", "w")
fcur.write("[")
@ -455,6 +457,7 @@ while 1 > 0:
state.savefile = True
#if state.action and state.shine:
log_file(fcur, True, "{\"msg\":\"everything shiny\"}", state.instr)
print(f"{state}")
if x >= state.maxX and state.shine and state.shineUsed == False:
requests.get(
f"http://oversite.home.neb:3000/order/{state.instr}/{state.qty}"
@ -467,6 +470,11 @@ while 1 > 0:
state.shineUsed = True
log_file(fcur, True, state, state.instr)
log_file(fcur, True, "{\"msg\":\"sending order\"}", state.instr)
try:
cv2.imwrite(f"points_{instr}.png", img4)
sendfile(cur, f"oversite", f"points_{instr}.png", sendf, state.instr)
except:
print("write error")
else:
log_file(fcur, True, state, state.instr)
print(f"{state}")
@ -475,11 +483,6 @@ while 1 > 0:
state.reset_map()
state.flip()
state.send_order = False
try:
cv2.imwrite(f"points_{instr}.png", img4)
sendfile(cur, f"oversite", f"points_{instr}.png", sendf, state.instr)
except:
print("write error")
if state.savefile:
state.savefile = False
#HISTORY[state.instr]['stars'] = state.stars
@ -489,4 +492,4 @@ while 1 > 0:
fcur.write("{}]")
fcur.close()
scrye_log(cur,True, open(f"{state.instr}.txt", "r").read(), state.instr)
time.sleep(2)
time.sleep(2)