This commit is contained in:
AuroraWright
2024-06-25 09:49:28 +02:00
parent d0622f4b83
commit 3bd3cf65bc

View File

@@ -462,7 +462,7 @@ def process_and_write_results(img_or_path, write_to, notifications, last_text, f
res, text = engine_instance(img_or_path) res, text = engine_instance(img_or_path)
t1 = time.time() t1 = time.time()
orig_text = '' orig_text = None
engine_color = config.get_general('engine_color') engine_color = config.get_general('engine_color')
if res: if res:
if filtering: if filtering:
@@ -482,7 +482,7 @@ def process_and_write_results(img_or_path, write_to, notifications, last_text, f
else: else:
logger.opt(ansi=True).info(f'<{engine_color}>{engine_instance.readable_name}</{engine_color}> reported an error after {t1 - t0:0.03f}s: {text}') logger.opt(ansi=True).info(f'<{engine_color}>{engine_instance.readable_name}</{engine_color}> reported an error after {t1 - t0:0.03f}s: {text}')
return (orig_text, engine_index) return orig_text
def get_path_key(path): def get_path_key(path):
@@ -910,8 +910,8 @@ def run(read_from=None,
sct_img = sct.grab(sct_params) sct_img = sct.grab(sct_params)
img = Image.frombytes('RGB', sct_img.size, sct_img.bgra, 'raw', 'BGRX') img = Image.frombytes('RGB', sct_img.size, sct_img.bgra, 'raw', 'BGRX')
res = process_and_write_results(img, write_to, notifications, last_text, filtering) res = process_and_write_results(img, write_to, notifications, last_text, filtering)
if res[0] != '': if res:
last_text = res last_text = (res, engine_index)
delay = screen_capture_delay_secs delay = screen_capture_delay_secs
else: else:
delay = delay_secs delay = delay_secs