diff --git a/owocr/run.py b/owocr/run.py index dd60dba..07785bd 100644 --- a/owocr/run.py +++ b/owocr/run.py @@ -291,9 +291,9 @@ class RequestHandler(socketserver.BaseRequestHandler): class TextFiltering: - def __init__(self, screen_capture_periodic): + def __init__(self): self.language = config.get_general('language') - self.frame_stabilization = 0 if not screen_capture_periodic else config.get_general('screen_capture_frame_stabilization') + self.frame_stabilization = 0 if config.get_general('screen_capture_delay_secs') == -1 else config.get_general('screen_capture_frame_stabilization') self.line_recovery = config.get_general('screen_capture_line_recovery') self.furigana_filter = config.get_general('screen_capture_furigana_filter') self.recovered_lines_count = 0 @@ -1207,9 +1207,9 @@ class SecondPassThread: class OutputResult: - def __init__(self, screen_capture_periodic): - self.screen_capture_periodic = screen_capture_periodic - self.filtering = TextFiltering(screen_capture_periodic) + def __init__(self): + self.screen_capture_periodic = config.get_general('screen_capture_delay_secs') != -1 + self.filtering = TextFiltering() self.second_pass_thread = SecondPassThread() def _post_process(self, text, strip_spaces): @@ -1599,7 +1599,7 @@ def run(): directory_watcher_thread.start() read_from_readable.append(f'directory {read_from_path}') - output_result = OutputResult(screen_capture_periodic) + output_result = OutputResult() if len(key_combos) > 0: key_combo_listener = keyboard.GlobalHotKeys(key_combos) diff --git a/owocr/screen_coordinate_picker.py b/owocr/screen_coordinate_picker.py index 5641820..138537d 100644 --- a/owocr/screen_coordinate_picker.py +++ b/owocr/screen_coordinate_picker.py @@ -184,7 +184,7 @@ def get_screen_selection(pil_image, permanent_process): result = False while (not result) and selector_process.is_alive(): try: - result = result_queue.get(timeout=0.1) # 60 second timeout + result = result_queue.get(timeout=0.1) except: continue if not permanent_process: