GameSentenceMiner 2.12.0.dev3__py3-none-any.whl → 2.12.0.dev5__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.
@@ -33,10 +33,10 @@ TRANSLATION_PROMPT = f"""
33
33
  **Professional Game Localization Task**
34
34
 
35
35
  **Task Directive:**
36
- Translate ONLY the single line of game dialogue specified below into natural-sounding, context-aware English. The translation must preserve the original tone and intent of the character.
36
+ Translate ONLY the single line of game dialogue specified below into natural-sounding, context-aware {get_config().general.get_native_language_name()}. The translation must preserve the original tone and intent of the character.
37
37
 
38
38
  **Output Requirements:**
39
- - Provide only the single, best English translation.
39
+ - Provide only the single, best {get_config().general.get_native_language_name()} translation.
40
40
  - Use expletives if they are natural for the context and enhance the translation's impact, but do not over-exaggerate.
41
41
  - Preserve or add HTML tags (e.g., `<i>`, `<b>`) if appropriate for emphasis.
42
42
  - Do not include notes, alternatives, explanations, or any other surrounding text. Absolutely nothing but the translated line.
@@ -47,7 +47,7 @@ Translate ONLY the single line of game dialogue specified below into natural-sou
47
47
  CONTEXT_PROMPT = textwrap.dedent(f"""
48
48
 
49
49
  **Task Directive:**
50
- Provide a very brief summary of the scene in English based on the provided Japanese dialogue and context. Focus on the characters' actions and the immediate situation being described.
50
+ Provide a very brief summary of the scene in {get_config().general.get_native_language_name()} based on the provided Japanese dialogue and context. Focus on the characters' actions and the immediate situation being described.
51
51
 
52
52
  Current Sentence:
