GameSentenceMiner 2.4.2__py3-none-any.whl → 2.4.4__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.
@@ -4,9 +4,9 @@ from tkinter import filedialog, messagebox, simpledialog
4
4
  import pyperclip
5
5
  import ttkbootstrap as ttk
6
6
 
7
- from GameSentenceMiner.package_updater import check_for_updates, get_latest_version, get_current_version
8
7
  from GameSentenceMiner import obs, configuration
9
8
  from GameSentenceMiner.configuration import *
9
+ from GameSentenceMiner.package import get_current_version, get_latest_version
10
10
 
11
11
  settings_saved = False
12
12
  on_save = []
@@ -95,25 +95,6 @@ class ConfigApp:
95
95
  if self.window is not None:
96
96
  self.window.withdraw()
97
97
 
98
- def update_now(self):
99
- update_available, version = check_for_updates()
100
- if update_available:
101
- messagebox.showinfo("Update", "GSM Will Copy the Update Command to your clipboard, please run it in a terminal.")
102
- pyperclip.copy("pip install --upgrade GameSentenceMiner")
103
- self.on_exit(None, None)
104
- else:
105
- messagebox.showinfo("No Update Found", "No update found.")
106
-
107
- def check_update(self, show_no_update=False):
108
- update_available, version = check_for_updates()
109
- if update_available:
110
- self.latest_version.config(text=version)
111
- should_update = messagebox.askyesno("Update Found", "Update Found, would you like to update now?")
112
- if should_update:
113
- self.update_now()
114
- elif show_no_update:
115
- messagebox.showinfo("No Update Found", "No update found.")
116
-
117
98
  def save_settings(self, profile_change=False):
118
99
  global settings_saved
119
100
 
@@ -123,7 +104,6 @@ class ConfigApp:
123
104
  use_websocket=self.websocket_enabled.get(),
124
105
  websocket_uri=self.websocket_uri.get(),
125
106
  open_config_on_startup=self.open_config_on_startup.get(),
126
- check_for_update_on_startup=self.check_for_update_on_startup.get(),
127
107
  texthook_replacement_regex=self.texthook_replacement_regex.get()
128
108
  ),
