GameSentenceMiner 2.19.2.dev0__py3-none-any.whl → 2.19.3__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/anki.py +3 -3
- GameSentenceMiner/gsm.py +3 -3
- GameSentenceMiner/ui/config_gui.py +8 -0
- GameSentenceMiner/util/text_log.py +6 -4
- GameSentenceMiner/web/texthooking_page.py +17 -2
- {gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/RECORD +11 -11
- {gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/top_level.txt +0 -0
GameSentenceMiner/anki.py
CHANGED
|
@@ -559,10 +559,10 @@ def update_new_card():
|
|
|
559
559
|
else:
|
|
560
560
|
logger.info("New card(s) detected! Added to Processing Queue!")
|
|
561
561
|
gsm_state.last_mined_line = game_line
|
|
562
|
-
queue_card_for_processing(last_card, lines)
|
|
562
|
+
queue_card_for_processing(last_card, lines, game_line)
|
|
563
563
|
|
|
564
|
-
def queue_card_for_processing(last_card, lines):
|
|
565
|
-
card_queue.append((last_card, datetime.now(), lines))
|
|
564
|
+
def queue_card_for_processing(last_card, lines, last_mined_line):
|
|
565
|
+
card_queue.append((last_card, datetime.now(), lines, last_mined_line))
|
|
566
566
|
texthooking_page.reset_checked_lines()
|
|
567
567
|
try:
|
|
568
568
|
obs.save_replay_buffer()
|
GameSentenceMiner/gsm.py
CHANGED
|
@@ -187,7 +187,7 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
|
187
187
|
return
|
|
188
188
|
try:
|
|
189
189
|
if anki.card_queue and len(anki.card_queue) > 0:
|
|
190
|
-
last_note, anki_card_creation_time, selected_lines = anki.card_queue.pop(
|
|
190
|
+
last_note, anki_card_creation_time, selected_lines, mined_line = anki.card_queue.pop(
|
|
191
191
|
0)
|
|
192
192
|
else:
|
|
193
193
|
logger.info(
|
|
@@ -211,11 +211,11 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
|
211
211
|
full_text = ''
|
|
212
212
|
if selected_lines:
|
|
213
213
|
start_line = selected_lines[0]
|
|
214
|
-
mined_line = get_mined_line(last_note, selected_lines)
|
|
214
|
+
# mined_line = get_mined_line(last_note, selected_lines)
|
|
215
215
|
line_cutoff = selected_lines[-1].get_next_time()
|
|
216
216
|
full_text = remove_html_and_cloze_tags(note['fields'][get_config().anki.sentence_field])
|
|
217
217
|
else:
|
|
218
|
-
mined_line = get_text_event(last_note)
|
|
218
|
+
# mined_line = get_text_event(last_note)
|
|
219
219
|
if mined_line:
|
|
220
220
|
start_line = mined_line
|
|
221
221
|
if mined_line.next:
|
|
@@ -845,6 +845,14 @@ class ConfigApp:
|
|
|
845
845
|
|
|
846
846
|
title_template = self.i18n.get('app', {}).get('title_with_profile', 'GameSentenceMiner Configuration - {profile_name}')
|
|
847
847
|
self.window.title(title_template.format(profile_name=current_config.name))
|
|
848
|
+
|
|
849
|
+
try:
|
|
850
|
+
import mss as mss
|
|
851
|
+
self.monitors = [f"Monitor {i}: width: {monitor['width']}, height: {monitor['height']}" for i, monitor in enumerate(mss.mss().monitors[1:], start=1)]
|
|
852
|
+
if len(self.monitors) == 0:
|
|
853
|
+
self.monitors = [1]
|
|
854
|
+
except ImportError:
|
|
855
|
+
self.monitors = []
|
|
848
856
|
|
|
849
857
|
if current_config.name != self.settings.name or self.settings.config_changed(current_config) or force_refresh:
|
|
850
858
|
logger.info("Config changed, reloading settings.")
|
|
@@ -146,25 +146,27 @@ def get_matching_line(last_note: AnkiCard, lines=None) -> GameLine:
|
|
|
146
146
|
|
|
147
147
|
if not lines:
|
|
148
148
|
raise Exception("No voicelines in GSM. GSM can only do work on text that has been sent to it since it started. If you are not getting any text into GSM, please check your setup/config.")
|
|
149
|
+
|
|
150
|
+
last_line = lines[-1] # Store reference to the latest line
|
|
149
151
|
|
|
150
152
|
if not last_note:
|
|
151
|
-
return
|
|
153
|
+
return last_line
|
|
152
154
|
|
|
153
155
|
sentence = last_note.get_field(get_config().anki.sentence_field)
|
|
154
156
|
if not sentence:
|
|
155
|
-
return
|
|
157
|
+
return last_line
|
|
156
158
|
|
|
157
159
|
logger.info(f"Replay buffer length: {gsm_state.replay_buffer_length}")
|
|
158
160
|
time_window = datetime.now() - timedelta(seconds=gsm_state.replay_buffer_length) - timedelta(seconds=5)
|
|
159
161
|
for line in reversed(lines):
|
|
160
162
|
if line.time < time_window:
|
|
161
163
|
logger.info("Could not find matching sentence from GSM's history within the replay buffer time window. Using the latest line.")
|
|
162
|
-
return
|
|
164
|
+
return last_line
|
|
163
165
|
if lines_match(line.text, remove_html_and_cloze_tags(sentence)):
|
|
164
166
|
return line
|
|
165
167
|
|
|
166
168
|
logger.info("Could not find matching sentence from GSM's history. Using the latest line.")
|
|
167
|
-
return
|
|
169
|
+
return last_line
|
|
168
170
|
|
|
169
171
|
|
|
170
172
|
def get_text_event(last_note) -> GameLine:
|
|
@@ -235,14 +235,29 @@ def translate_line():
|
|
|
235
235
|
if event_id is None:
|
|
236
236
|
return jsonify({'error': 'Missing id'}), 400
|
|
237
237
|
|
|
238
|
+
prompt = f"""
|
|
239
|
+
**Professional Game Localization Task**
|
|
240
|
+
|
|
241
|
+
**Task Directive:**
|
|
242
|
+
Translate ONLY the provided 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 source.
|
|
243
|
+
|
|
244
|
+
**Output Requirements:**
|
|
245
|
+
- Provide only the single, best {get_config().general.get_native_language_name()} translation.
|
|
246
|
+
- Use expletives if they are natural for the context and enhance the translation's impact, but do not over-exaggerate.
|
|
247
|
+
- Do not include notes, alternatives, explanations, or any other surrounding text. Absolutely nothing but the translated line.
|
|
248
|
+
|
|
249
|
+
**Line to Translate:**
|
|
250
|
+
"""
|
|
251
|
+
|
|
238
252
|
if not get_config().ai.is_configured():
|
|
239
253
|
return jsonify({'error': 'AI translation is not properly configured. Please check your settings in the "AI" Tab.'}), 400
|
|
240
254
|
line = get_line_by_id(event_id)
|
|
241
255
|
if line is None:
|
|
242
256
|
return jsonify({'error': 'Invalid id'}), 400
|
|
243
257
|
line_to_translate = text if text else line.text
|
|
244
|
-
translation = get_ai_prompt_result(
|
|
245
|
-
|
|
258
|
+
translation = get_ai_prompt_result(
|
|
259
|
+
get_all_lines(), line_to_translate, line, get_current_game(), custom_prompt=prompt
|
|
260
|
+
)
|
|
246
261
|
line.set_TL(translation)
|
|
247
262
|
return jsonify({'TL': translation}), 200
|
|
248
263
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: GameSentenceMiner
|
|
3
|
-
Version: 2.19.
|
|
3
|
+
Version: 2.19.3
|
|
4
4
|
Summary: A tool for mining sentences from games. Update: Dependencies, replay buffer based line searching, and bug fixes.
|
|
5
5
|
Author-email: Beangate <bpwhelan95@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
GameSentenceMiner/anki.py,sha256=
|
|
2
|
+
GameSentenceMiner/anki.py,sha256=jySFPzDYz0vItb12kwZ-rm9WmtxO8Kr41wK1JdwRnU4,29638
|
|
3
3
|
GameSentenceMiner/gametext.py,sha256=4PPm7QSWDmvsyooVjFANkd1Vnoy5ixbGRMHfYfhwGs0,13320
|
|
4
|
-
GameSentenceMiner/gsm.py,sha256=
|
|
4
|
+
GameSentenceMiner/gsm.py,sha256=TpKJ2j2N_NgjT38p35nVVy5-Lvn4w49Spo4-a-6nfAc,34580
|
|
5
5
|
GameSentenceMiner/obs.py,sha256=vhTFqGxHWEz9g-081gain6iI2poJM_D7v5vI8Kl7rqk,37918
|
|
6
6
|
GameSentenceMiner/vad.py,sha256=iMSsoUZ7-aNoWKzDKfOHdB3Zk5U2hV7x5hqTny6rj08,21501
|
|
7
7
|
GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -37,7 +37,7 @@ GameSentenceMiner/tools/ss_selector.py,sha256=ob2oJdiYreDMMau7CvsglpnhZ1CDnJqop3
|
|
|
37
37
|
GameSentenceMiner/tools/window_transparency.py,sha256=GtbxbmZg0-UYPXhfHff-7IKZyY2DKe4B9GdyovfmpeM,8166
|
|
38
38
|
GameSentenceMiner/ui/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
39
|
GameSentenceMiner/ui/anki_confirmation.py,sha256=krrT3q3anTtXNTPHz5ahXSd4genEnEvS07v1JYftBFg,15174
|
|
40
|
-
GameSentenceMiner/ui/config_gui.py,sha256=
|
|
40
|
+
GameSentenceMiner/ui/config_gui.py,sha256=JHXlD6CE7o4YH1M85JSvGqc2-pNfuAyLgkztUn6ho1w,158268
|
|
41
41
|
GameSentenceMiner/ui/furigana_filter_preview.py,sha256=DAT2-j6vSDHr9ufk6PiaLikEsbIp56B_OHIEeYLMwlk,17135
|
|
42
42
|
GameSentenceMiner/ui/screenshot_selector.py,sha256=7QvDhOMpA0ej8x_lYtu6fhmrWbM1GCg-dps3XVWwk1Q,8234
|
|
43
43
|
GameSentenceMiner/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -51,7 +51,7 @@ GameSentenceMiner/util/get_overlay_coords.py,sha256=jQ0hcrEh9CfvjlBRJez3Ly-er4Mj
|
|
|
51
51
|
GameSentenceMiner/util/gsm_utils.py,sha256=mASECTmN10c2yPL4NEfLg0Y0YWwFso1i6r_hhJPR3MY,10974
|
|
52
52
|
GameSentenceMiner/util/model.py,sha256=R-_RYTYLSDNgBoVTPuPBcIHeOznIqi_vBzQ7VQ20WYk,6727
|
|
53
53
|
GameSentenceMiner/util/notification.py,sha256=YBhf_mSo_i3cjBz-pmeTPx3wchKiG9BK2VBdZSa2prQ,4597
|
|
54
|
-
GameSentenceMiner/util/text_log.py,sha256=
|
|
54
|
+
GameSentenceMiner/util/text_log.py,sha256=6eekK0TTuh65YHDw6tjGFQUrCmV1P1ebNzkdxRNXP9k,6903
|
|
55
55
|
GameSentenceMiner/util/communication/__init__.py,sha256=xh__yn2MhzXi9eLi89PeZWlJPn-cbBSjskhi1BRraXg,643
|
|
56
56
|
GameSentenceMiner/util/communication/send.py,sha256=9tEpbodt1nqsA-XqyXZGMHK_80EJPnhMJJxvDF-w3Ug,578
|
|
57
57
|
GameSentenceMiner/util/communication/websocket.py,sha256=RWPN9V6Gddqw1PmR_Ql8z0yjVihGvwSLSPQHXSxRlqM,3357
|
|
@@ -68,7 +68,7 @@ GameSentenceMiner/web/events.py,sha256=RJ8tIK8WUn7Fbgny23UJWrZ1SlhYzzT5p55E1uXRw
|
|
|
68
68
|
GameSentenceMiner/web/gsm_websocket.py,sha256=B0VKpxmsRu0WRh5nFWlpDPBQ6-K2ed7TEIa0O6YWeoo,4166
|
|
69
69
|
GameSentenceMiner/web/service.py,sha256=6cgUmDgtp3ZKzuPFszowjPoq-BDtC1bS3ux6sykeaqo,6662
|
|
70
70
|
GameSentenceMiner/web/stats.py,sha256=LYMhekifcQo-cbfy2--b6vycKcu8RAoTnQA4TefcS6U,29037
|
|
71
|
-
GameSentenceMiner/web/texthooking_page.py,sha256=
|
|
71
|
+
GameSentenceMiner/web/texthooking_page.py,sha256=jnEBnxDj37BEbi1AGsiEk3GNOqBLsd9znIKC1OuO8jM,15068
|
|
72
72
|
GameSentenceMiner/web/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
73
|
GameSentenceMiner/web/static/apple-touch-icon.png,sha256=OcMI8af_68DA_tweOsQ5LytTyMwm7-hPW07IfrOVgEs,46132
|
|
74
74
|
GameSentenceMiner/web/static/favicon-96x96.png,sha256=lOePzjiKl1JY2J1kT_PMdyEnrlJmi5GWbmXJunM12B4,16502
|
|
@@ -135,9 +135,9 @@ GameSentenceMiner/web/templates/components/kanji_grid/thousand_character_classic
|
|
|
135
135
|
GameSentenceMiner/web/templates/components/kanji_grid/wanikani_levels.json,sha256=8wjnnaYQqmho6t5tMxrIAc03512A2tYhQh5dfsQnfAM,11372
|
|
136
136
|
GameSentenceMiner/web/templates/components/kanji_grid/words_hk_frequency_list.json,sha256=wRkqZNPzz6DT9OTPHpXwfqW96Qb96stCQNNgOL-ZdKk,17535
|
|
137
137
|
GameSentenceMiner/wip/__init___.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
138
|
-
gamesentenceminer-2.19.
|
|
139
|
-
gamesentenceminer-2.19.
|
|
140
|
-
gamesentenceminer-2.19.
|
|
141
|
-
gamesentenceminer-2.19.
|
|
142
|
-
gamesentenceminer-2.19.
|
|
143
|
-
gamesentenceminer-2.19.
|
|
138
|
+
gamesentenceminer-2.19.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
139
|
+
gamesentenceminer-2.19.3.dist-info/METADATA,sha256=5zf9Ize9DvAe4tUJt1S3P4kb0ghhgnX4wTxrTvZid-E,8121
|
|
140
|
+
gamesentenceminer-2.19.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
141
|
+
gamesentenceminer-2.19.3.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
|
142
|
+
gamesentenceminer-2.19.3.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
|
143
|
+
gamesentenceminer-2.19.3.dist-info/RECORD,,
|
|
File without changes
|
{gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{gamesentenceminer-2.19.2.dev0.dist-info → gamesentenceminer-2.19.3.dist-info}/top_level.txt
RENAMED
|
File without changes
|