GameSentenceMiner 2.7.3__py3-none-any.whl → 2.7.5__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.
@@ -148,15 +148,15 @@ class WebsocketServerThread(threading.Thread):
148
148
  all_cords = None
149
149
  rectangles = None
150
150
 
151
- def text_callback(text, rectangle):
151
+ def text_callback(text, rectangle, time):
152
152
  global twopassocr, ocr2, last_oneocr_results
153
153
  if not text:
154
154
  return
155
155
  if not twopassocr or not ocr2:
156
- websocket_server_thread.send_text(text, datetime.now())
156
+ websocket_server_thread.send_text(text, time if time else datetime.now())
157
157
  return
158
158
  with mss.mss() as sct:
159
- line_time = datetime.now()
159
+ line_time = time if time else datetime.now()
160
160
  logger.info(f"Received message: {text}, ATTEMPTING LENS OCR")
161
161
  if rectangles:
162
162
  cords = rectangles[rectangle]
@@ -1,3 +1,4 @@
1
+ import datetime
1
2
  import sys
2
3
  import signal
3
4
  import time
@@ -538,7 +539,7 @@ def are_images_identical(img1, img2):
538
539
  return (img1.shape == img2.shape) and (img1 == img2).all()
539
540
 
540
541
 
541
- def process_and_write_results(img_or_path, write_to, notifications, last_result, filtering, engine=None, rectangle=None):
542
+ def process_and_write_results(img_or_path, write_to, notifications, last_result, filtering, engine=None, rectangle=None, time=None):
542
543
  global engine_index
543
544
  if auto_pause_handler:
544
545
  auto_pause_handler.stop()
