GameSentenceMiner 2.10.0__py3-none-any.whl → 2.10.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.
- GameSentenceMiner/anki.py +7 -5
- GameSentenceMiner/gsm.py +9 -2
- GameSentenceMiner/util/gsm_utils.py +8 -4
- GameSentenceMiner/web/service.py +10 -7
- {gamesentenceminer-2.10.0.dist-info → gamesentenceminer-2.10.1.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.10.0.dist-info → gamesentenceminer-2.10.1.dist-info}/RECORD +10 -10
- {gamesentenceminer-2.10.0.dist-info → gamesentenceminer-2.10.1.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.10.0.dist-info → gamesentenceminer-2.10.1.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.10.0.dist-info → gamesentenceminer-2.10.1.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.10.0.dist-info → gamesentenceminer-2.10.1.dist-info}/top_level.txt +0 -0
GameSentenceMiner/anki.py
CHANGED
@@ -261,11 +261,13 @@ def get_cards_by_sentence(sentence):
|
|
261
261
|
logger.warning(f'Found more than 1, and not updating cards for query: \n{query}')
|
262
262
|
return {}
|
263
263
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
264
|
+
card_dict = invoke('notesInfo', notes=[card_ids[-1]])[0]
|
265
|
+
try:
|
266
|
+
return AnkiCard.from_dict(card_dict)
|
267
|
+
except Exception as e:
|
268
|
+
logger.error(f"Error fetching last card: {e}")
|
269
|
+
logger.info(card_dict)
|
270
|
+
raise e
|
269
271
|
|
270
272
|
last_connection_error = datetime.now()
|
271
273
|
|
GameSentenceMiner/gsm.py
CHANGED
@@ -80,6 +80,9 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
80
80
|
vad_trimmed_audio = ''
|
81
81
|
final_audio_output = ''
|
82
82
|
skip_delete = False
|
83
|
+
selected_lines = []
|
84
|
+
anki_card_creation_time = None
|
85
|
+
mined_line = None
|
83
86
|
gsm_state.previous_replay = video_path
|
84
87
|
if gsm_state.line_for_audio or gsm_state.line_for_screenshot:
|
85
88
|
handle_texthooker_button(video_path, get_audio_from_video=VideoToAudioHandler.get_audio)
|
@@ -87,6 +90,8 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
87
90
|
try:
|
88
91
|
if anki.card_queue and len(anki.card_queue) > 0:
|
89
92
|
last_note, anki_card_creation_time, selected_lines = anki.card_queue.pop(0)
|
93
|
+
elif get_config().features.backfill_audio:
|
94
|
+
last_note = anki.get_cards_by_sentence(gametext.current_line_after_regex)
|
90
95
|
else:
|
91
96
|
logger.info("Replay buffer initiated externally. Skipping processing.")
|
92
97
|
skip_delete = True
|
@@ -103,8 +108,9 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
103
108
|
logger.error(
|
104
109
|
f"Video was unusually small, potentially empty! Check OBS for Correct Scene Settings! Path: {video_path}")
|
105
110
|
return
|
111
|
+
|
112
|
+
# Just for safety
|
106
113
|
if not last_note:
|
107
|
-
logger.debug("Attempting to get last anki card")
|
108
114
|
if get_config().anki.update_anki:
|
109
115
|
last_note = anki.get_last_anki_card()
|
110
116
|
if get_config().features.backfill_audio:
|
@@ -165,7 +171,8 @@ class VideoToAudioHandler(FileSystemEventHandler):
|
|
165
171
|
elif get_config().features.notify_on_update and vad_result.success:
|
166
172
|
notification.send_audio_generated_notification(vad_trimmed_audio)
|
167
173
|
except Exception as e:
|
168
|
-
|
174
|
+
if mined_line:
|
175
|
+
anki_results[mined_line.id] = AnkiUpdateResult.failure()
|
169
176
|
logger.error(f"Failed Processing and/or adding to Anki: Reason {e}")
|
170
177
|
logger.debug(f"Some error was hit catching to allow further work to be done: {e}", exc_info=True)
|
171
178
|
notification.send_error_no_anki_update()
|
@@ -223,10 +223,14 @@ def do_text_replacements(text, replacements_json):
|
|
223
223
|
|
224
224
|
def open_audio_in_external(fileabspath, shell=False):
|
225
225
|
logger.info(f"Opening audio in external program...")
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
226
|
+
try:
|
227
|
+
if shell:
|
228
|
+
subprocess.Popen(f' "{get_config().audio.external_tool}" "{fileabspath}" ', shell=True)
|
229
|
+
else:
|
230
|
+
subprocess.Popen([get_config().audio.external_tool, fileabspath])
|
231
|
+
except Exception as e:
|
232
|
+
logger.error(f"Failed to open audio in external program: {e}")
|
233
|
+
return False
|
230
234
|
|
231
235
|
def is_connected():
|
232
236
|
try:
|
GameSentenceMiner/web/service.py
CHANGED
@@ -23,8 +23,10 @@ def handle_texthooker_button(video_path='', get_audio_from_video=None):
|
|
23
23
|
elif get_config().advanced.video_player_path:
|
24
24
|
play_video_in_external(line, gsm_state.previous_audio)
|
25
25
|
else:
|
26
|
-
|
27
|
-
|
26
|
+
import sounddevice as sd
|
27
|
+
data, samplerate = gsm_state.previous_audio
|
28
|
+
sd.play(data, samplerate)
|
29
|
+
sd.wait()
|
28
30
|
return
|
29
31
|
gsm_state.previous_line_for_audio = line
|
30
32
|
if get_config().advanced.audio_player_path:
|
@@ -37,13 +39,14 @@ def handle_texthooker_button(video_path='', get_audio_from_video=None):
|
|
37
39
|
gsm_state.previous_audio = new_video_path
|
38
40
|
gsm_state.previous_replay = new_video_path
|
39
41
|
else:
|
40
|
-
import
|
42
|
+
import sounddevice as sd
|
43
|
+
import soundfile as sf
|
41
44
|
audio = get_audio_from_video(line, line.next.time if line.next else None, video_path,
|
42
45
|
temporary=True)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
gsm_state.previous_audio =
|
46
|
+
data, samplerate = sf.read(audio)
|
47
|
+
sd.play(data, samplerate)
|
48
|
+
sd.wait()
|
49
|
+
gsm_state.previous_audio = (data, samplerate)
|
47
50
|
return
|
48
51
|
if gsm_state.line_for_screenshot:
|
49
52
|
line: GameLine = gsm_state.line_for_screenshot
|
@@ -1,8 +1,8 @@
|
|
1
1
|
GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
GameSentenceMiner/anki.py,sha256=
|
2
|
+
GameSentenceMiner/anki.py,sha256=0Y_LwTLpRBEt0HKu1o-6FqHbEJt3WWuOjFYehzMczz0,16492
|
3
3
|
GameSentenceMiner/config_gui.py,sha256=OqXEyWNlWwlBBxaDP4Iu-tN6FQHKVVcp4t239dGpylc,89688
|
4
4
|
GameSentenceMiner/gametext.py,sha256=6VkjmBeiuZfPk8T6PHFdIAElBH2Y_oLVYvmcafqN7RM,6747
|
5
|
-
GameSentenceMiner/gsm.py,sha256=
|
5
|
+
GameSentenceMiner/gsm.py,sha256=XqzotCtGDo6ZVUW0nXxCjDr79IJJeYWYnXY3P575qjA,24533
|
6
6
|
GameSentenceMiner/obs.py,sha256=YG8LwBf9BTsGbROm_Uq6LhFDSrbf3jgogp78rBbJq94,14728
|
7
7
|
GameSentenceMiner/vad.py,sha256=G0NkaWFJaIfKQAV7LOFxyKoih7pPNYHDuy4SzeFVCkI,16389
|
8
8
|
GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -33,7 +33,7 @@ GameSentenceMiner/util/audio_offset_selector.py,sha256=8EM5sueNBrJGNjQ_F4TzwpkTA
|
|
33
33
|
GameSentenceMiner/util/configuration.py,sha256=ibwIJlfhzjmlQJLhwnrcRJ7jImPN5S-pw62wa2eBZWo,28538
|
34
34
|
GameSentenceMiner/util/electron_config.py,sha256=3VmIrcXhC-wIMMc4uqV85NrNenRl4ZUbnQfSjWEwuig,9852
|
35
35
|
GameSentenceMiner/util/ffmpeg.py,sha256=t0tflxq170n8PZKkdw8fTZIUQfXD0p_qARa9JTdhBTc,21530
|
36
|
-
GameSentenceMiner/util/gsm_utils.py,sha256=
|
36
|
+
GameSentenceMiner/util/gsm_utils.py,sha256=gOf9bq0eMhzA8Ww3lkjCA4RVrnz2mZ5zGvKnwSrCeMk,11492
|
37
37
|
GameSentenceMiner/util/model.py,sha256=ROH-uO55im7H4COonyyPZQ8l9-8EPtyOk7l_DNEonbk,6630
|
38
38
|
GameSentenceMiner/util/notification.py,sha256=0OnEYjn3DUEZ6c6OtPjdVZe-DG-QSoMAl9fetjjCvNU,3874
|
39
39
|
GameSentenceMiner/util/package.py,sha256=u1ym5z869lw5EHvIviC9h9uH97bzUXSXXA8KIn8rUvk,1157
|
@@ -47,7 +47,7 @@ GameSentenceMiner/util/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
47
47
|
GameSentenceMiner/util/downloader/download_tools.py,sha256=mvnOjDHFlV1AbjHaNI7mdnC5_CH5k3N4n1ezqzzbzGA,8139
|
48
48
|
GameSentenceMiner/util/downloader/oneocr_dl.py,sha256=w7WbPad2LTuz3TAKtJlrslLQlUe-gJMQfOnDwmO98h4,10341
|
49
49
|
GameSentenceMiner/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
50
|
-
GameSentenceMiner/web/service.py,sha256=
|
50
|
+
GameSentenceMiner/web/service.py,sha256=2o62dZfDSBxBH5zCjrcHCX5yAc3PmGeP2lr07n8-dgo,5779
|
51
51
|
GameSentenceMiner/web/texthooking_page.py,sha256=4qIimQggb-RUtDsD2wpRYrXmAj7jfsQVGYCXRv44dRA,15370
|
52
52
|
GameSentenceMiner/web/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
53
53
|
GameSentenceMiner/web/static/apple-touch-icon.png,sha256=OcMI8af_68DA_tweOsQ5LytTyMwm7-hPW07IfrOVgEs,46132
|
@@ -62,9 +62,9 @@ GameSentenceMiner/web/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
|
|
62
62
|
GameSentenceMiner/web/templates/index.html,sha256=HZKiIjiGJV8PGQ9T2aLDUNSfJn71qOwbYCjbRuSIjpY,213583
|
63
63
|
GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
|
64
64
|
GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
|
65
|
-
gamesentenceminer-2.10.
|
66
|
-
gamesentenceminer-2.10.
|
67
|
-
gamesentenceminer-2.10.
|
68
|
-
gamesentenceminer-2.10.
|
69
|
-
gamesentenceminer-2.10.
|
70
|
-
gamesentenceminer-2.10.
|
65
|
+
gamesentenceminer-2.10.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
66
|
+
gamesentenceminer-2.10.1.dist-info/METADATA,sha256=cAkY5IlGPKd0CZlbZqOzUh1xglt-gDTO0KtsBkoKirs,7354
|
67
|
+
gamesentenceminer-2.10.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
68
|
+
gamesentenceminer-2.10.1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
69
|
+
gamesentenceminer-2.10.1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
70
|
+
gamesentenceminer-2.10.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|