GameSentenceMiner 2.10.5__py3-none-any.whl → 2.10.6__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/config_gui.py +8 -8
- GameSentenceMiner/gsm.py +1 -0
- GameSentenceMiner/obs.py +2 -4
- GameSentenceMiner/ocr/gsm_ocr_config.py +2 -2
- GameSentenceMiner/ocr/owocr_helper.py +8 -7
- GameSentenceMiner/owocr/owocr/run.py +2 -1
- GameSentenceMiner/util/downloader/oneocr_dl.py +5 -3
- GameSentenceMiner/web/templates/index.html +12 -12
- GameSentenceMiner/web/texthooking_page.py +8 -0
- {gamesentenceminer-2.10.5.dist-info → gamesentenceminer-2.10.6.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.10.5.dist-info → gamesentenceminer-2.10.6.dist-info}/RECORD +15 -15
- {gamesentenceminer-2.10.5.dist-info → gamesentenceminer-2.10.6.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.10.5.dist-info → gamesentenceminer-2.10.6.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.10.5.dist-info → gamesentenceminer-2.10.6.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.10.5.dist-info → gamesentenceminer-2.10.6.dist-info}/top_level.txt +0 -0
GameSentenceMiner/config_gui.py
CHANGED
@@ -271,7 +271,7 @@ class ConfigApp:
|
|
271
271
|
video_player_path=self.video_player_path.get(),
|
272
272
|
multi_line_line_break=self.multi_line_line_break.get(),
|
273
273
|
multi_line_sentence_storage_field=self.multi_line_sentence_storage_field.get(),
|
274
|
-
use_anki_note_creation_time=self.use_anki_note_creation_time.get(),
|
274
|
+
# use_anki_note_creation_time=self.use_anki_note_creation_time.get(),
|
275
275
|
ocr_websocket_port=int(self.ocr_websocket_port.get()),
|
276
276
|
texthooker_communication_websocket_port=int(self.texthooker_communication_websocket_port.get()),
|
277
277
|
),
|
@@ -1329,13 +1329,13 @@ class ConfigApp:
|
|
1329
1329
|
self.texthooker_communication_websocket_port.grid(row=self.current_row, column=1, sticky='EW', pady=2)
|
1330
1330
|
self.current_row += 1
|
1331
1331
|
|
1332
|
-
HoverInfoLabelWidget(advanced_frame, text="Use Anki Creation Date for Audio Timing:",
|
1333
|
-
|
1334
|
-
|
1335
|
-
self.use_anki_note_creation_time = tk.BooleanVar(value=self.settings.advanced.use_anki_note_creation_time)
|
1336
|
-
ttk.Checkbutton(advanced_frame, variable=self.use_anki_note_creation_time, bootstyle="round-toggle").grid(
|
1337
|
-
|
1338
|
-
self.current_row += 1
|
1332
|
+
# HoverInfoLabelWidget(advanced_frame, text="Use Anki Creation Date for Audio Timing:",
|
1333
|
+
# tooltip="Use the Anki note creation date for audio timing instead of the OBS replay time.",
|
1334
|
+
# row=self.current_row, column=0)
|
1335
|
+
# self.use_anki_note_creation_time = tk.BooleanVar(value=self.settings.advanced.use_anki_note_creation_time)
|
1336
|
+
# ttk.Checkbutton(advanced_frame, variable=self.use_anki_note_creation_time, bootstyle="round-toggle").grid(
|
1337
|
+
# row=self.current_row, column=1, sticky='W', pady=2)
|
1338
|
+
# self.current_row += 1
|
1339
1339
|
|
1340
1340
|
HoverInfoLabelWidget(advanced_frame, text="Reset Line Hotkey:",
|
1341
1341
|
tooltip="Hotkey to reset the current line of dialogue.", row=self.current_row, column=0)
|
GameSentenceMiner/gsm.py
CHANGED
@@ -198,6 +198,7 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
198
198
|
vad_result = vad_processor.trim_audio_with_vad(trimmed_audio, vad_trimmed_audio, game_line)
|
199
199
|
if timing_only:
|
200
200
|
return vad_result
|
201
|
+
vad_trimmed_audio = vad_result.output_audio
|
201
202
|
if get_config().audio.ffmpeg_reencode_options_to_use and os.path.exists(vad_trimmed_audio):
|
202
203
|
ffmpeg.reencode_file_with_user_config(vad_trimmed_audio, final_audio_output,
|
203
204
|
get_config().audio.ffmpeg_reencode_options_to_use)
|
GameSentenceMiner/obs.py
CHANGED
@@ -334,7 +334,7 @@ def get_screenshot(compression=-1):
|
|
334
334
|
logger.error(f"Error getting screenshot: {e}")
|
335
335
|
return None
|
336
336
|
|
337
|
-
def get_screenshot_base64():
|
337
|
+
def get_screenshot_base64(compression=0, width=None, height=None):
|
338
338
|
try:
|
339
339
|
# update_current_game()
|
340
340
|
current_game = get_current_game()
|
@@ -346,10 +346,8 @@ def get_screenshot_base64():
|
|
346
346
|
if not current_source_name:
|
347
347
|
logger.error("No active source found in the current scene.")
|
348
348
|
return None
|
349
|
-
response = client.get_source_screenshot(name=current_source_name, img_format='png', quality=
|
349
|
+
response = client.get_source_screenshot(name=current_source_name, img_format='png', quality=compression, width=width, height=height)
|
350
350
|
if response and response.image_data:
|
351
|
-
with open('screenshot_response.txt', 'wb') as f:
|
352
|
-
f.write(str(response).encode())
|
353
351
|
return response.image_data
|
354
352
|
else:
|
355
353
|
logger.error(f"Error getting base64 screenshot: {response}")
|
@@ -91,7 +91,7 @@ def get_window(title):
|
|
91
91
|
import pygetwindow as gw
|
92
92
|
all_windows = gw.getWindowsWithTitle(title)
|
93
93
|
if not all_windows:
|
94
|
-
|
94
|
+
return None
|
95
95
|
|
96
96
|
filtered_windows = []
|
97
97
|
for window in all_windows:
|
@@ -101,7 +101,7 @@ def get_window(title):
|
|
101
101
|
filtered_windows.append(window)
|
102
102
|
|
103
103
|
if not filtered_windows:
|
104
|
-
|
104
|
+
return None
|
105
105
|
|
106
106
|
ret = None
|
107
107
|
for window in filtered_windows:
|
@@ -182,11 +182,11 @@ all_cords = None
|
|
182
182
|
rectangles = None
|
183
183
|
last_ocr2_result = ""
|
184
184
|
|
185
|
-
def do_second_ocr(ocr1_text, time, img, filtering):
|
185
|
+
def do_second_ocr(ocr1_text, time, img, filtering, ignore_furigana_filter=False):
|
186
186
|
global twopassocr, ocr2, last_ocr2_result
|
187
187
|
try:
|
188
188
|
orig_text, text = run.process_and_write_results(img, None, last_ocr2_result, filtering, None,
|
189
|
-
engine=ocr2, furigana_filter_sensitivity=furigana_filter_sensitivity)
|
189
|
+
engine=ocr2, furigana_filter_sensitivity=furigana_filter_sensitivity if not ignore_furigana_filter else 0)
|
190
190
|
if fuzz.ratio(last_ocr2_result, orig_text) >= 90:
|
191
191
|
logger.info("Seems like the same text from previous ocr2 result, not sending")
|
192
192
|
return
|
@@ -313,7 +313,7 @@ def run_oneocr(ocr_config: OCRConfig, rectangles):
|
|
313
313
|
|
314
314
|
run.init_config(False)
|
315
315
|
try:
|
316
|
-
run.run(read_from="screencapture",
|
316
|
+
run.run(read_from="screencapture" if window else "",
|
317
317
|
read_from_secondary="clipboard" if ss_clipboard else None,
|
318
318
|
write_to="callback",
|
319
319
|
screen_capture_area=screen_area,
|
@@ -345,14 +345,14 @@ def add_ss_hotkey(ss_hotkey="ctrl+shift+g"):
|
|
345
345
|
def capture():
|
346
346
|
print("Taking screenshot...")
|
347
347
|
img = cropper.run()
|
348
|
-
do_second_ocr("", datetime.now(), img, filtering)
|
348
|
+
do_second_ocr("", datetime.now(), img, filtering, ignore_furigana_filter=True)
|
349
349
|
def capture_main_monitor():
|
350
350
|
print("Taking screenshot of main monitor...")
|
351
351
|
with mss.mss() as sct:
|
352
352
|
main_monitor = sct.monitors[1] if len(sct.monitors) > 1 else sct.monitors[0]
|
353
353
|
img = sct.grab(main_monitor)
|
354
354
|
img_bytes = mss.tools.to_png(img.rgb, img.size)
|
355
|
-
do_second_ocr("", datetime.now(), img_bytes, filtering)
|
355
|
+
do_second_ocr("", datetime.now(), img_bytes, filtering, ignore_furigana_filter=True)
|
356
356
|
hotkey_reg = None
|
357
357
|
try:
|
358
358
|
hotkey_reg = keyboard.add_hotkey(ss_hotkey, capture)
|
@@ -389,7 +389,7 @@ def set_force_stable_hotkey():
|
|
389
389
|
print("Press Ctrl+Shift+F to toggle force stable mode.")
|
390
390
|
|
391
391
|
if __name__ == "__main__":
|
392
|
-
global ocr1, ocr2, twopassocr, language, ss_clipboard, ss, ocr_config, furigana_filter_sensitivity, area_select_ocr_hotkey
|
392
|
+
global ocr1, ocr2, twopassocr, language, ss_clipboard, ss, ocr_config, furigana_filter_sensitivity, area_select_ocr_hotkey, window
|
393
393
|
import sys
|
394
394
|
|
395
395
|
import argparse
|
@@ -428,7 +428,8 @@ if __name__ == "__main__":
|
|
428
428
|
if ocr_config.window:
|
429
429
|
start_time = time.time()
|
430
430
|
while time.time() - start_time < 30:
|
431
|
-
|
431
|
+
window = get_window(ocr_config.window)
|
432
|
+
if window or manual:
|
432
433
|
break
|
433
434
|
logger.info(f"Window: {ocr_config.window} Could not be found, retrying in 1 second...")
|
434
435
|
time.sleep(1)
|
@@ -406,7 +406,8 @@ class TextFiltering:
|
|
406
406
|
break
|
407
407
|
else:
|
408
408
|
for block in new_blocks:
|
409
|
-
|
409
|
+
# This only filters out NON JA/ZH from text when lang is JA/ZH
|
410
|
+
if lang not in ["ja", "zh"] or self.classify(block)[0] in ['ja', 'zh']:
|
410
411
|
final_blocks.append(block)
|
411
412
|
|
412
413
|
text = '\n'.join(final_blocks)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import os
|
2
|
+
import time
|
2
3
|
import zipfile
|
3
4
|
import shutil
|
4
5
|
from os.path import expanduser
|
@@ -61,12 +62,13 @@ class Downloader:
|
|
61
62
|
Main function to attempt download and extraction.
|
62
63
|
Tries official source first, then a fallback URL.
|
63
64
|
"""
|
64
|
-
|
65
|
-
|
66
|
-
|
65
|
+
if checkdir(self.oneocr_dir):
|
66
|
+
print("Files already exist in cache.")
|
67
|
+
return True
|
67
68
|
|
68
69
|
try:
|
69
70
|
print("Attempting to download from official source...")
|
71
|
+
# raise Exception("")
|
70
72
|
self.downloadofficial()
|
71
73
|
print("Download and extraction from official source successful.")
|
72
74
|
return True
|