GameSentenceMiner 2.5.10__py3-none-any.whl → 2.5.11__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/gsm.py +34 -27
- {gamesentenceminer-2.5.10.dist-info → gamesentenceminer-2.5.11.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.5.10.dist-info → gamesentenceminer-2.5.11.dist-info}/RECORD +7 -7
- {gamesentenceminer-2.5.10.dist-info → gamesentenceminer-2.5.11.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.5.10.dist-info → gamesentenceminer-2.5.11.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.5.10.dist-info → gamesentenceminer-2.5.11.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.5.10.dist-info → gamesentenceminer-2.5.11.dist-info}/top_level.txt +0 -0
GameSentenceMiner/gsm.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import os.path
|
1
2
|
import signal
|
2
3
|
import time
|
3
4
|
from subprocess import Popen
|
@@ -71,21 +72,27 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
71
72
|
|
72
73
|
@staticmethod
|
73
74
|
def convert_to_audio(video_path):
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
try:
|
76
|
+
if get_utility_window().line_for_audio:
|
77
|
+
line: GameLine = get_utility_window().line_for_audio
|
78
|
+
get_utility_window().line_for_audio = None
|
79
|
+
if get_config().advanced.audio_player_path:
|
80
|
+
audio = VideoToAudioHandler.get_audio(line, line.next.time if line.next else None, video_path, temporary=True)
|
81
|
+
play_audio_in_external(audio)
|
82
|
+
os.remove(video_path)
|
83
|
+
elif get_config().advanced.video_player_path:
|
84
|
+
play_video_in_external(line, video_path)
|
85
|
+
return
|
86
|
+
if get_utility_window().line_for_screenshot:
|
87
|
+
line: GameLine = get_utility_window().line_for_screenshot
|
88
|
+
get_utility_window().line_for_screenshot = None
|
89
|
+
screenshot = ffmpeg.get_screenshot_for_line(video_path, line)
|
90
|
+
os.startfile(screenshot)
|
80
91
|
os.remove(video_path)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
line: GameLine = get_utility_window().line_for_screenshot
|
86
|
-
get_utility_window().line_for_screenshot = None
|
87
|
-
screenshot = ffmpeg.get_screenshot_for_line(video_path, line)
|
88
|
-
os.startfile(screenshot)
|
92
|
+
return
|
93
|
+
except Exception as e:
|
94
|
+
logger.error(f"Error Playing Audio/Video: {e}")
|
95
|
+
logger.debug(f"Error Playing Audio/Video: {e}", exc_info=True)
|
89
96
|
os.remove(video_path)
|
90
97
|
return
|
91
98
|
try:
|
@@ -158,10 +165,11 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
158
165
|
logger.error(f"Failed Processing and/or adding to Anki: Reason {e}")
|
159
166
|
logger.debug(f"Some error was hit catching to allow further work to be done: {e}", exc_info=True)
|
160
167
|
notification.send_error_no_anki_update()
|
161
|
-
|
162
|
-
os.
|
163
|
-
|
164
|
-
os.
|
168
|
+
finally:
|
169
|
+
if get_config().paths.remove_video and os.path.exists(video_path):
|
170
|
+
os.remove(video_path) # Optionally remove the video after conversion
|
171
|
+
if get_config().paths.remove_audio and os.path.exists(vad_trimmed_audio):
|
172
|
+
os.remove(vad_trimmed_audio) # Optionally remove the screenshot after conversion
|
165
173
|
|
166
174
|
|
167
175
|
@staticmethod
|
@@ -228,18 +236,17 @@ def play_video_in_external(line, filepath):
|
|
228
236
|
|
229
237
|
start, _, _ = get_video_timings(filepath, line)
|
230
238
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
command.append(
|
237
|
-
|
238
|
-
command.extend([convert_to_vlc_seconds(start), os.path.normpath(filepath)])
|
239
|
+
if start:
|
240
|
+
if "vlc" in get_config().advanced.video_player_path:
|
241
|
+
command.append("--start-time")
|
242
|
+
else:
|
243
|
+
command.append("--start")
|
244
|
+
command.append(convert_to_vlc_seconds(start))
|
245
|
+
command.append(os.path.normpath(filepath))
|
239
246
|
|
240
247
|
try:
|
241
248
|
proc = subprocess.Popen(command)
|
242
|
-
print(f"Opened {filepath} in
|
249
|
+
print(f"Opened {filepath} in {get_config().advanced.video_player_path}.")
|
243
250
|
threading.Thread(target=remove_video_when_closed, args=(proc, filepath)).start()
|
244
251
|
except FileNotFoundError:
|
245
252
|
print("VLC not found. Make sure it's installed and in your PATH.")
|
@@ -4,7 +4,7 @@ GameSentenceMiner/config_gui.py,sha256=v4XRxGqRddqCrdv1UHu4Gnp7aMjL-CCCHBFlTy1Y2
|
|
4
4
|
GameSentenceMiner/configuration.py,sha256=DXlwEV4A7X3yzVV6UomY2jmmYAZx_jjMRxZeweoCtRE,20149
|
5
5
|
GameSentenceMiner/ffmpeg.py,sha256=fzOxrn-a4KqFdUY2oove164CTDOSsdPQtzqRW5f1P7c,12002
|
6
6
|
GameSentenceMiner/gametext.py,sha256=LORVdE2WEo1CDI8gonc7qxrhbS4KFKXFQVKjhlkpLbc,7368
|
7
|
-
GameSentenceMiner/gsm.py,sha256=
|
7
|
+
GameSentenceMiner/gsm.py,sha256=XZLc_HwA8Zzxas0M0oFYbjRwgXa7OLPhT2QXhoiUVzQ,25125
|
8
8
|
GameSentenceMiner/model.py,sha256=JdnkT4VoPOXmOpRgFdvERZ09c9wLN6tUJxdrKlGZcqo,5305
|
9
9
|
GameSentenceMiner/notification.py,sha256=FY39ChSRK0Y8TQ6lBGsLnpZUFPtFpSy2tweeXVoV7kc,2809
|
10
10
|
GameSentenceMiner/obs.py,sha256=EcgQ0VdeYXGeXCyvk8mBiHBL-HHai037BoCXomH9ge4,8239
|
@@ -21,9 +21,9 @@ GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
21
21
|
GameSentenceMiner/vad/silero_trim.py,sha256=-thDIZLuTLra3YBj7WR16Z6JeDgSpge2YuahprBvD8I,1585
|
22
22
|
GameSentenceMiner/vad/vosk_helper.py,sha256=BI_mg_qyrjNbuEJjXSUDoV0FWEtQtEOAPmrrNixnZ_8,5974
|
23
23
|
GameSentenceMiner/vad/whisper_helper.py,sha256=OF4J8TPPoKPJR1uFwrWAZ2Q7v0HJkVvNGmF8l1tACX0,3447
|
24
|
-
gamesentenceminer-2.5.
|
25
|
-
gamesentenceminer-2.5.
|
26
|
-
gamesentenceminer-2.5.
|
27
|
-
gamesentenceminer-2.5.
|
28
|
-
gamesentenceminer-2.5.
|
29
|
-
gamesentenceminer-2.5.
|
24
|
+
gamesentenceminer-2.5.11.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
25
|
+
gamesentenceminer-2.5.11.dist-info/METADATA,sha256=7yFwFF9yNCL_KdU8_aYpg6BeWpiQKBjWD1sm6Scl9UI,5436
|
26
|
+
gamesentenceminer-2.5.11.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
27
|
+
gamesentenceminer-2.5.11.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
28
|
+
gamesentenceminer-2.5.11.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
29
|
+
gamesentenceminer-2.5.11.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|