GameSentenceMiner 2.8.30__py3-none-any.whl → 2.8.31__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- GameSentenceMiner/ocr/gsm_ocr_config.py +3 -0
- GameSentenceMiner/ocr/owocr_area_selector.py +2 -0
- GameSentenceMiner/ocr/owocr_helper.py +3 -1
- GameSentenceMiner/owocr/owocr/run.py +9 -9
- {gamesentenceminer-2.8.30.dist-info → gamesentenceminer-2.8.31.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.8.30.dist-info → gamesentenceminer-2.8.31.dist-info}/RECORD +10 -10
- {gamesentenceminer-2.8.30.dist-info → gamesentenceminer-2.8.31.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.8.30.dist-info → gamesentenceminer-2.8.31.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.8.30.dist-info → gamesentenceminer-2.8.31.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.8.30.dist-info → gamesentenceminer-2.8.31.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
import ctypes
|
1
2
|
from dataclasses import dataclass
|
2
3
|
from math import floor, ceil
|
3
4
|
|
@@ -49,6 +50,7 @@ class OCRConfig:
|
|
49
50
|
if self.coordinate_system and self.coordinate_system == "percentage" and self.window:
|
50
51
|
import pygetwindow as gw
|
51
52
|
try:
|
53
|
+
ctypes.windll.shcore.SetProcessDpiAwareness(2)
|
52
54
|
window = gw.getWindowsWithTitle(self.window)[0]
|
53
55
|
self.window_geometry = WindowGeometry(
|
54
56
|
left=window.left,
|
@@ -56,6 +58,7 @@ class OCRConfig:
|
|
56
58
|
width=window.width,
|
57
59
|
height=window.height,
|
58
60
|
)
|
61
|
+
print(f"Window '{self.window}' found with geometry: {self.window_geometry}")
|
59
62
|
except IndexError:
|
60
63
|
raise ValueError(f"Window with title '{self.window}' not found.")
|
61
64
|
for rectangle in self.rectangles:
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import ctypes
|
1
2
|
import json
|
2
3
|
import sys
|
3
4
|
from multiprocessing import Process, Manager
|
@@ -856,6 +857,7 @@ def get_screen_selection(window_name):
|
|
856
857
|
if __name__ == "__main__":
|
857
858
|
target_window_title = None # Default to absolute coordinates
|
858
859
|
# Check for command line arguments to specify window title
|
860
|
+
ctypes.windll.shcore.SetProcessDpiAwareness(2)
|
859
861
|
if len(sys.argv) > 1:
|
860
862
|
target_window_title = sys.argv[1]
|
861
863
|
print(f"Attempting to target window title from args: '{target_window_title}'")
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import asyncio
|
2
|
+
import ctypes
|
2
3
|
import json
|
3
4
|
import logging
|
4
5
|
import os
|
@@ -366,6 +367,7 @@ if __name__ == "__main__":
|
|
366
367
|
logger.info(f"Received arguments: ocr1={ocr1}, ocr2={ocr2}, twopassocr={twopassocr}")
|
367
368
|
global ocr_config
|
368
369
|
ocr_config: OCRConfig = get_ocr_config()
|
370
|
+
ctypes.windll.shcore.SetProcessDpiAwareness(2)
|
369
371
|
if ocr_config:
|
370
372
|
if ocr_config.window:
|
371
373
|
start_time = time.time()
|
@@ -377,7 +379,7 @@ if __name__ == "__main__":
|
|
377
379
|
else:
|
378
380
|
logger.error(f"Window '{ocr_config.window}' not found within 30 seconds.")
|
379
381
|
sys.exit(1)
|
380
|
-
logger.info(f"Starting OCR with configuration: Window: {ocr_config.window}, Rectangles: {
|
382
|
+
logger.info(f"Starting OCR with configuration: Window: {ocr_config.window}, Rectangles: {ocr_config.rectangles}, Engine 1: {ocr1}, Engine 2: {ocr2}, Two-pass OCR: {twopassocr}")
|
381
383
|
if ocr_config:
|
382
384
|
rectangles = list(filter(lambda rect: not rect.is_excluded, ocr_config.rectangles))
|
383
385
|
last_ocr1_results = [""] * len(rectangles) if rectangles else [""]
|
@@ -53,8 +53,7 @@ except ImportError:
|
|
53
53
|
pass
|
54
54
|
from .config import Config
|
55
55
|
from .screen_coordinate_picker import get_screen_selection
|
56
|
-
from ...configuration import get_temporary_directory
|
57
|
-
|
56
|
+
from ...configuration import get_temporary_directory, get_app_directory
|
58
57
|
|
59
58
|
config = None
|
60
59
|
|
@@ -513,7 +512,7 @@ class ScreenshotClass:
|
|
513
512
|
if not self.window_handle:
|
514
513
|
raise ValueError(area_invalid_error)
|
515
514
|
|
516
|
-
ctypes.windll.shcore.SetProcessDpiAwareness(
|
515
|
+
ctypes.windll.shcore.SetProcessDpiAwareness(2)
|
517
516
|
|
518
517
|
self.windows_window_tracker_instance = threading.Thread(target=self.windows_window_tracker)
|
519
518
|
self.windows_window_tracker_instance.start()
|
@@ -693,11 +692,11 @@ class ScreenshotClass:
|
|
693
692
|
sct_img = self.sct.grab(self.sct_params)
|
694
693
|
img = Image.frombytes('RGB', sct_img.size, sct_img.bgra, 'raw', 'BGRX')
|
695
694
|
|
696
|
-
|
697
|
-
|
695
|
+
import random # Ensure this is imported at the top of the file if not already
|
696
|
+
rand_int = random.randint(1, 20) # Executes only once out of 10 times
|
698
697
|
|
699
|
-
|
700
|
-
|
698
|
+
if rand_int == 1: # Executes only once out of 10 times
|
699
|
+
img.save(os.path.join(get_temporary_directory(), 'before_crop.png'), 'PNG')
|
701
700
|
|
702
701
|
if self.screen_capture_exclusions:
|
703
702
|
img = img.convert("RGBA")
|
@@ -709,8 +708,9 @@ class ScreenshotClass:
|
|
709
708
|
if self.custom_left:
|
710
709
|
img = img.crop((self.custom_left, self.custom_top, self.custom_left + self.custom_width, self.custom_top + self.custom_height))
|
711
710
|
|
712
|
-
|
713
|
-
|
711
|
+
if rand_int == 1:
|
712
|
+
img.save(os.path.join(get_temporary_directory(), 'after_crop.png'), 'PNG')
|
713
|
+
print(f'OCR images saved to {get_temporary_directory()} if debugging is needed, this is 1/20 chance')
|
714
714
|
|
715
715
|
return img
|
716
716
|
|
@@ -22,16 +22,16 @@ GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
22
22
|
GameSentenceMiner/downloader/download_tools.py,sha256=aRfpCqEmKUFRVsGipwY-7PhY6AeWiFJanW4ZCB9e2iE,8124
|
23
23
|
GameSentenceMiner/downloader/oneocr_dl.py,sha256=o3ANp5IodEQoQ8GPcJdg9Y8JzA_lictwnebFPwwUZVk,10144
|
24
24
|
GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
25
|
-
GameSentenceMiner/ocr/gsm_ocr_config.py,sha256
|
25
|
+
GameSentenceMiner/ocr/gsm_ocr_config.py,sha256=-tw5l2wvv_sqUcGS0Y5X9LlXqmFxcCHcwZ76Q93T3I4,2127
|
26
26
|
GameSentenceMiner/ocr/ocrconfig.py,sha256=_tY8mjnzHMJrLS8E5pHqYXZjMuLoGKYgJwdhYgN-ny4,6466
|
27
|
-
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=
|
28
|
-
GameSentenceMiner/ocr/owocr_helper.py,sha256=
|
27
|
+
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=gHvhsgvYmIMKmkq0cDOLzBTnmBAvVyP9JKNlTZouJk8,47141
|
28
|
+
GameSentenceMiner/ocr/owocr_helper.py,sha256=_mRqQ8928ovdF5o_4qpK2DGWMmu3cGBYsmpgMtc0adU,17418
|
29
29
|
GameSentenceMiner/owocr/owocr/__init__.py,sha256=opjBOyGGyEqZCE6YdZPnyt7nVfiwyELHsXA0jAsjm14,25
|
30
30
|
GameSentenceMiner/owocr/owocr/__main__.py,sha256=XQaqZY99EKoCpU-gWQjNbTs7Kg17HvBVE7JY8LqIE0o,157
|
31
31
|
GameSentenceMiner/owocr/owocr/config.py,sha256=qM7kISHdUhuygGXOxmgU6Ef2nwBShrZtdqu4InDCViE,8103
|
32
32
|
GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
|
33
33
|
GameSentenceMiner/owocr/owocr/ocr.py,sha256=dPnDmtG-I24kcfxC3iudeRIVgGhLmiWMGyRiMANcYsA,41573
|
34
|
-
GameSentenceMiner/owocr/owocr/run.py,sha256=
|
34
|
+
GameSentenceMiner/owocr/owocr/run.py,sha256=ZC0sG-3mCyGgg8FPSto9Hd6-k-N18T1hBe-IgsbSBLM,52345
|
35
35
|
GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
|
36
36
|
GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
GameSentenceMiner/vad/result.py,sha256=C08HsYH4qVjTRh_dvrWrskmXHJ950w0GWxPjGx_BfGY,275
|
@@ -52,9 +52,9 @@ GameSentenceMiner/web/static/web-app-manifest-512x512.png,sha256=wyqgCWCrLEUxSRX
|
|
52
52
|
GameSentenceMiner/web/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
|
54
54
|
GameSentenceMiner/web/templates/utility.html,sha256=NUp4Yjs6_j7YeqsM2rcF0LzwS6nXSBUWJDl-k2E8BbM,16270
|
55
|
-
gamesentenceminer-2.8.
|
56
|
-
gamesentenceminer-2.8.
|
57
|
-
gamesentenceminer-2.8.
|
58
|
-
gamesentenceminer-2.8.
|
59
|
-
gamesentenceminer-2.8.
|
60
|
-
gamesentenceminer-2.8.
|
55
|
+
gamesentenceminer-2.8.31.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
56
|
+
gamesentenceminer-2.8.31.dist-info/METADATA,sha256=ZpeRtR-EmV-DHTvlpaRdAKZWiDeY-axbGuDFIQBmU3k,7165
|
57
|
+
gamesentenceminer-2.8.31.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
58
|
+
gamesentenceminer-2.8.31.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
59
|
+
gamesentenceminer-2.8.31.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
60
|
+
gamesentenceminer-2.8.31.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|