129
109
  paths=Paths(
@@ -295,13 +275,6 @@ class ConfigApp:
295
275
  self.add_label_and_increment_row(general_frame, "Whether to open config when the script starts.",
296
276
  row=self.current_row, column=2)
297
277
 
298
- ttk.Label(general_frame, text="Check for Updates On Startup:").grid(row=self.current_row, column=0, sticky='W')
299
- self.check_for_update_on_startup = tk.BooleanVar(value=self.settings.general.check_for_update_on_startup)
300
- ttk.Checkbutton(general_frame, variable=self.check_for_update_on_startup).grid(row=self.current_row, column=1,
301
- sticky='W')
302
- self.add_label_and_increment_row(general_frame, "Always check for Updates On Startup.",
303
- row=self.current_row, column=2)
304
-
305
278
  ttk.Label(general_frame, text="Current Version:").grid(row=self.current_row, column=0, sticky='W')
306
279
  self.current_version = ttk.Label(general_frame, text=get_current_version())
307
280
  self.current_version.grid(row=self.current_row, column=1)
@@ -314,13 +287,6 @@ class ConfigApp:
314
287
  self.add_label_and_increment_row(general_frame, "The latest available version of the application.",
315
288
  row=self.current_row, column=2)
316
289
 
317
- ttk.Button(general_frame, text="Check Update", command=lambda: self.check_update(True)).grid(row=self.current_row, column=0,
318
- pady=5)
319
- ttk.Button(general_frame, text="Update Now", command=self.update_now).grid(row=self.current_row, column=1,
320
- pady=5)
321
- self.add_label_and_increment_row(general_frame, "Check for updates or update to the latest version.",
322
- row=self.current_row, column=2)
323
-
324
290
  # ttk.Label(general_frame, text="Per Scene Config:").grid(row=self.current_row, column=0, sticky='W')
325
291
  # self.per_scene_config = tk.BooleanVar(value=self.master_config.per_scene_config)
326
292
  # ttk.Checkbutton(general_frame, variable=self.per_scene_config).grid(row=self.current_row, column=1,
@@ -41,7 +41,6 @@ class General:
41
41
  use_websocket: bool = True
42
42
  websocket_uri: str = 'localhost:6677'
43
43
  open_config_on_startup: bool = False
44
- check_for_update_on_startup: bool = False
45
44
  texthook_replacement_regex: str = ""
46
45
 
47
46
 
@@ -181,12 +181,13 @@ def trim_audio_based_on_last_line(untrimmed_audio, video_path, game_line, next_l
181
181
  file_length = get_video_duration(video_path)
182
182
  time_delta = file_mod_time - game_line.time
183
183
  # Convert time_delta to FFmpeg-friendly format (HH:MM:SS.milliseconds)
184
- total_seconds = file_length - time_delta.total_seconds() + get_config().audio.beginning_offset
184
+ total_seconds = file_length - time_delta.total_seconds()
185
+ total_seconds_after_offset = total_seconds + get_config().audio.beginning_offset
185
186
  if total_seconds < 0 or total_seconds >= file_length:
186
187
  logger.info(f"0 seconds trimmed off of beginning")
187
188
  return untrimmed_audio
188
189
 
189
- hours, remainder = divmod(total_seconds, 3600)
190
+ hours, remainder = divmod(total_seconds_after_offset, 3600)
190
191
  minutes, seconds = divmod(remainder, 60)
191
192
  start_trim_time = "{:02}:{:02}:{:06.3f}".format(int(hours), int(minutes), seconds)
192
193
 
@@ -210,7 +211,7 @@ def trim_audio_based_on_last_line(untrimmed_audio, video_path, game_line, next_l
210
211
  logger.debug(" ".join(ffmpeg_command))
211
212
  subprocess.run(ffmpeg_command)
212
213
 
213
- logger.info(f"{total_seconds} trimmed off of beginning")
214
+ logger.info(f"{total_seconds_after_offset} trimmed off of beginning")
214
215
 
215
216
  logger.info(f"Audio trimmed and saved to {trimmed_audio}")
216
217
  return trimmed_audio
@@ -156,70 +156,10 @@ def start_text_monitor(send_to_mine_event_bus):
156
156
  text_thread.start()
157
157
 
158
158
 
159
- # def get_line_timing(last_note):
160
- # def similar(a, b):
161
- # return SequenceMatcher(None, a, b).ratio()
162
- #
163
- # if not last_note:
164
- # return current_line_time, 0
165
- #
166
- # lines = line_history.values
167
- #
168
- # line_time = current_line_time
169
- # next_line = 0
170
- # prev_clip_time = 0
171
- #
172
- # try:
173
- # sentence = last_note['fields'][get_config().anki.sentence_field]['value']
174
- # if sentence:
175
- # for line in reversed(lines):
176
- # similarity = similar(remove_html_tags(sentence), line.text)
177
- # if similarity >= 0.60 or line.text in remove_html_tags(sentence): # 80% similarity threshold
178
- # line_time = line.time
179
- # next_line = prev_clip_time
180
- # break
181
- # prev_clip_time = line.time
182
- # except Exception as e:
183
- # logger.error(f"Using Default clipboard/websocket timing - reason: {e}")
184
- #
185
- # return line_time, next_line
186
- #
187
- #
188
- # def get_last_two_sentences(last_note) -> (str, str):
189
- # def similar(a, b):
190
- # return SequenceMatcher(None, a, b).ratio()
191
- #
192
- # lines = line_history.values
193
- #
194
- # if not last_note:
195
- # return lines[-1].text if lines else '', lines[-2].text if len(lines) > 1 else ''
196
- #
197
- # sentence = last_note['fields'][get_config().anki.sentence_field]['value']
198
- # if not sentence:
199
- # return lines[-1].text if lines else '', lines[-2].text if len(lines) > 1 else ''
200
- #
201
- # current, previous = "", ""
202
- # found = False
203
- #
204
- # for line in reversed(lines):
205
- # similarity = similar(remove_html_tags(sentence), line.text)
206
- # logger.debug(f"Comparing: {remove_html_tags(sentence)} with {line.text} - Similarity: {similarity}")
207
- # if found:
208
- # previous = line.text
209
- # break
210
- # if similarity >= 0.60 or line.text in remove_html_tags(sentence):
211
- # found = True
212
- # current = line.text
213
- #
214
- # if not current or not previous:
215
- # logger.debug("Couldn't find lines in history, using last two lines")
216
- # return lines[-1].text if lines else '', lines[-2].text if len(lines) > 1 else ''
217
- #
218
- # return current, previous
219
-
220
159
  def similar(a, b):
221
160
  return SequenceMatcher(None, a, b).ratio()
222
161
 
162
+
223
163
  def get_text_event(last_note) -> GameLine:
224
164
  lines = line_history.values
225
165
 
GameSentenceMiner/gsm.py CHANGED
@@ -463,8 +463,6 @@ def main(reloading=False, do_config_input=True):
463
463
  win32api.SetConsoleCtrlHandler(handle_exit())
464
464
 
465
465
  try:
466
- if get_config().general.check_for_update_on_startup:
467
- root.after(0, settings_window.check_update)
468
466
  if get_config().general.open_config_on_startup:
469
467
  root.after(0, settings_window.show)
470
468
  settings_window.add_save_hook(update_icon)
@@ -1,8 +1,6 @@
1
1
  import os
2
2
  from importlib import metadata
3
- import sys
4
3
 
5
- import pyperclip
6
4
  import requests
7
5
 
8
6
  from GameSentenceMiner.configuration import logger, get_app_directory
@@ -19,12 +19,12 @@ vosk_model = None
19
19
  # Function to download and cache the Vosk model
20
20
  def download_and_cache_vosk_model(model_dir="vosk_model_cache"):
21
21
  # Ensure the cache directory exists
22
- if not os.path.exists(model_dir):
23
- os.makedirs(model_dir)
22
+ if not os.path.exists(os.path.join(get_app_directory(), model_dir)):
23
+ os.makedirs(os.path.join(get_app_directory(), model_dir))
24
24
 
25
25
  # Extract the model name from the URL
26
26
  model_filename = get_config().vad.vosk_url.split("/")[-1]
27
- model_path = os.path.join(model_dir, model_filename)
27
+ model_path = os.path.join(get_app_directory(), model_dir, model_filename)
28
28
 
29
29
  # If the model is already downloaded, skip the download
30
30
  if not os.path.exists(model_path):
@@ -38,7 +38,7 @@ def download_and_cache_vosk_model(model_dir="vosk_model_cache"):
38
38
  logger.info("Download complete.")
39
39
 
40
40
  # Extract the model if it's a zip or tar file
41
- model_extract_path = os.path.join(model_dir, "vosk_model")
41
+ model_extract_path = os.path.join(get_app_directory(), model_dir, "vosk_model")
42
42
  if not os.path.exists(model_extract_path):
43
43
  logger.info("Extracting the Vosk model...")
44
44
  if model_filename.endswith(".zip"):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: GameSentenceMiner
3
- Version: 2.4.2
3
+ Version: 2.4.4
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
@@ -75,7 +75,7 @@ There are settings in GSM that may help accomodate for a poor hook, but if you e
75
75
 
76
76
  ### New Way as of 2.4.0
77
77
 
78
- Grab the latest Installer or Zip from [Releases](https://github.com/bpwhelan/GameSentenceMiner/releases), and then either run the installer or run GameSentenceMiner.exe.
78
+ Grab the latest Installer from [Releases](https://github.com/bpwhelan/GameSentenceMiner/releases).
79
79
 
80
80
  ### Old Way - Will still work for the forseeable future
81
81
 
@@ -1,14 +1,14 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  GameSentenceMiner/anki.py,sha256=QBrA-WVQfK4KjKB2Wm1WDW7BlVy8MF6-1ByTApVzPVA,10576
3
- GameSentenceMiner/config_gui.py,sha256=nk0-aFTrqtygbLOqnQMSUqHQFda4bRhFG18Tz3Ansn4,54215
4
- GameSentenceMiner/configuration.py,sha256=zj3Oi1oRN0oxV_Y1xVbtGdxo0966am13j-cmKS7ezLs,14509
5
- GameSentenceMiner/ffmpeg.py,sha256=4nyl_kdXi_trzDyhhjSmszN0BlFF-McAFyOghvCyl34,11142
6
- GameSentenceMiner/gametext.py,sha256=AkK77s_orZrWYEZEDDN9V8vvwiyt_YKAlWS4hhYXUx4,8928
7
- GameSentenceMiner/gsm.py,sha256=nJa1FdPZOBOWvKRAmkoDcoMKsIVqg9DsjAp6N17Fb80,19448
3
+ GameSentenceMiner/config_gui.py,sha256=RCZJwg5FQpx_J-8jS7v54ivKPBkjicHKpmzN2zh9yAA,51975
4
+ GameSentenceMiner/configuration.py,sha256=fQNBQjmJn2ViBSYMFNuyC5CSklBk0xgMDSXC47CwDe0,14463
5
+ GameSentenceMiner/ffmpeg.py,sha256=P7rTOXYnwg2LWkXqC-pRNhoRIRUEU8EpV8IAfXFcFC4,11215
6
+ GameSentenceMiner/gametext.py,sha256=OA7kLGTYj-GDhumZvzFgzEZ5cDpYHPhTANjUSciOKIY,6753
7
+ GameSentenceMiner/gsm.py,sha256=t6hGJZKfMgiwgYUy7zWHlfmwyyLD-_eOEBeiTPpMFxk,19331
8
8
  GameSentenceMiner/model.py,sha256=oh8VVT8T1UKekbmP6MGNgQ8jIuQ_7Rg4GPzDCn2kJo8,1999
9
9
  GameSentenceMiner/notification.py,sha256=WBaQWoPNhW4XqdPBUmxPBgjk0ngzH_4v9zMQ-XQAKC8,2010
10
10
  GameSentenceMiner/obs.py,sha256=8ImXAVUWa4JdzwcBOEFShlZRZzh1dCvdpD1aEGhQfbU,6566
11
- GameSentenceMiner/package_updater.py,sha256=0uaLAp0WrWqostNTBWRS0laITjI9aN9Yt_6GXosS4NQ,1278
11
+ GameSentenceMiner/package.py,sha256=YlS6QRMuVlm6mdXx0rlXv9_3erTGS21jaP3PNNWfAH0,1250
12
12
  GameSentenceMiner/util.py,sha256=MITweiFYaefWQF5nR8tZ9yE6vd_b-fLuP0MP1Y1U4K0,4720
13
13
  GameSentenceMiner/utility_gui.py,sha256=EtQUnCgTTdzKJE0iCJiHjjc_c6tc7JtI09LRg4_iy8Y,4555
14
14
  GameSentenceMiner/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5FngZ7ILdA_J5TFYAXUQ,15272
@@ -16,11 +16,11 @@ GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
16
16
  GameSentenceMiner/downloader/download_tools.py,sha256=584QVsv-btpJowMRrqSbWpKDCMhInQM0iGe-Yw0Q2p0,6298
17
17
  GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  GameSentenceMiner/vad/silero_trim.py,sha256=syDJX_KbFmdyFFtnQqYTD0tICsUCJizYhs-atPgXtxA,1549
19
- GameSentenceMiner/vad/vosk_helper.py,sha256=-AAwK0cgOC5rK3_gL0sQgrPJ75E49g_PxZR4d5ckwc4,5826
19
+ GameSentenceMiner/vad/vosk_helper.py,sha256=HifeXKbEMrs81ZuuGxS67yAghu8TMXUP6Oan9i9dTxw,5938
20
20
  GameSentenceMiner/vad/whisper_helper.py,sha256=bpR1HVnJRn9H5u8XaHBqBJ6JwIjzqn-Fajps8QmQ4zc,3411
21
- gamesentenceminer-2.4.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
22
- gamesentenceminer-2.4.2.dist-info/METADATA,sha256=a82JB-lTRQd-1RgBAfITMu9TEQKhIICXqZxzwmTK7Ls,10395
23
- gamesentenceminer-2.4.2.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
24
- gamesentenceminer-2.4.2.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
25
- gamesentenceminer-2.4.2.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
26
- gamesentenceminer-2.4.2.dist-info/RECORD,,
21
+ gamesentenceminer-2.4.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
22
+ gamesentenceminer-2.4.4.dist-info/METADATA,sha256=tjgtg86q80_uZz6ZDFx90kN0r-RfB9PEbENBSEVp8wg,10324
23
+ gamesentenceminer-2.4.4.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
24
+ gamesentenceminer-2.4.4.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
25
+ gamesentenceminer-2.4.4.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
26
+ gamesentenceminer-2.4.4.dist-info/RECORD,,