publish eve_orehold_watcher.py
This commit is contained in:
parent
6506fa06e7
commit
19ed799e40
1 changed files with 20 additions and 0 deletions
|
|
@ -624,6 +624,26 @@ def main():
|
|||
notify(cp, "Eve watcher test",
|
||||
"If you got this on phone + toast, delivery works.")
|
||||
return
|
||||
if "--read" in sys.argv: # one-shot: print current hold cur/cap/%
|
||||
import pytesseract
|
||||
tcmd = cp.get("ocr", "tesseract_cmd", fallback="").strip()
|
||||
if tcmd:
|
||||
pytesseract.pytesseract.tesseract_cmd = tcmd
|
||||
rs = cp.get("ocr", "region", fallback="").strip()
|
||||
region = [int(x) for x in rs.split(",")] if rs else auto_region(cp)
|
||||
if not region:
|
||||
print("READ none — Ore Hold readout not visible (open your Ore Hold window)")
|
||||
return
|
||||
img = grab_region(region)
|
||||
img = img.resize((img.width * 2, img.height * 2))
|
||||
text = pytesseract.image_to_string(img, config="--psm 7")
|
||||
parsed = parse_orehold_text(text)
|
||||
if parsed:
|
||||
cur, cap = parsed
|
||||
print(f"READ {cur}/{cap} m3 ({100.0*cur/cap:.1f}%)")
|
||||
else:
|
||||
print(f"READ fail — raw OCR={text!r}")
|
||||
return
|
||||
mode = cp.get("watcher", "mode", fallback="ocr").strip().lower()
|
||||
print(f"=== eve_orehold_watcher starting (mode={mode}) ===")
|
||||
heartbeat(cp, "orehold")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue