GameSentenceMiner 2.9.4__py3-none-any.whl → 2.9.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.
Files changed (42) hide show
  1. GameSentenceMiner/ai/ai_prompting.py +3 -3
  2. GameSentenceMiner/anki.py +16 -14
  3. GameSentenceMiner/config_gui.py +22 -7
  4. GameSentenceMiner/gametext.py +5 -5
  5. GameSentenceMiner/gsm.py +26 -67
  6. GameSentenceMiner/obs.py +7 -8
  7. GameSentenceMiner/ocr/owocr_area_selector.py +1 -1
  8. GameSentenceMiner/ocr/owocr_helper.py +30 -13
  9. GameSentenceMiner/owocr/owocr/ocr.py +0 -2
  10. GameSentenceMiner/owocr/owocr/run.py +1 -1
  11. GameSentenceMiner/{communication → util/communication}/__init__.py +1 -1
  12. GameSentenceMiner/{communication → util/communication}/send.py +1 -1
  13. GameSentenceMiner/{communication → util/communication}/websocket.py +2 -2
  14. GameSentenceMiner/{downloader → util/downloader}/download_tools.py +3 -3
  15. GameSentenceMiner/vad.py +344 -0
  16. GameSentenceMiner/web/texthooking_page.py +15 -10
  17. {gamesentenceminer-2.9.4.dist-info → gamesentenceminer-2.9.5.dist-info}/METADATA +2 -3
  18. gamesentenceminer-2.9.5.dist-info/RECORD +57 -0
  19. GameSentenceMiner/configuration.py +0 -647
  20. GameSentenceMiner/electron_config.py +0 -315
  21. GameSentenceMiner/ffmpeg.py +0 -441
  22. GameSentenceMiner/model.py +0 -177
  23. GameSentenceMiner/notification.py +0 -126
  24. GameSentenceMiner/package.py +0 -38
  25. GameSentenceMiner/ss_selector.py +0 -121
  26. GameSentenceMiner/text_log.py +0 -186
  27. GameSentenceMiner/util.py +0 -262
  28. GameSentenceMiner/vad/__init__.py +0 -0
  29. GameSentenceMiner/vad/groq_trim.py +0 -82
  30. GameSentenceMiner/vad/result.py +0 -21
  31. GameSentenceMiner/vad/silero_trim.py +0 -52
  32. GameSentenceMiner/vad/vad_utils.py +0 -13
  33. GameSentenceMiner/vad/vosk_helper.py +0 -158
  34. GameSentenceMiner/vad/whisper_helper.py +0 -105
  35. gamesentenceminer-2.9.4.dist-info/RECORD +0 -72
  36. /GameSentenceMiner/{downloader → util/downloader}/Untitled_json.py +0 -0
  37. /GameSentenceMiner/{downloader → util/downloader}/__init__.py +0 -0
  38. /GameSentenceMiner/{downloader → util/downloader}/oneocr_dl.py +0 -0
  39. {gamesentenceminer-2.9.4.dist-info → gamesentenceminer-2.9.5.dist-info}/WHEEL +0 -0
  40. {gamesentenceminer-2.9.4.dist-info → gamesentenceminer-2.9.5.dist-info}/entry_points.txt +0 -0
  41. {gamesentenceminer-2.9.4.dist-info → gamesentenceminer-2.9.5.dist-info}/licenses/LICENSE +0 -0
  42. {gamesentenceminer-2.9.4.dist-info → gamesentenceminer-2.9.5.dist-info}/top_level.txt +0 -0
