GameSentenceMiner 2.6.5__py3-none-any.whl → 2.7.0__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.
@@ -0,0 +1,100 @@
1
+ from multiprocessing import Process, Manager
2
+ import mss
3
+ from PIL import Image, ImageTk
4
+
5
+ try:
6
+ import tkinter as tk
7
+ selector_available = True
8
+ except:
9
+ selector_available = False
10
+
11
+
12
+ class ScreenSelector:
13
+ def __init__(self, result):
14
+ self.sct = mss.mss()
15
+ self.monitors = self.sct.monitors[1:]
16
+ self.root = None
17
+ self.result = result
18
+
19
+ def on_select(self, monitor, coordinates):
20
+ self.result['monitor'] = monitor
21
+ self.result['coordinates'] = coordinates
22
+ self.root.destroy()
23
+
24
+ def create_window(self, monitor):
25
+ screenshot = self.sct.grab(monitor)
26
+ img = Image.frombytes('RGB', screenshot.size, screenshot.rgb)
27
+
28
+ if img.width != monitor['width']:
29
+ img = img.resize((monitor['width'], monitor['height']), Image.Resampling.LANCZOS)
30
+
31
+ window = tk.Toplevel(self.root)
32
+ window.geometry(f"{monitor['width']}x{monitor['height']}+{monitor['left']}+{monitor['top']}")
33
+ window.overrideredirect(1)
34
+ window.attributes('-topmost', 1)
35
+
36
+ img_tk = ImageTk.PhotoImage(img)
37
+
38
+ canvas = tk.Canvas(window, cursor='cross', highlightthickness=0)
39
+ canvas.pack(fill=tk.BOTH, expand=True)
40
+ canvas.image = img_tk
41
+ canvas.create_image(0, 0, image=img_tk, anchor=tk.NW)
42
+
43
+ start_x, start_y, rect = None, None, None
44
+
45
+ def on_click(event):
46
+ nonlocal start_x, start_y, rect
47
+ start_x, start_y = event.x, event.y
48
+ rect = canvas.create_rectangle(start_x, start_y, start_x, start_y, outline='red')
49
+
50
+ def on_drag(event):
51
+ nonlocal rect, start_x, start_y
52
+ if rect:
53
+ canvas.coords(rect, start_x, start_y, event.x, event.y)
54
+
55
+ def on_release(event):
56
+ nonlocal start_x, start_y
57
+ end_x, end_y = event.x, event.y
58
+
59
+ x1 = min(start_x, end_x)
60
+ y1 = min(start_y, end_y)
61
+ x2 = max(start_x, end_x)
62
+ y2 = max(start_y, end_y)
63
+
64
+ self.on_select(monitor, (x1, y1, x2 - x1, y2 - y1))
65
+
66
+ canvas.bind('<ButtonPress-1>', on_click)
67
+ canvas.bind('<B1-Motion>', on_drag)
68
+ canvas.bind('<ButtonRelease-1>', on_release)
69
+
70
+ def start(self):
71
+ self.root = tk.Tk()
72
+ self.root.withdraw()
73
+
74
+ for monitor in self.monitors:
75
+ self.create_window(monitor)
76
+
77
+ self.root.mainloop()
78
+ self.root.update()
79
+
80
+
81
+ def run_screen_selector(result):
82
+ selector = ScreenSelector(result)
83
+ selector.start()
84
+
85
+
86
+ def get_screen_selection():
87
+ if not selector_available:
88
+ raise ValueError('tkinter is not installed, unable to open picker')
89
+
90
+ with Manager() as manager:
91
+ res = manager.dict()
92
+ process = Process(target=run_screen_selector, args=(res,))
93
+
94
+ process.start()
95
+ process.join()
96
+
97
+ if 'monitor' in res and 'coordinates' in res:
98
+ return res.copy()
99
+ else:
100
+ return False
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.6.5
3
+ Version: 2.7.0
4
4
  Summary: A tool for mining sentences from games. Update: Multi-Line Mining! Fixed!
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -24,7 +24,7 @@ Requires-Dist: rapidfuzz~=3.9.7
24
24
  Requires-Dist: obs-websocket-py~=1.0
25
25
  Requires-Dist: plyer~=2.1.0
26
26
  Requires-Dist: keyboard~=0.13.5
27
- Requires-Dist: websockets~=13.0.1
27
+ Requires-Dist: websockets~=15.0.1
28
28
  Requires-Dist: stable-ts~=2.17.5
29
29
  Requires-Dist: silero-vad~=5.1.2
30
30
  Requires-Dist: ttkbootstrap~=1.10.1
@@ -1,13 +1,13 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- GameSentenceMiner/anki.py,sha256=O3zKxn_VVn8SA3O8mFQAsU3d1R_4QzRnWEnAIM3NQBE,14005
2
+ GameSentenceMiner/anki.py,sha256=9E9GRR2zylW3Gp4PNlwYS_Nn-mhojZkjFqfYlTazte8,14068
3
3
  GameSentenceMiner/config_gui.py,sha256=AifBgNaeWcBhuFoQz8QJ4srM1Ck8KjHmnOmI-aRcFHg,66965
4
- GameSentenceMiner/configuration.py,sha256=F-WOOjofV-GrBX2SCpArw5LMqpMGf_KCOzjvQeZZlhM,20287
4
+ GameSentenceMiner/configuration.py,sha256=a1-McjdgQN_EemhDRFZBeGGoviAWyrhejXjXYGl-MFg,20365
5
5
  GameSentenceMiner/ffmpeg.py,sha256=iUj-1uLLJla6jjGDKuc1FbcXjMogYpoDhrQqCbQFcWA,13359