@@ -570,7 +571,7 @@ def process_and_write_results(img_or_path, write_to, notifications, last_result,
570
571
  elif write_to == 'clipboard':
571
572
  pyperclipfix.copy(text)
572
573
  elif write_to == "callback":
573
- txt_callback(text, rectangle)
574
+ txt_callback(text, rectangle, time)
574
575
  elif write_to:
575
576
  with Path(write_to).open('a', encoding='utf-8') as f:
576
577
  f.write(text + '\n')
@@ -906,6 +907,7 @@ def run(read_from=None,
906
907
  logger.opt(ansi=True).info(f"Reading from {read_from_readable}, writing to {write_to_readable} using <{engine_color}>{engine_instances[engine_index].readable_name}</{engine_color}>{' (paused)' if paused else ''}")
907
908
 
908
909
  while not terminated and not stop_running_flag:
910
+ time = datetime.datetime.now()
909
911
  if read_from == 'websocket':
910
912
  while True:
911
913
  try:
@@ -915,7 +917,7 @@ def run(read_from=None,
915
917
  else:
916
918
  if not paused:
917
919
  img = Image.open(io.BytesIO(item))
918
- process_and_write_results(img, write_to, notifications, None, None)
920
+ process_and_write_results(img, write_to, notifications, None, None, time=time)
919
921
  elif read_from == 'unixsocket':
920
922
  while True:
921
923
  try:
@@ -925,7 +927,7 @@ def run(read_from=None,
925
927
  else:
926
928
  if not paused:
927
929
  img = Image.open(io.BytesIO(item))
928
- process_and_write_results(img, write_to, notifications, None, None)
930
+ process_and_write_results(img, write_to, notifications, None, None, time=time)
929
931
  elif read_from == 'clipboard':
930
932
  process_clipboard = False
931
933
  if windows_clipboard_polling:
@@ -973,7 +975,7 @@ def run(read_from=None,
973
975
  process_clipboard = True
974
976
 
975
977
  if process_clipboard:
976
- process_and_write_results(img, write_to, notifications, None, None)
978
+ process_and_write_results(img, write_to, notifications, None, None, time=time)
977
979
 
978
980
  just_unpaused = False
979
981
 
@@ -1052,7 +1054,7 @@ def run(read_from=None,
1052
1054
  draw.rectangle((left, top, right, bottom), fill=(0, 0, 0, 0))
1053
1055
  # draw.rectangle((left, top, right, bottom), fill=(0, 0, 0))
1054
1056
  # img.save(os.path.join(get_temporary_directory(), 'screencapture.png'), 'png')
1055
- res, _ = process_and_write_results(img, write_to, notifications, last_result, filtering, rectangle=rectangle)
1057
+ res, _ = process_and_write_results(img, write_to, notifications, last_result, filtering, rectangle=rectangle, time=time)
1056
1058
  if res:
1057
1059
  last_result = (res, engine_index)
1058
1060
  delay = screen_capture_delay_secs
@@ -1075,7 +1077,7 @@ def run(read_from=None,
1075
1077
  except (UnidentifiedImageError, OSError) as e:
1076
1078
  logger.warning(f'Error while reading file {path}: {e}')
1077
1079
  else:
1078
- process_and_write_results(img, write_to, notifications, None, None)
1080
+ process_and_write_results(img, write_to, notifications, None, None, time=time)
1079
1081
  img.close()
1080
1082
  if delete_images:
1081
1083
  Path.unlink(path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.7.3
3
+ Version: 2.7.5
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
@@ -23,21 +23,21 @@ GameSentenceMiner/downloader/download_tools.py,sha256=mI1u_FGBmBqDIpCH3jOv8DOoZ3
23
23
  GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  GameSentenceMiner/ocr/ocrconfig.py,sha256=hTROOZ3On2HngXKxwQFZvnr5AxlmlMV0mPxv-F3NbMg,6476
25
25
  GameSentenceMiner/ocr/owocr_area_selector.py,sha256=6MQPCSAhuyOSEDEgc-w6jVdsELjxstzI2Zhz0JBkG8g,11703
26
- GameSentenceMiner/ocr/owocr_helper.py,sha256=e4WMFAl_tgE6AxofxghfrvisdZO3HmKa_3z-WmkdYYE,11798
26
+ GameSentenceMiner/ocr/owocr_helper.py,sha256=yR_W_tK6w7c_zDj48d1B6-9f61fBD3PPnt_FSSPleLs,11840
27
27
  GameSentenceMiner/owocr/owocr/__init__.py,sha256=opjBOyGGyEqZCE6YdZPnyt7nVfiwyELHsXA0jAsjm14,25
28
28
  GameSentenceMiner/owocr/owocr/__main__.py,sha256=nkaZGTCZsPDKcej2O0S1SHkyzHJEboTUBc9izyGPvqw,92
29
29
  GameSentenceMiner/owocr/owocr/config.py,sha256=738QCJHEWpFhMh966plOcXYWwcshSiRsxjjIwldeTtI,7461
30
30
  GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
31
31
  GameSentenceMiner/owocr/owocr/ocr.py,sha256=d0uLAQotZ6xhUSWWEXW07c0-EYjeTmumHxIEsT01Iuo,36604
32
- GameSentenceMiner/owocr/owocr/run.py,sha256=S-eb8wFC-LQLiibHVORTyTKTuPaOM2Uj6awoJxGyInQ,46549
32
+ GameSentenceMiner/owocr/owocr/run.py,sha256=dkGNC5DtUN1jmon-m--f_nMJTuXHT6muKgM_7hXEAtA,46678
33
33
  GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=f_YIV4-2OEZ21CAEZ_pbqeTb5D28PS82Tig4ZSnkY4Q,3096
34
34
  GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  GameSentenceMiner/vad/silero_trim.py,sha256=ULf3zwS-JMsY82cKF7gZxREHw8L6lgpWF2U1YqgE9Oc,1681
36
36
  GameSentenceMiner/vad/vosk_helper.py,sha256=125X8C9NxFPlWWpoNsbOnEqKx8RCjXN109zNx_QXhyg,6070
37
37
  GameSentenceMiner/vad/whisper_helper.py,sha256=JJ-iltCh813XdjyEw0Wn5DaErf6PDqfH0Efu1Md8cIY,3543
38
- gamesentenceminer-2.7.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
39
- gamesentenceminer-2.7.3.dist-info/METADATA,sha256=18F6DexdMo-dYWQCtWl_caEy5vo2B7E5Lkfyq4JOdwA,5839
40
- gamesentenceminer-2.7.3.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
41
- gamesentenceminer-2.7.3.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
42
- gamesentenceminer-2.7.3.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
43
- gamesentenceminer-2.7.3.dist-info/RECORD,,
38
+ gamesentenceminer-2.7.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
39
+ gamesentenceminer-2.7.5.dist-info/METADATA,sha256=QiZcuM1aWuz5ZeJBKZtVoxpzFkm8C3aaEEqWy8fztqM,5839
40
+ gamesentenceminer-2.7.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
41
+ gamesentenceminer-2.7.5.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
42
+ gamesentenceminer-2.7.5.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
43
+ gamesentenceminer-2.7.5.dist-info/RECORD,,