Add way to ignore images with a clipboard flag, cleanup

This commit is contained in:
AuroraWright
2023-12-16 01:08:21 +01:00
parent a12ddfd222
commit c0826b1837
2 changed files with 72 additions and 69 deletions

View File

@@ -213,7 +213,7 @@ class WinRTOCR:
available = False
def __init__(self, config={}):
if os.name == 'nt':
if sys.platform == "win32":
if int(platform.release()) < 10:
logger.warning('WinRT OCR is not supported on Windows older than 10!')
elif 'winocr' not in sys.modules:
@@ -240,7 +240,7 @@ class WinRTOCR:
else:
raise ValueError(f'img_or_path must be a path or PIL.Image, instead got: {img_or_path}')
if os.name == 'nt':
if sys.platform == "win32":
res = winocr.recognize_pil_sync(img, lang='ja')['text']
else:
params = {'lang': 'ja'}