6
- GameSentenceMiner/gametext.py,sha256=C8cOMKgKF3AdcaNOKSEYkdg-DAlZ8yXzhiqXJKXIgeA,8365
7
- GameSentenceMiner/gsm.py,sha256=l4g2qmW-3Wgzd-TJ6YS8qZsN0dIiky20vNaAgnoJJnc,24716
6
+ GameSentenceMiner/gametext.py,sha256=brybSe7hRy13JAUwuSs6WqOPFH6to0detbIPVhnkinA,9062
7
+ GameSentenceMiner/gsm.py,sha256=fcczDPDcC0vDLAPZtIY64mU3Di3RZjR40tuLIiwB5lE,24827
8
8
  GameSentenceMiner/model.py,sha256=JdnkT4VoPOXmOpRgFdvERZ09c9wLN6tUJxdrKlGZcqo,5305
9
9
  GameSentenceMiner/notification.py,sha256=FY39ChSRK0Y8TQ6lBGsLnpZUFPtFpSy2tweeXVoV7kc,2809
10
- GameSentenceMiner/obs.py,sha256=HX8csBHW_62c4mTTumcVfpocgdXbKwNThidDGxc4MhY,7738
10
+ GameSentenceMiner/obs.py,sha256=tAp2uiDjWy0hCaa0vGLNJPIwwZsxU68JQWRKK3EUQek,9167
11
11
  GameSentenceMiner/package.py,sha256=YlS6QRMuVlm6mdXx0rlXv9_3erTGS21jaP3PNNWfAH0,1250
12
12
  GameSentenceMiner/util.py,sha256=W49gqYlhbzZe-17zHMFcAjNeeteXrv_USHT7aBDKSqM,6825
13
13
  GameSentenceMiner/utility_gui.py,sha256=H4aOddlsrVR768RwbMzYScCziuOz1JeySUigNrPlaac,7692
@@ -19,13 +19,24 @@ GameSentenceMiner/communication/websocket.py,sha256=pTcUe_ZZRp9REdSU4qalhPmbT_1D
19
19
  GameSentenceMiner/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5FngZ7ILdA_J5TFYAXUQ,15272
20
20
  GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  GameSentenceMiner/downloader/download_tools.py,sha256=mI1u_FGBmBqDIpCH3jOv8DOoZ3obgP5pIf9o9SVfX2Q,8131
22
+ GameSentenceMiner/ocr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ GameSentenceMiner/ocr/ocrconfig.py,sha256=hTROOZ3On2HngXKxwQFZvnr5AxlmlMV0mPxv-F3NbMg,6476
24
+ GameSentenceMiner/ocr/owocr_area_selector.py,sha256=6MQPCSAhuyOSEDEgc-w6jVdsELjxstzI2Zhz0JBkG8g,11703
25
+ GameSentenceMiner/ocr/owocr_helper.py,sha256=Rlv_jIyCNSP1-Im-8e49nQYx3bVXsxl7Qp4KaNGMYfk,11577
26
+ GameSentenceMiner/owocr/owocr/__init__.py,sha256=opjBOyGGyEqZCE6YdZPnyt7nVfiwyELHsXA0jAsjm14,25
27
+ GameSentenceMiner/owocr/owocr/__main__.py,sha256=nkaZGTCZsPDKcej2O0S1SHkyzHJEboTUBc9izyGPvqw,92
28
+ GameSentenceMiner/owocr/owocr/config.py,sha256=738QCJHEWpFhMh966plOcXYWwcshSiRsxjjIwldeTtI,7461
29
+ GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
30
+ GameSentenceMiner/owocr/owocr/ocr.py,sha256=d0uLAQotZ6xhUSWWEXW07c0-EYjeTmumHxIEsT01Iuo,36604
31
+ GameSentenceMiner/owocr/owocr/run.py,sha256=b6a7AjQBqeNNoHC9CwN2f_KvaSJBfUQvpSBW8z5AcIo,46156
32
+ GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=f_YIV4-2OEZ21CAEZ_pbqeTb5D28PS82Tig4ZSnkY4Q,3096
22
33
  GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
34
  GameSentenceMiner/vad/silero_trim.py,sha256=ULf3zwS-JMsY82cKF7gZxREHw8L6lgpWF2U1YqgE9Oc,1681
24
35
  GameSentenceMiner/vad/vosk_helper.py,sha256=125X8C9NxFPlWWpoNsbOnEqKx8RCjXN109zNx_QXhyg,6070
25
36
  GameSentenceMiner/vad/whisper_helper.py,sha256=JJ-iltCh813XdjyEw0Wn5DaErf6PDqfH0Efu1Md8cIY,3543
26
- gamesentenceminer-2.6.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
27
- gamesentenceminer-2.6.5.dist-info/METADATA,sha256=uPH3wqudThoKq0CcUcn230ccyA2YKTGLm2rzo5l-Zsc,5467
28
- gamesentenceminer-2.6.5.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
29
- gamesentenceminer-2.6.5.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
30
- gamesentenceminer-2.6.5.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
31
- gamesentenceminer-2.6.5.dist-info/RECORD,,
37
+ gamesentenceminer-2.7.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
38
+ gamesentenceminer-2.7.0.dist-info/METADATA,sha256=ZCHouoQWG1EnISuEo3_KLs_aKoQl45sxjXuUo_JLBzA,5467
39
+ gamesentenceminer-2.7.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
40
+ gamesentenceminer-2.7.0.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
41
+ gamesentenceminer-2.7.0.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
42
+ gamesentenceminer-2.7.0.dist-info/RECORD,,