@@ -1,315 +0,0 @@
1
- import json
2
- import os
3
- from dataclasses import dataclass, field
4
- from typing import List, Optional
5
- from dataclasses_json import dataclass_json
6
-
7
- from GameSentenceMiner.configuration import get_app_directory
8
-
9
-
10
- @dataclass_json
11
- @dataclass
12
- class SteamGame:
13
- id: int
14
- name: str
15
- processName: str
16
- script: str
17
-
18
- @dataclass_json
19
- @dataclass
20
- class YuzuConfig:
21
- emuPath: str = "C:\\Emulation\\Emulators\\yuzu-windows-msvc\\yuzu.exe"
22
- romsPath: str = "C:\\Emulation\\Yuzu\\Games"
23
- launchGameOnStart: str = ""
24
- lastGameLaunched: str = ""
25
-
26
- @dataclass_json
27
- @dataclass
28
- class VNConfig:
29
- vns: List[str] = field(default_factory=list)
30
- textractorPath: str = ""
31
- launchVNOnStart: str = ""
32
- lastVNLaunched: str = ""
33
-
34
- @dataclass_json
35
- @dataclass
36
- class SteamConfig:
37
- steamPath: str = ""
38
- steamGames: List[SteamGame] = field(default_factory=list)
39
- launchSteamOnStart: int = 0
40
- lastGameLaunched: int = 0
41
-
42
- @dataclass_json
43
- @dataclass
44
- class OCRConfig:
45
- twoPassOCR: bool = False
46
- ocr1: str = "oneOCR"
47
- ocr2: str = "glens"
48
- window_name: str = ""
49
- requiresOpenWindow: Optional[bool] = None
50
- scanRate: Optional[float] = None
51
-
52
- @dataclass_json
53
- @dataclass
54
- class StoreConfig:
55
- yuzu: YuzuConfig = field(default_factory=YuzuConfig)
56
- agentScriptsPath: str = "E:\\Japanese Stuff\\agent-v0.1.4-win32-x64\\data\\scripts"
57
- textractorPath: str = "E:\\Japanese Stuff\\Textractor\\Textractor.exe"
58
- startConsoleMinimized: bool = False
59
- autoUpdateElectron: bool = True
60
- autoUpdateGSMApp: bool = False
61
- pythonPath: str = ""
62
- VN: VNConfig = field(default_factory=VNConfig)
63
- steam: SteamConfig = field(default_factory=SteamConfig)
64
- agentPath: str = ""
65
- OCR: OCRConfig = field(default_factory=OCRConfig)
66
-
67
- class Store:
68
- def __init__(self, config_path=os.path.join(get_app_directory(), "electron", "config.json"), defaults: Optional[StoreConfig] = None):
69
- self.config_path = config_path
70
- self.defaults = defaults if defaults is not None else StoreConfig()
71
- self._load_config()
72
-
73
- def _load_config(self):
74
- if os.path.exists(self.config_path):
75
- with open(self.config_path, 'r', encoding='utf-8') as f:
76
- data = json.load(f)
77
- self.data = StoreConfig.from_dict(data)
78
- else:
79
- self.data = self.defaults
80
- self._save_config()
81
-
82
- def _save_config(self):
83
- with open(self.config_path, 'w', encoding='utf-8') as f:
84
- json.dump(self.data.to_dict(), f, indent=4)
85
-
86
- def get(self, key, default=None):
87
- keys = key.split('.')
88
- value = self.data
89
- for k in keys:
90
- if hasattr(value, '__dataclass_fields__') and k in value.__dataclass_fields__:
91
- value = getattr(value, k)
92
- else:
93
- return default
94
- return value
95
-
96
- def set(self, key, value):
97
- keys = key.split('.')
98
- current = self.data
99
- for i, k in enumerate(keys):
100
- if i == len(keys) - 1:
101
- setattr(current, k, value)
102
- else:
103
- if not hasattr(current, '__dataclass_fields__') or k not in current.__dataclass_fields__:
104
- return # Key doesn't exist in the dataclass structure
105
- if not hasattr(getattr(current, k), '__dataclass_fields__'):
106
- setattr(current, k, object()) # Create a new object if it's not a dataclass instance yet
107
- current = getattr(current, k)
108
- self._save_config()
109
-
110
- def delete(self, key):
111
- keys = key.split('.')
112
- if not keys:
113
- return False
114
- current = self.data
115
- for i, k in enumerate(keys[:-1]):
116
- if not hasattr(current, '__dataclass_fields__') or k not in current.__dataclass_fields__:
117
- return False
118
- current = getattr(current, k)
119
- if hasattr(current, keys[-1]):
120
- delattr(current, keys[-1])
121
- self._save_config()
122
- return True
123
- return False
124
-
125
- def print_store(self):
126
- """Prints the entire contents of the store in a readable JSON format."""
127
- print(json.dumps(self.data.to_dict(), indent=4))
128
-
129
- # Initialize the store
130
- store = Store(config_path=os.path.join(get_app_directory(), "electron", "config.json"), defaults=StoreConfig())
131
-
132
- # --- Convenience functions ---
133
-
134
- def get_auto_update_gsm_app() -> bool:
135
- return store.get("autoUpdateGSMApp")
136
-
137
- def set_auto_update_gsm_app(auto_update: bool):
138
- store.set("autoUpdateGSMApp", auto_update)
139
-
140
- def get_auto_update_electron() -> bool:
141
- return store.get("autoUpdateElectron")
142
-
143
- def set_auto_update_electron(auto_update: bool):
144
- store.set("autoUpdateElectron", auto_update)
145
-
146
- def get_python_path() -> str:
147
- return store.get("pythonPath")
148
-
149
- def set_python_path(path: str):
150
- store.set("pythonPath", path)
151
-
152
- # OCR
153
-
154
- def get_ocr_config() -> OCRConfig:
155
- ocr_data = store.get("OCR")
156
- return ocr_data if isinstance(ocr_data, OCRConfig) else OCRConfig.from_dict(ocr_data) if isinstance(ocr_data, dict) else OCRConfig()
157
-
158
- def set_ocr_config(config: OCRConfig):
159
- store.set("OCR", config)
160
-
161
- def get_two_pass_ocr() -> bool:
162
- return store.get("OCR.twoPassOCR")
163
-
164
- def set_two_pass_ocr(two_pass: bool):
165
- store.set("OCR.twoPassOCR", two_pass)
166
-
167
- def get_ocr1() -> str:
168
- return store.get("OCR.ocr1")
169
-
170
- def set_ocr1(ocr: str):
171
- store.set("OCR.ocr1", ocr)
172
-
173
- def get_ocr2() -> str:
174
- return store.get("OCR.ocr2")
175
-
176
- def set_ocr2(ocr: str):
177
- store.set("OCR.ocr2", ocr)
178
-
179
- def get_window_name() -> str:
180
- return store.get("OCR.window_name")
181
-
182
- def set_window_name(name: str):
183
- store.set("OCR.window_name", name)
184
-
185
- def get_requires_open_window() -> Optional[bool]:
186
- return store.get("OCR.requiresOpenWindow")
187
-
188
- def set_requires_open_window(requires_open_window: Optional[bool]):
189
- store.set("OCR.requiresOpenWindow", requires_open_window)
190
-
191
- def get_ocr_scan_rate() -> Optional[int]:
192
- return store.get("OCR.scanRate")
193
-
194
- def set_ocr_scan_rate(scan_rate: Optional[int]):
195
- store.set("OCR.scanRate", scan_rate)
196
-
197
- # Yuzu config getters and setters
198
- def get_yuzu_config() -> YuzuConfig:
199
- yuzu_data = store.get('yuzu')
200
- return yuzu_data if isinstance(yuzu_data, YuzuConfig) else YuzuConfig.from_dict(yuzu_data) if isinstance(yuzu_data, dict) else YuzuConfig()
201
-
202
- def set_yuzu_config(config: YuzuConfig):
203
- store.set('yuzu', config)
204
-
205
-
206
- # Yuzu emulator path getters and setters
207
- def get_yuzu_emu_path() -> str:
208
- return store.get('yuzu.emuPath')
209
-
210
- def set_yuzu_emu_path(path: str):
211
- store.set('yuzu.emuPath', path)
212
-
213
- # Yuzu ROMs path getters and setters
214
- def get_yuzu_roms_path() -> str:
215
- return store.get('yuzu.romsPath')
216
-
217
- def set_yuzu_roms_path(path: str):
218
- store.set('yuzu.romsPath', path)
219
-
220
- def get_launch_yuzu_game_on_start() -> str:
221
- return store.get("yuzu.launchGameOnStart")
222
-
223
- def set_launch_yuzu_game_on_start(path: str):
224
- store.set("yuzu.launchGameOnStart", path)
225
-
226
- def get_last_yuzu_game_launched() -> str:
227
- return store.get("yuzu.lastGameLaunched")
228
-
229
- def set_last_yuzu_game_launched(path: str):
230
- store.set("yuzu.lastGameLaunched", path)
231
-
232
- # Agent scripts path getters and setters
233
- def get_agent_scripts_path() -> str:
234
- return store.get('agentScriptsPath')
235
-
236
- def set_agent_scripts_path(path: str):
237
- store.set('agentScriptsPath', path)
238
-
239
- def set_agent_path(path: str):
240
- store.set('agentPath', path)
241
-
242
- def get_agent_path() -> str:
243
- return store.get('agentPath')
244
-
245
- def get_start_console_minimized() -> bool:
246
- return store.get("startConsoleMinimized")
247
-
248
- def set_start_console_minimized(should_minimize: bool):
249
- store.set("startConsoleMinimized", should_minimize)
250
-
251
- def get_vns() -> List[str]:
252
- return store.get('VN.vns')
253
-
254
- def set_vns(vns: List[str]):
255
- store.set('VN.vns', vns)
256
-
257
- def get_textractor_path() -> str:
258
- return store.get("VN.textractorPath")
259
-
260
- def set_textractor_path(path: str):
261
- store.set("VN.textractorPath", path)
262
-
263
- def get_launch_vn_on_start() -> str:
264
- return store.get("VN.launchVNOnStart")
265
-
266
- def set_launch_vn_on_start(vn: str):
267
- store.set("VN.launchVNOnStart", vn)
268
-
269
- def get_last_vn_launched() -> str:
270
- return store.get("VN.lastVNLaunched")
271
-
272
- def set_last_vn_launched(vn: str):
273
- store.set("VN.lastVNLaunched", vn)
274
-
275
- def get_steam_path() -> str:
276
- return store.get('steam.steamPath')
277
-
278
- def set_steam_path(path: str):
279
- store.set('steam.steamPath', path)
280
-
281
- def get_launch_steam_on_start() -> int:
282
- return store.get('steam.launchSteamOnStart')
283
-
284
- def set_launch_steam_on_start(game_id: int):
285
- store.set('steam.launchSteamOnStart', game_id)
286
-
287
- def get_last_steam_game_launched() -> int:
288
- return store.get('steam.lastGameLaunched')
289
-
290
- def set_last_steam_game_launched(game_id: int):
291
- store.set('steam.lastGameLaunched', game_id)
292
-
293
- def get_steam_games() -> List[SteamGame]:
294
- steam_games_data = store.get('steam.steamGames')
295
- return [SteamGame.from_dict(game_data) for game_data in steam_games_data] if isinstance(steam_games_data, list) else []
296
-
297
- def set_steam_games(games: List[SteamGame]):
298
- store.set('steam.steamGames', [game.to_dict() for game in games])
299
-
300
- # if __name__ == "__main__":
301
- # # Example usage:
302
- # print(f"Initial Yuzu Emulator Path: {get_yuzu_emu_path()}")
303
- # set_yuzu_emu_path("D:\\NewEmulators\\yuzu\\yuzu.exe")
304
- # print(f"Updated Yuzu Emulator Path: {get_yuzu_emu_path()}")
305
- #
306
- # ocr_config = get_ocr_config()
307
- # print(f"Initial Two-Pass OCR: {ocr_config.twoPassOCR}")
308
- # set_two_pass_ocr(True)
309
- # print(f"Updated Two-Pass OCR: {get_two_pass_ocr()}")
310
- #
311
- # steam_games = get_steam_games()
312
- # print(f"Initial Steam Games: {[game.name for game in steam_games]}")
313
- # new_games = [SteamGame(123, "Game One"), SteamGame(456, "Game Two")]
314
- # set_steam_games(new_games)
315
- # print(f"Updated Steam Games: {[game.name for game in get_steam_games()]}")