GameSentenceMiner 2.8.29__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.
@@ -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: {len(ocr_config.rectangles)}, Engine 1: {ocr1}, Engine 2: {ocr2}, Two-pass OCR: {twopassocr}")
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 [""]
@@ -29,6 +29,7 @@ import io
29
29
  import re
30
30
  import logging
31
31
  import inspect
32
+ import time
32
33
 
33
34
  import pyperclipfix
34
35
  import mss
@@ -52,8 +53,7 @@ except ImportError:
52
53
  pass
53
54
  from .config import Config
54
55
  from .screen_coordinate_picker import get_screen_selection
55
- from ...configuration import get_temporary_directory
56
-
56
+ from ...configuration import get_temporary_directory, get_app_directory
57
57
 
58
58
  config = None
59
59
 
@@ -512,7 +512,7 @@ class ScreenshotClass:
512
512
  if not self.window_handle:
513
513
  raise ValueError(area_invalid_error)
514
514
 
515
- ctypes.windll.shcore.SetProcessDpiAwareness(1)
515
+ ctypes.windll.shcore.SetProcessDpiAwareness(2)
516
516
 
517
517
  self.windows_window_tracker_instance = threading.Thread(target=self.windows_window_tracker)
518
518
  self.windows_window_tracker_instance.start()
@@ -692,11 +692,11 @@ class ScreenshotClass:
692
692
  sct_img = self.sct.grab(self.sct_params)
693
693
  img = Image.frombytes('RGB', sct_img.size, sct_img.bgra, 'raw', 'BGRX')
694
694
 
695
- # import random # Ensure this is imported at the top of the file if not already
696
- # rand_int = random.randint(1, 10) # Executes only once out of 10 times
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
697
697
 
698
- # if rand_int == 1: # Executes only once out of 10 times
699
- # img.show()
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')
700
700
 
701
701
  if self.screen_capture_exclusions:
702
702
  img = img.convert("RGBA")
@@ -708,8 +708,9 @@ class ScreenshotClass:
708
708
  if self.custom_left:
709
709
  img = img.crop((self.custom_left, self.custom_top, self.custom_left + self.custom_width, self.custom_top + self.custom_height))
710
710
 
711
- # if rand_int == 1:
712
- # img.show()
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')
713
714
 
714
715
  return img
715
716
 
@@ -248,7 +248,6 @@ def clear_history():
248
248
 
249
249
 
250
250
  async def add_event_to_texthooker(line: GameLine):
251
- logger.info("Adding event to web server: %s", line.text)
252
251
  new_event = event_manager.add_gameline(line)
253
252
  await broadcast_message({
254
253
  'event': 'text_received',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.8.29
3
+ Version: 2.8.31
4
4
  Summary: A tool for mining sentences from games. Update: Multi-Line Mining! Fixed!
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -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=rQC6C8PKJXWoAvwCOYa363kodQQBwl1YNeYsD0bBbx4,1957
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=sryQd7D33i7E6c8gO7dnxLWtL6Nghgs7cvppK-xFxiE,47076
28
- GameSentenceMiner/ocr/owocr_helper.py,sha256=motXED_wX_CUljXp0pIaziw2xFBpz6gjokD2icDz02k,17358
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=f59MhlV9JVpzFAq7aW-_0I3FGnzKyw0OLOAggWCiRvY,52083
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
@@ -39,7 +39,7 @@ GameSentenceMiner/vad/silero_trim.py,sha256=L5OYAPi-L4uDn4nVAmTmdyrD_mVbmMbEXgQ7
39
39
  GameSentenceMiner/vad/vosk_helper.py,sha256=0NoqzuMjcl3ueZv_KAcLt92el-38g-aTpl1fLs91PrA,6092
40
40
  GameSentenceMiner/vad/whisper_helper.py,sha256=ulWDJypfBC6nEZyWp5j5nVCNeEukKvMiqWthMvIzvp4,3565
41
41
  GameSentenceMiner/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- GameSentenceMiner/web/texthooking_page.py,sha256=AtVV9RS7HC3XnOq4X0FIMqJrzFoGlfSHFvS_CfhuzuA,13558
42
+ GameSentenceMiner/web/texthooking_page.py,sha256=t58PCfqwnJ197CtIUbGbE_cOyNkR81e4oi84VayTj5g,13497
43
43
  GameSentenceMiner/web/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
44
  GameSentenceMiner/web/static/apple-touch-icon.png,sha256=OcMI8af_68DA_tweOsQ5LytTyMwm7-hPW07IfrOVgEs,46132
45
45
  GameSentenceMiner/web/static/favicon-96x96.png,sha256=lOePzjiKl1JY2J1kT_PMdyEnrlJmi5GWbmXJunM12B4,16502
@@ -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.29.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
56
- gamesentenceminer-2.8.29.dist-info/METADATA,sha256=kaomSNGLEqPQVqAqSrIRv9CvGhU4FOrpZ2gCmdBlwiQ,7165
57
- gamesentenceminer-2.8.29.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
58
- gamesentenceminer-2.8.29.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
59
- gamesentenceminer-2.8.29.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
60
- gamesentenceminer-2.8.29.dist-info/RECORD,,
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,,