GameSentenceMiner 2.7.10__py3-none-any.whl → 2.7.12__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 +6 -2
- GameSentenceMiner/configuration.py +1 -1
- GameSentenceMiner/gsm.py +1 -3
- GameSentenceMiner/obs.py +6 -9
- GameSentenceMiner/ocr/gsm_ocr_config.py +49 -7
- GameSentenceMiner/ocr/owocr_area_selector.py +775 -172
- GameSentenceMiner/ocr/owocr_helper.py +19 -14
- {gamesentenceminer-2.7.10.dist-info → gamesentenceminer-2.7.12.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.7.10.dist-info → gamesentenceminer-2.7.12.dist-info}/RECORD +13 -13
- {gamesentenceminer-2.7.10.dist-info → gamesentenceminer-2.7.12.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.7.10.dist-info → gamesentenceminer-2.7.12.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.7.10.dist-info → gamesentenceminer-2.7.12.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.7.10.dist-info → gamesentenceminer-2.7.12.dist-info}/top_level.txt +0 -0
@@ -210,11 +210,6 @@ rectangles = None
|
|
210
210
|
def do_second_ocr(ocr1_text, rectangle_index, time, img):
|
211
211
|
global twopassocr, ocr2, last_ocr1_results, last_ocr2_results
|
212
212
|
last_result = ([], -1)
|
213
|
-
|
214
|
-
previous_ocr1_text = last_ocr1_results[rectangle_index]
|
215
|
-
if fuzz.ratio(previous_ocr1_text, ocr1_text) >= 80:
|
216
|
-
logger.info("Seems like the same text, not doing 2nd pass")
|
217
|
-
last_ocr1_results[rectangle_index] = ocr1_text
|
218
213
|
try:
|
219
214
|
orig_text, text = run.process_and_write_results(img, None, None, last_result, TextFiltering(),
|
220
215
|
engine=ocr2)
|
@@ -222,6 +217,7 @@ def do_second_ocr(ocr1_text, rectangle_index, time, img):
|
|
222
217
|
if fuzz.ratio(previous_ocr2_text, text) >= 80:
|
223
218
|
logger.info("Seems like the same text from previous ocr2 result, not sending")
|
224
219
|
return
|
220
|
+
img.save(os.path.join(get_app_directory(), "temp", "last_successful_ocr.png"))
|
225
221
|
last_ocr2_results[rectangle_index] = text
|
226
222
|
if get_config().advanced.ocr_sends_to_clipboard:
|
227
223
|
import pyperclip
|
@@ -244,7 +240,7 @@ def text_callback(text, rectangle_index, time, img=None):
|
|
244
240
|
|
245
241
|
current_time = time if time else datetime.now()
|
246
242
|
|
247
|
-
previous_text = last_oneocr_results_to_check.get(rectangle_index, "")
|
243
|
+
previous_text = last_oneocr_results_to_check.get(rectangle_index, "").strip()
|
248
244
|
|
249
245
|
if not text:
|
250
246
|
if previous_text:
|
@@ -253,13 +249,19 @@ def text_callback(text, rectangle_index, time, img=None):
|
|
253
249
|
if twopassocr:
|
254
250
|
do_second_ocr(previous_text, rectangle_index, time, img)
|
255
251
|
else:
|
256
|
-
|
257
|
-
if fuzz.ratio(
|
252
|
+
previous_result = last_ocr1_results[rectangle_index]
|
253
|
+
if previous_result and fuzz.ratio(previous_result, previous_text) >= 80:
|
258
254
|
logger.info("Seems like the same text, not sending")
|
259
|
-
|
255
|
+
return
|
256
|
+
if get_config().advanced.ocr_sends_to_clipboard:
|
257
|
+
import pyperclip
|
258
|
+
pyperclip.copy(text)
|
260
259
|
websocket_server_thread.send_text(previous_text, stable_time)
|
260
|
+
img.save(os.path.join(get_app_directory(), "temp", "last_successful_ocr.png"))
|
261
|
+
last_ocr1_results[rectangle_index] = previous_text
|
261
262
|
del text_stable_start_times[rectangle_index]
|
262
263
|
del last_oneocr_results_to_check[rectangle_index]
|
264
|
+
return
|
263
265
|
return
|
264
266
|
|
265
267
|
if rectangle_index not in last_oneocr_results_to_check:
|
@@ -283,13 +285,16 @@ def text_callback(text, rectangle_index, time, img=None):
|
|
283
285
|
done = False
|
284
286
|
|
285
287
|
|
286
|
-
def run_oneocr(ocr_config: OCRConfig, i):
|
288
|
+
def run_oneocr(ocr_config: OCRConfig, i, area=False):
|
287
289
|
global done
|
288
290
|
rect_config = ocr_config.rectangles[i]
|
289
291
|
coords = rect_config.coordinates
|
290
292
|
monitor_config = rect_config.monitor
|
291
293
|
exclusions = (rect.coordinates for rect in list(filter(lambda x: x.is_excluded, ocr_config.rectangles)))
|
292
|
-
screen_area = ",".join(str(c) for c in coords)
|
294
|
+
screen_area = ",".join(str(c) for c in coords) if area else None
|
295
|
+
print(ocr_config)
|
296
|
+
print(area)
|
297
|
+
print(screen_area)
|
293
298
|
run.run(read_from="screencapture", write_to="callback",
|
294
299
|
screen_capture_area=screen_area,
|
295
300
|
# screen_capture_monitor=monitor_config['index'],
|
@@ -327,18 +332,18 @@ if __name__ == "__main__":
|
|
327
332
|
global ocr_config
|
328
333
|
ocr_config: OCRConfig = get_ocr_config()
|
329
334
|
if ocr_config and ocr_config.rectangles:
|
330
|
-
rectangles = ocr_config.rectangles
|
335
|
+
rectangles = list(filter(lambda rect: not rect.is_excluded, ocr_config.rectangles))
|
331
336
|
last_ocr1_results = [""] * len(rectangles) if rectangles else [""]
|
332
337
|
last_ocr2_results = [""] * len(rectangles) if rectangles else [""]
|
333
338
|
oneocr_threads = []
|
334
339
|
run.init_config(False)
|
335
340
|
if rectangles:
|
336
341
|
for i, rectangle in enumerate(rectangles):
|
337
|
-
thread = threading.Thread(target=run_oneocr, args=(ocr_config, i,), daemon=True)
|
342
|
+
thread = threading.Thread(target=run_oneocr, args=(ocr_config, i,True, ), daemon=True)
|
338
343
|
oneocr_threads.append(thread)
|
339
344
|
thread.start()
|
340
345
|
else:
|
341
|
-
single_ocr_thread = threading.Thread(target=run_oneocr, args=(ocr_config, 0,), daemon=True)
|
346
|
+
single_ocr_thread = threading.Thread(target=run_oneocr, args=(ocr_config, 0,False, ), daemon=True)
|
342
347
|
oneocr_threads.append(single_ocr_thread)
|
343
348
|
single_ocr_thread.start()
|
344
349
|
websocket_server_thread = WebsocketServerThread(read=True)
|
@@ -1,14 +1,14 @@
|
|
1
1
|
GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
GameSentenceMiner/anki.py,sha256=
|
2
|
+
GameSentenceMiner/anki.py,sha256=X16RG3qXUogyKwdc_T5Dugq2J4gaslpgnKbZKoggAxc,14198
|
3
3
|
GameSentenceMiner/config_gui.py,sha256=-1PanqdtTKiwItxeyt0piXrWo7lGMWwrC4iSo4NiPz4,67521
|
4
|
-
GameSentenceMiner/configuration.py,sha256=
|
4
|
+
GameSentenceMiner/configuration.py,sha256=TGDgI93J0jVYRlV6rXXnoRFJXaWQ3_o4_OTcXUZHrZw,20405
|
5
5
|
GameSentenceMiner/electron_config.py,sha256=dGcPYCISPehXubYSzsDuI2Gl092MYK0u3bTnkL9Jh1Y,9787
|
6
6
|
GameSentenceMiner/ffmpeg.py,sha256=Du31elvSmcbfeNlx_TvqkbkmSfXCHCf4mfklBt5rLaU,13408
|
7
7
|
GameSentenceMiner/gametext.py,sha256=AAke4swwmN16da0IpyL5xMhU23nTz_c6z2kMfXPYv-8,9194
|
8
|
-
GameSentenceMiner/gsm.py,sha256=
|
8
|
+
GameSentenceMiner/gsm.py,sha256=dT9MsD_uOSFdZxi50EBsfpaqOJys36T2yzBrCeakn9E,24690
|
9
9
|
GameSentenceMiner/model.py,sha256=JdnkT4VoPOXmOpRgFdvERZ09c9wLN6tUJxdrKlGZcqo,5305
|
10
10
|
GameSentenceMiner/notification.py,sha256=FY39ChSRK0Y8TQ6lBGsLnpZUFPtFpSy2tweeXVoV7kc,2809
|
11
|
-
GameSentenceMiner/obs.py,sha256=
|
11
|
+
GameSentenceMiner/obs.py,sha256=UuMGhiD1sinEjM2JGdLLeQAXTifYPrcNy-78Ta316ds,9022
|
12
12
|
GameSentenceMiner/package.py,sha256=YlS6QRMuVlm6mdXx0rlXv9_3erTGS21jaP3PNNWfAH0,1250
|
13
13
|
GameSentenceMiner/util.py,sha256=W49gqYlhbzZe-17zHMFcAjNeeteXrv_USHT7aBDKSqM,6825
|
14
14
|
GameSentenceMiner/utility_gui.py,sha256=JcNjk9Wrz_Au7P4ITslSBqXBU-o6nA2sc2vJvglAk4o,7432
|
@@ -21,10 +21,10 @@ GameSentenceMiner/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5Fng
|
|
21
21
|
GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
GameSentenceMiner/downloader/download_tools.py,sha256=mI1u_FGBmBqDIpCH3jOv8DOoZ3obgP5pIf9o9SVfX2Q,8131
|
23
23
|
GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
-
GameSentenceMiner/ocr/gsm_ocr_config.py,sha256=
|
24
|
+
GameSentenceMiner/ocr/gsm_ocr_config.py,sha256=dXFvq7cKqUUvhI0Db0vj2mLDna7gfo8yXfdWAnhPg_Q,1976
|
25
25
|
GameSentenceMiner/ocr/ocrconfig.py,sha256=hTROOZ3On2HngXKxwQFZvnr5AxlmlMV0mPxv-F3NbMg,6476
|
26
|
-
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=
|
27
|
-
GameSentenceMiner/ocr/owocr_helper.py,sha256=
|
26
|
+
GameSentenceMiner/ocr/owocr_area_selector.py,sha256=bCgusYXe9ibCsf56PlU301aNfDA2PDKasi78ox0IGbk,46856
|
27
|
+
GameSentenceMiner/ocr/owocr_helper.py,sha256=pxseRO4TyqoNhV-F6I43vU1CliexdYIUJNN0a1LQjfY,15090
|
28
28
|
GameSentenceMiner/owocr/owocr/__init__.py,sha256=opjBOyGGyEqZCE6YdZPnyt7nVfiwyELHsXA0jAsjm14,25
|
29
29
|
GameSentenceMiner/owocr/owocr/__main__.py,sha256=r8MI6RAmbkTWqOJ59uvXoDS7CSw5jX5war9ULGWELrA,128
|
30
30
|
GameSentenceMiner/owocr/owocr/config.py,sha256=738QCJHEWpFhMh966plOcXYWwcshSiRsxjjIwldeTtI,7461
|
@@ -36,9 +36,9 @@ GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
36
36
|
GameSentenceMiner/vad/silero_trim.py,sha256=ULf3zwS-JMsY82cKF7gZxREHw8L6lgpWF2U1YqgE9Oc,1681
|
37
37
|
GameSentenceMiner/vad/vosk_helper.py,sha256=125X8C9NxFPlWWpoNsbOnEqKx8RCjXN109zNx_QXhyg,6070
|
38
38
|
GameSentenceMiner/vad/whisper_helper.py,sha256=JJ-iltCh813XdjyEw0Wn5DaErf6PDqfH0Efu1Md8cIY,3543
|
39
|
-
gamesentenceminer-2.7.
|
40
|
-
gamesentenceminer-2.7.
|
41
|
-
gamesentenceminer-2.7.
|
42
|
-
gamesentenceminer-2.7.
|
43
|
-
gamesentenceminer-2.7.
|
44
|
-
gamesentenceminer-2.7.
|
39
|
+
gamesentenceminer-2.7.12.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
40
|
+
gamesentenceminer-2.7.12.dist-info/METADATA,sha256=G4LtlmzhP2KYbCLA44_pCnp58_UUdVK6tEzsBDnfeVA,5840
|
41
|
+
gamesentenceminer-2.7.12.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
42
|
+
gamesentenceminer-2.7.12.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
43
|
+
gamesentenceminer-2.7.12.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
44
|
+
gamesentenceminer-2.7.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|