53
53
  """)
@@ -297,6 +297,14 @@ class CommonLanguages(str, Enum):
297
297
  if lang.value == code:
298
298
  return lang
299
299
  raise ValueError(f"Language code '{code}' not found in CommonLanguages")
300
+
301
+ @classmethod
302
+ def name_from_code(cls, code: str) -> str:
303
+ """
304
+ Returns the name of the language given its code (e.g., 'en' -> 'ENGLISH').
305
+ Raises ValueError if not found.
306
+ """
307
+ return cls.from_code(code).name
300
308
 
301
309
  @dataclass_json
302
310
  @dataclass
@@ -311,6 +319,12 @@ class General:
311
319
  texthooker_port: int = 55000
312
320
  native_language: str = CommonLanguages.ENGLISH.value
313
321
 
322
+ def get_native_language_name(self) -> str:
323
+ try:
324
+ return CommonLanguages.name_from_code(self.native_language)
325
+ except ValueError:
326
+ return "Unknown"
327
+
314
328
 
315
329
  @dataclass_json
316
330
  @dataclass
@@ -1,9 +1,11 @@
1
+ import sys
1
2
  import win32gui
2
3
  import win32con
3
4
  import win32api
4
5
  import keyboard
5
6
  import time
6
7
  import threading
8
+ import signal
7
9
 
8
10
  from GameSentenceMiner.util.configuration import logger
9
11
 
@@ -137,6 +139,22 @@ def mouse_monitor_loop():
137
139
  # A small delay to reduce CPU usage
138
140
  time.sleep(0.1)
139
141
 
142
+ class HandleSTDINThread(threading.Thread):
143
+ def run(self):
144
+ while True:
145
+ try:
146
+ line = input()
147
+ if "exit" in line.strip().lower():
148
+ handle_quit()
149
+ break
150
+ except EOFError:
151
+ break
152
+
153
+ def handle_quit():
154
+ if is_toggled and target_hwnd:
155
+ reset_window_state(target_hwnd)
156
+ logger.info("Exiting Window Transparency Tool.")
157
+
140
158
  # --- Main Execution Block ---
141
159
 
142
160
  if __name__ == "__main__":
@@ -155,8 +173,18 @@ if __name__ == "__main__":
155
173
  # Register the global hotkey
156
174
  keyboard.add_hotkey(hotkey, toggle_functionality)
157
175
 
176
+ # Handle SigINT/SigTERM gracefully
177
+ def signal_handler(sig, frame):
178
+ handle_quit()
179
+ sys.exit(0)
180
+
181
+ signal.signal(signal.SIGINT, signal_handler)
182
+ signal.signal(signal.SIGTERM, signal_handler)
183
+
158
184
  logger.info(f"Script running. Press '{hotkey}' on a window to toggle transparency.")
159
185
  logger.info("Press Ctrl+C in this console to exit.")
186
+
187
+ HandleSTDINThread().start()
160
188
 
161
189
  # Keep the script running to listen for the hotkey.
162
190
  # keyboard.wait() is a blocking call that waits indefinitely.
@@ -489,7 +489,7 @@ async def texthooker_page_coro():
489
489
  plaintext_websocket_server_thread = WebsocketServerThread(read=False, ws_port=get_config().advanced.plaintext_websocket_port)
490
490
  plaintext_websocket_server_thread.start()
491
491
 
492
- overlay_server_thread = WebsocketServerThread(read=False, ws_port=49999)
492
+ overlay_server_thread = WebsocketServerThread(read=False, ws_port=get_config().wip.overlay_websocket_port)
493
493
  overlay_server_thread.start()
494
494
 
495
495
  # Keep the main asyncio event loop running (for the WebSocket server)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.12.0.dev3
3
+ Version: 2.12.0.dev5
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -6,7 +6,7 @@ GameSentenceMiner/gsm.py,sha256=qVHxnvly-yJ85v9RAxsGN2MqZxU-C1JA5wSRxVxMPMg,2495
6
6
  GameSentenceMiner/obs.py,sha256=-5j4k1_sYYR1Lnbn9C-_yN9prqgGLICgx5l3uguv4xk,15917
7
7
  GameSentenceMiner/vad.py,sha256=zo9JpuEOCXczPXM-dq8lbr-zM-MPpfJ8aajggR3mKk4,18710
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
- GameSentenceMiner/ai/ai_prompting.py,sha256=ojp7i_xg2YB1zALgFbivwtXPMVkThnSbPoUiAs-nz_g,25892
9
+ GameSentenceMiner/ai/ai_prompting.py,sha256=vRYSmEKD_OB3znEwRy8S1Amw_BTaylYBmVqVK9hxT54,26018
10
10
  GameSentenceMiner/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
11
  GameSentenceMiner/assets/icon.png,sha256=9GRL8uXUAgkUSlvbm9Pv9o2poFVRGdW6s2ub_DeUD9M,937624
12
12
  GameSentenceMiner/assets/icon128.png,sha256=l90j7biwdz5ahwOd5wZ-406ryEV9Pan93dquJQ3e1CI,18395
@@ -30,7 +30,7 @@ GameSentenceMiner/owocr/owocr/run.py,sha256=p7DBHTbhey1DeW1SRqNQ5-y3H4Cq2zoMPCME
30
30
  GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
31
31
  GameSentenceMiner/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  GameSentenceMiner/util/audio_offset_selector.py,sha256=8Stk3BP-XVIuzRv9nl9Eqd2D-1yD3JrgU-CamBywJmY,8542
33
- GameSentenceMiner/util/configuration.py,sha256=r5zWr9dQxzRp2QRZeOdIa7E-21gCzXMCd3fiPpmtrNQ,35045
33
+ GameSentenceMiner/util/configuration.py,sha256=fR0n8bjPN8fP8IEdW-YSvjrGLXSLZ7cf9LgJyGj0PF0,35490
34
34
  GameSentenceMiner/util/electron_config.py,sha256=8LZwl-T_uF5z_ig-IZcm9QI-VKaD7zaHX9u6MaLYuo4,8648
35
35
  GameSentenceMiner/util/ffmpeg.py,sha256=t0tflxq170n8PZKkdw8fTZIUQfXD0p_qARa9JTdhBTc,21530
36
36
  GameSentenceMiner/util/gsm_utils.py,sha256=iRyLVcodMptRhkCzLf3hyqc6_RCktXnwApi6mLju6oQ,11565
@@ -39,7 +39,7 @@ GameSentenceMiner/util/notification.py,sha256=0OnEYjn3DUEZ6c6OtPjdVZe-DG-QSoMAl9
39
39
  GameSentenceMiner/util/package.py,sha256=u1ym5z869lw5EHvIviC9h9uH97bzUXSXXA8KIn8rUvk,1157
40
40
  GameSentenceMiner/util/ss_selector.py,sha256=cbjMxiKOCuOfbRvLR_PCRlykBrGtm1LXd6u5czPqkmc,4793
41
41
  GameSentenceMiner/util/text_log.py,sha256=jhG7ny8-DAilMAAPauN5HLoBNSIJ-cXAm68NLBxGNT8,5997
42
- GameSentenceMiner/util/window_transparency.py,sha256=eQZausQ8A7-2Vd5cbBEJrJMKhaEPkLjJEa16kcnK6Ec,6592
42
+ GameSentenceMiner/util/window_transparency.py,sha256=hmeQYqK3mUEh47hZ8pODldUbxCC5eluMddanXfC_epQ,7325
43
43
  GameSentenceMiner/util/communication/__init__.py,sha256=xh__yn2MhzXi9eLi89PeZWlJPn-cbBSjskhi1BRraXg,643
44
44
  GameSentenceMiner/util/communication/send.py,sha256=Wki9qIY2CgYnuHbmnyKVIYkcKAN_oYS4up93XMikBaI,222
45
45
  GameSentenceMiner/util/communication/websocket.py,sha256=TbphRGmxVrgEupS7tNdifsmQfWDfIp0Hio2cSiUKgsk,3317
@@ -49,7 +49,7 @@ GameSentenceMiner/util/downloader/download_tools.py,sha256=zR-aEHiFVkyo-9oPoSx6n
49
49
  GameSentenceMiner/util/downloader/oneocr_dl.py,sha256=EJbKISaZ9p2x9P4x0rpMM5nAInTTc9b7arraGBcd-SA,10381
50
50
  GameSentenceMiner/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  GameSentenceMiner/web/service.py,sha256=S7bYf2kSk08u-8R9Qpv7piM-pxfFjYZUvU825xupmuI,5279
52
- GameSentenceMiner/web/texthooking_page.py,sha256=uuPxVsyFxGrnNh-aM4VpuYYRTdDqjGfQT-gUD-G5aDM,17185
52
+ GameSentenceMiner/web/texthooking_page.py,sha256=c6wOItEVJDkjJsq6jKemv1mytZh5N6bi2V--3jwH_T0,17219
53
53
  GameSentenceMiner/web/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  GameSentenceMiner/web/static/apple-touch-icon.png,sha256=OcMI8af_68DA_tweOsQ5LytTyMwm7-hPW07IfrOVgEs,46132
55
55
  GameSentenceMiner/web/static/favicon-96x96.png,sha256=lOePzjiKl1JY2J1kT_PMdyEnrlJmi5GWbmXJunM12B4,16502
@@ -64,9 +64,9 @@ GameSentenceMiner/web/templates/index.html,sha256=Gv3CJvNnhAzIVV_QxhNq4OD-pXDt1v
64
64
  GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
65
65
  GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
66
66
  GameSentenceMiner/wip/get_overlay_coords.py,sha256=yE8LzXlR-Sw3rz3N-judgQa5z4egJptfJ97KEvdmEH4,3189
67
- gamesentenceminer-2.12.0.dev3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
68
- gamesentenceminer-2.12.0.dev3.dist-info/METADATA,sha256=RsMrLlOr1lSzBxen38wGLgT4YxnIMel83EE1vJX7t7A,7004
69
- gamesentenceminer-2.12.0.dev3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
- gamesentenceminer-2.12.0.dev3.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
71
- gamesentenceminer-2.12.0.dev3.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
72
- gamesentenceminer-2.12.0.dev3.dist-info/RECORD,,
67
+ gamesentenceminer-2.12.0.dev5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
68
+ gamesentenceminer-2.12.0.dev5.dist-info/METADATA,sha256=OYb2bqQEqbXBg8OaH72DmaCeDuZMWayEFlpMdTa5oZw,7004
69
+ gamesentenceminer-2.12.0.dev5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
70
+ gamesentenceminer-2.12.0.dev5.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
71
+ gamesentenceminer-2.12.0.dev5.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
72
+ gamesentenceminer-2.12.0.dev5.dist-info/RECORD,,