GameSentenceMiner 2.1.2.post1__py3-none-any.whl → 2.2.1__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.
@@ -1,352 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: GameSentenceMiner
3
- Version: 2.1.2.post1
4
- Summary: A tool for mining sentences from games.
5
- Author-email: Beangate <bpwhelan95@gmail.com>
6
- License: MIT License
7
- Project-URL: Homepage, https://github.com/bpwhelan/GameSentenceMiner
8
- Project-URL: Repository, https://github.com/bpwhelan/GameSentenceMiner
9
- Classifier: Programming Language :: Python :: 3
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.11
13
- Description-Content-Type: text/markdown
14
- Requires-Dist: requests~=2.32.3
15
- Requires-Dist: anki~=24.6.3
16
- Requires-Dist: watchdog~=5.0.2
17
- Requires-Dist: DateTime~=5.5
18
- Requires-Dist: pyperclip~=1.9.0
19
- Requires-Dist: vosk~=0.3.45
20
- Requires-Dist: soundfile~=0.12.1
21
- Requires-Dist: toml~=0.10.2
22
- Requires-Dist: psutil~=6.0.0
23
- Requires-Dist: rapidfuzz~=3.9.7
24
- Requires-Dist: obs-websocket-py~=1.0
25
- Requires-Dist: plyer~=2.1.0
26
- Requires-Dist: keyboard~=0.13.5
27
- Requires-Dist: websockets~=13.0.1
28
- Requires-Dist: obsws_python~=1.7.0
29
- Requires-Dist: numpy~=2.0.2
30
- Requires-Dist: stable-ts~=2.17.5
31
- Requires-Dist: openai-whisper
32
- Requires-Dist: silero-vad~=5.1.2
33
- Requires-Dist: ttkbootstrap~=1.10.1
34
- Requires-Dist: dataclasses_json~=0.6.7
35
- Requires-Dist: pyinstaller
36
- Requires-Dist: pystray
37
- Requires-Dist: pywin32
38
-
39
- # Sentence Mining Game Audio Trim Helper
40
-
41
- ## WARNING
42
-
43
- This project is in process of a major overhaul, and this README will be updated soon with the new process.
44
-
45
- ---
46
-
47
- This project automates the recording of game sentence audio to help with Anki Card Creation.
48
-
49
- This allows us to create cards from texthooker/yomitan, and automatically get screenshot and sentence audio from the
50
- game we are playing.
51
-
52
- ## Features:
53
-
54
- - **Voice Activity Detection**: Automatically cuts the end of the clip to the exact moment the voice ended.
55
- - **OBS Replay Buffer**: Constantly records the last X seconds of gameplay.
56
- - **Clipboard Interaction**: Automatically monitors the clipboard for dialogue events.
57
- - **Websocket Listening**: Listens to a websocket uri for text-events from stuff like Agent/Textractor.
58
- - **Hotkey Automation**: Single hotkey to trigger video recording, screenshot, and transcription.
59
- - **1-Click Card Creation**: Monitors anki for new cards from Yomitan, and automatically gets audio from games.
60
-
61
- ## Prerequisites
62
-
63
- - [Python 3.11+](https://www.python.org/downloads/)
64
- - [OBS Studio](https://obsproject.com/)
65
-
66
- ---
67
-
68
- ### Quick Disclaimer/Troubleshooting
69
-
70
- Every game/hook is different, so it's really impossible that any script can get it perfect everytime. Also OBS is
71
- sometimes a bit finnicky if running for too long. If the audio timing is off, please first try some troubleshooting
72
- steps before making an issue:
73
-
74
- - Try Restarting OBS
75
- - Make sure your hook is the best you can find. (Preferrably it gives you the text RIGHT when the voiceline starts)
76
- - Try Adjusting Offset Configuration in `config.toml` to better match your situation. (i.e. if the hook is late, add a
77
- negative beginning offset)
78
- - Try using "Trim beginning" in `VAD` settings.
79
-
80
- #### Setup Troubleshooting
81
-
82
- Just going to continuously update this with issues that I have helped users with. Look here first if you have issues
83
- setting it up.
84
-
85
- - Make sure folder_to_watch is the same as your recordings path in OBS. It defaults to ~/Videos, but I recommend setting
86
- it to ~/Videos/OBS.
87
- - if it says something about a missing library, attempt to run `pip install -r requirements.txt` again
88
- - If using clipboard, make sure agent/textractor sending to clipboard is enabled.
89
-
90
- ## 1. Setting Up OBS 60-Second Replay Buffer
91
-
92
- 1. **Install OBS Studio**: Download and install OBS from [here](https://obsproject.com/).
93
- 2. **Enable Replay Buffer**:
94
- 1. Open OBS and navigate to **Settings → Output → Replay Buffer**.
95
- 2. Enable the **Replay Buffer** and set the duration to **60 seconds**, this can be lower, or higher, but 60 works
96
- for a very simple setup.
97
- 3. **Set a Hotkey for the Replay Buffer**:
98
- 1. Go to **Settings → Hotkeys** and find **Save Replay Buffer**.
99
- 2. Assign a hotkey for saving the replay.
100
- 4. Set Scene/Source. I recommend using "Game Capture" with "Capture Audio" Enabled. And then mute Desktop/microphone
101
- 1. If "Game Capture" Does not work, use "Window Capture".
102
- 2. I recommend having a Scene PER Game, with the name of the scene labeled as the game, this makes it easier for the
103
- script to know (with a config option) what game you are playing.
104
- 5. In Output Settings, set "Recording Format" to mkv, and "Audio Encoder" to Opus. Alternative Settings may be supported
105
- at a later date.
106
- 6. **Set up obs websocket** (HIGHLY RECOMMENDED see #5)
107
- 1. Can allow my script to automatically start (and stop) the replay buffer, as well as automatically add
108
- audio/screenshot to card created from yomi.
109
-
110
- Here are the Settings I use in OBS. Make sure the recordings folder is the same as the "folder_to_watch" in the config.
111
- ![image](https://github.com/user-attachments/assets/0056816d-af3c-4a3c-bc6a-4aff5c28cadb)
112
- ![image](https://github.com/user-attachments/assets/dd2f95a6-f546-41d9-8136-de7b1b035a5d)
113
-
114
-
115
- ---
116
-
117
- ## 2. Configuring the App.
118
-
119
- ### Configuration GUI
120
-
121
- The `GameSentenceMiner` project now includes a graphical interface to simplify configuration. With default values
122
- already set, this GUI lets you adjust settings as needed. Here’s how to get started:
123
-
124
- #### Running the Configuration GUI
125
-
126
- To open the GUI, you have two options:
127
-
128
- 1. **Tray Icon**: Right Click the Tray Icon and Click `Open Settings`
129
- 2. **Directly Run the Script**: Open a terminal in your project directory and enter:
130
- \\\bash
131
- python config_gui.py
132
- \\\
133
-
134
- #### Default Settings and Customization
135
-
136
- The GUI loads with default values for each setting, so if you’re just getting started, you may only need to change stuff
137
- in the "path" config. If you make changes, remember to click **Save Settings** to apply them.
138
- Please take a second to look through the config to see what is available, there is a lot of extra functionality hidden
139
- behind config options.
140
-
141
- ![image](https://github.com/user-attachments/assets/ffac9888-de0a-412b-817f-e22a55ce7b55)![image](https://github.com/user-attachments/assets/981c112a-1ddc-4e07-9c39-57fe46644ff5)![image](https://github.com/user-attachments/assets/29470a97-6013-4ca8-9059-48af735eb3a8)![image](https://github.com/user-attachments/assets/8e9c8f03-dc43-4822-a3c5-43f36ca65364)
142
-
143
-
144
-
145
-
146
-
147
- ---
148
-
149
- ## 2. Configuring `config.toml` **DEPRECATED** Only used if running an older version.
150
-
151
- I redid the config parsing cause `config.py` is not ideal, especially when distributing a script via git.
152
-
153
- Your `config.toml` file allows you to configure key settings for the automation process, file paths, and other behavior.
154
- Here are the configurable options:
155
-
156
- Duplicate/rename config_EXAMPLE.toml to get started
157
-
158
- ```toml
159
- # Path configurations
160
- [paths]
161
- folder_to_watch = "~/Videos/OBS"
162
- audio_destination = "~/Videos/OBS/Audio/"
163
- screenshot_destination = "~/Videos/OBS/SS/"
164
-
165
- # Anki Fields
166
- [anki]
167
- url = 'http://127.0.0.1:8765'
168
- sentence_field = "Sentence"
169
- sentence_audio_field = "SentenceAudio"
170
- picture_field = "Picture"
171
- word_field = "Word"
172
- current_game = "Japanese Game"
173
- custom_tags = ['JapaneseGameMiner', "Test Another Tag"] # leave Empty if you dont want to add tags
174
- add_game_tag = true
175
- polling_rate = 200 # This is how often the script asks anki if it has new cards. Change at your own peril.
176
-
177
- # Feature Flags
178
- [features]
179
- do_vosk_postprocessing = true
180
- update_anki = true
181
- remove_video = true
182
- remove_screenshot = false
183
- remove_audio = false
184
- notify_on_update = true
185
- open_anki_edit = false
186
- backfill_audio = false # Strictly to fill audio for cards that you already have in your anki db. CANNOT BE USED WITH FULL_AUTO_MODE
187
-
188
- # Vosk Model
189
- [vosk]
190
- url = "https://alphacephei.com/vosk/models/vosk-model-small-ja-0.22.zip"
191
- # If you have a high-performance PC, with 16GB+ of RAM, you can uncomment and use this model:
192
- # url = "https://alphacephei.com/vosk/models/vosk-model-ja-0.22.zip"
193
- log-level = -1
194
-
195
- [screenshot]
196
- width = 0 # Desired Width of Screenshot, 0 to disable scaling (Default 0)
197
- quality = 85 # Quality of image, 100 is lossless (Default 85)
198
- extension = "webp" # Codec of screenshot, Recommend Keeping this as webp (Default webp)
199
-
200
- [audio]
201
- extension = "opus" # Desired Extension/codec of Trimmed Audio, (Default opus)
202
- beginning_offset = 0.0 # Negative Value = More time at the beginning (i.e. -1 is 1 extra second at the beginning)
203
- end_offset = 0.5 # Positive Value = More time at the end (i.e. 1 is 1 extra second at the end)
204
- vosk_trim_beginning = false # Only change If you run into issues with clipboard timing, add a negative beginning_offset as well, Warning: You may end up with audio from previous line depending on your setup!
205
- reset_hotkey = 'f4' # Hotkey to initiate Offset Updater.
206
-
207
- [obs]
208
- enabled = true
209
- start_buffer = true
210
- full_auto_mode = false # Automatically Create Cards when you Create in Yomi. REQUIRED for multi-card-per-voiceline
211
- host = "localhost"
212
- port = 4455
213
- password = "your_password_here"
214
- get_game_from_scene = false
215
-
216
- [websocket]
217
- enabled = true # Recommended/Default, with this enabled, this script does not interact with your clipboard at all.
218
- uri = 'localhost:6677'
219
-
220
- #[anki_custom_fields]
221
- #IsTargetedSentenceCard = 1
222
- #Comment = "Nice!"
223
- ```
224
-
225
- ---
226
-
227
- ## 3. Install Requirements
228
-
229
- If you know what you are doing, do this in a venv, but I'm not going to explain that here.
230
-
231
- `pip install -r requirements.txt`
232
-
233
- ## 4. Installing FFmpeg
234
-
235
- To run this script, you will need to have **FFmpeg** installed. If you don't have FFmpeg installed on your system, you
236
- can easily install it via **Chocolatey** (Preferred), or install it yourself and ensure it's in the PATH.
237
-
238
- #### Step-by-Step Instructions:
239
-
240
- 1. First, ensure you have **Chocolatey** installed. If you don't have it installed, follow the instructions on
241
- the [Chocolatey installation page](https://chocolatey.org/install) or run the following command in an **elevated**
242
- PowerShell window (run as Administrator):
243
-
244
- ```bash
245
- Set-ExecutionPolicy Bypass -Scope Process -Force; `
246
- [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; `
247
- iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
248
- ```
249
-
250
- 2. Once Chocolatey is installed, open a **new** PowerShell or Command Prompt window (with administrator rights).
251
-
252
- 3. Run the following command to install FFmpeg:
253
-
254
- ```bash
255
- choco install ffmpeg
256
- ```
257
-
258
- 4. After the installation is complete, verify that FFmpeg is correctly installed by running the following command:
259
-
260
- ```bash
261
- ffmpeg -version
262
- ```
263
-
264
- If the installation was successful, you should see the version information for FFmpeg.
265
-
266
- Now you're ready to use FFmpeg in the script!
267
-
268
- ---
269
-
270
- ## 5. One Click Card Creation
271
-
272
- This is the flagship feature of this script, so here is a section explaining it. It is possible to do full 1-click card
273
- creation with this tool + Yomitan. The relevant settings are located in `Features` and `OBS` section in the config.
274
-
275
- Demo: https://www.youtube.com/watch?v=9dmmXO2CGNw
276
-
277
- Screenshots to help with setup:
278
-
279
- ![image](https://github.com/user-attachments/assets/7de031e9-ce28-42eb-a8fd-0e60ef70dc3d)
280
-
281
- ![image](https://github.com/user-attachments/assets/b0c70a1a-65b5-4fe7-a7e4-ccb0b9a5b249)
282
-
283
- ![image](https://github.com/user-attachments/assets/4cf492eb-12a2-429f-aa0e-f87fc0fa6270)
284
-
285
- ## 6. Example Process
286
-
287
- 1. Start game
288
- 2. Hook Game with Agent (or textractor) with clipboard enabled
289
- 3. start script: `python -m src.GameSentenceMiner.gsm`
290
- 1. Create Anki Card with target word (through a texthooker page/Yomitan)
291
- 2. (If full-auto-mode not on) Trigger Hotkey to record replay buffer
292
- 4. When finished gaming, end script
293
-
294
- Once the hotkey is triggered:
295
-
296
- 1. **OBS** will save the last X seconds of gameplay.
297
- 2. The Python script will trim the audio based on last clipboard event, and the end of voiceline detected in Vosk if
298
- enabled.
299
- 3. Will attempt to update the LAST anki card created.
300
-
301
- ---
302
-
303
- ## How to Update the Script
304
-
305
- ### Updater (Preferred)
306
-
307
- There is now an Update script included! running `python update.py` in the directory will attempt to update your scripts
308
- to the latest release. If you have made changes to any of the files, they will be safely backed up before being
309
- replaced.
310
-
311
- ---
312
-
313
- ### Manual
314
-
315
- To ensure you always have the latest version of this script, you can use `git pull` to update your local repository with
316
- the latest changes from the remote repository.
317
-
318
- #### Step-by-Step Instructions
319
-
320
- 1. Open your terminal and navigate to the directory where you cloned the repository:
321
- ```bash
322
- cd path/to/script
323
- ```
324
-
325
- 2. Run the following command to fetch and integrate the latest changes:
326
- ```bash
327
- git pull origin main
328
- ```
329
-
330
- - **`origin`** refers to the remote repository from which you cloned the code.
331
- - **`main`** refers to the main branch of the repository. If your default branch has a different name (
332
- e.g., `master` or `dev`), replace `main` with that branch name.
333
-
334
- 3. The `git pull` command will download and apply any updates from the remote repository to your local version.
335
-
336
- ### Example:
337
-
338
- ```bash
339
- $ cd path/to/script
340
- $ git pull origin master
341
- ```
342
-
343
- ---
344
-
345
- ## Contact
346
-
347
- If you run into issues ask in my [discord](https://discord.gg/yP8Qse6bb8), or make an issue here.
348
-
349
- ## Donations
350
-
351
- If you've benefited from this or any of my other projects, please consider supporting my work
352
- via [Github Sponsors](https://github.com/sponsors/bpwhelan) or [Ko-fi.](https://ko-fi.com/beangate)
@@ -1,21 +0,0 @@
1
- GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- GameSentenceMiner/anki.py,sha256=3UT6K5PxzJMDoiXyOULrkeCoJ0KMq7JvBw6XhcLCirE,9114
3
- GameSentenceMiner/config_gui.py,sha256=R16wJtFxPcqIixnKmxy3iIlpEIqFJwKmxXS7AoZVO0Y,48968
4
- GameSentenceMiner/configuration.py,sha256=CSg67qIzEdj_w-dS-NEls9syyTeJD3rfPrwSZLomFcU,14029
5
- GameSentenceMiner/ffmpeg.py,sha256=hdKimzkpAKsE-17qEAQg4uHy4-TtdFywYx48Skn9cPs,10418
6
- GameSentenceMiner/gametext.py,sha256=GpR9P8h3GmmKH46Dw13kJPx66n3jGjFCiV8Fcrqn9E8,3999
7
- GameSentenceMiner/gsm.py,sha256=GqMNcb8w117clJfFiNLhDbZ8eOFQTyVhejrjHvsBJXo,15072
8
- GameSentenceMiner/model.py,sha256=oh8VVT8T1UKekbmP6MGNgQ8jIuQ_7Rg4GPzDCn2kJo8,1999
9
- GameSentenceMiner/notification.py,sha256=sWgIIXhaB9WV1K_oQGf5-IR6q3dakae_QS-RuIvbcEs,1939
10
- GameSentenceMiner/obs.py,sha256=gutnRk30jIxuvrpEosR9jw2h_tll36wgtAZkUF-vWDY,5256
11
- GameSentenceMiner/package_updater.py,sha256=aexojWH6JcDt01ZcxZN5bHdt_TFxWgPKC4w-Pvjp_dQ,1469
12
- GameSentenceMiner/util.py,sha256=OYg0j_rT9F7v3aJRwWnHvdWMYyxGlimrvw7U2C9ifeY,4441
13
- GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- GameSentenceMiner/vad/silero_trim.py,sha256=r7bZYEj-NUXGKgD2UIhLrbTPyq0rau97qGtrMZcRK4A,1517
15
- GameSentenceMiner/vad/vosk_helper.py,sha256=lWmlGMhmg_0QoWeCHrXwz9wDKPqY37BckHCekGVtJUI,5794
16
- GameSentenceMiner/vad/whisper_helper.py,sha256=9kmPeSs6jRcKSVxYY-vtyTcqVUDORR4q1nl8fqxHHn4,3379
17
- GameSentenceMiner-2.1.2.post1.dist-info/METADATA,sha256=w3DyH8RZX7bSR3VmuPNz9zCyCLIGsLWL0WuiilXIHVU,13541
18
- GameSentenceMiner-2.1.2.post1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
- GameSentenceMiner-2.1.2.post1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
20
- GameSentenceMiner-2.1.2.post1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
21
- GameSentenceMiner-2.1.2.post1.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- gamesentenceminer = GameSentenceMiner.gsm:main
@@ -1 +0,0 @@
1
- GameSentenceMiner
File without changes
File without changes
File without changes