GameSentenceMiner 2.5.12__py3-none-any.whl → 2.5.13__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 CHANGED
@@ -32,8 +32,9 @@ def update_anki_card(last_note: AnkiCard, note=None, audio_path='', video_path='
32
32
  global audio_in_anki, screenshot_in_anki, prev_screenshot_in_anki
33
33
  update_audio = should_update_audio and (get_config().anki.sentence_audio_field and not
34
34
  last_note.get_field(get_config().anki.sentence_audio_field) or get_config().anki.overwrite_audio)
35
- update_picture = (get_config().anki.picture_field and get_config().anki.overwrite_picture) or not \
36
- last_note.get_field(get_config().anki.picture_field)
35
+ update_picture = (get_config().anki.picture_field and get_config().screenshot.enabled
36
+ and (get_config().anki.overwrite_picture or not last_note.get_field(get_config().anki.picture_field)))
37
+
37
38
 
38
39
  if not reuse_audio:
39
40
  if update_audio:
@@ -54,11 +55,13 @@ def update_anki_card(last_note: AnkiCard, note=None, audio_path='', video_path='
54
55
 
55
56
  # note = {'id': last_note.noteId, 'fields': {}}
56
57
 
57
- if update_audio:
58
+ if update_audio and audio_in_anki:
58
59
  note['fields'][get_config().anki.sentence_audio_field] = audio_html
59
60
 
60
- if update_picture:
61
+ if update_picture and screenshot_in_anki:
61
62
  note['fields'][get_config().anki.picture_field] = image_html
63
+ if not get_config().screenshot.enabled:
64
+ logger.info("Skipping Adding Screenshot to Anki, Screenshot is disabled in settings")
62
65
 
63
66
  if prev_screenshot_in_anki:
64
67
  note['fields'][get_config().anki.previous_image_field] = prev_screenshot_html
@@ -82,7 +85,7 @@ def update_anki_card(last_note: AnkiCard, note=None, audio_path='', video_path='
82
85
  if get_config().features.open_anki_edit:
83
86
  notification.open_anki_card(last_note.noteId)
84
87
 
85
- if get_config().audio.external_tool:
88
+ if get_config().audio.external_tool and get_config().audio.external_tool_enabled and update_audio:
86
89
  open_audio_in_external(f"{get_config().audio.anki_media_collection}/{audio_in_anki}")
87
90
 
88
91
 
@@ -147,6 +147,7 @@ class ConfigApp:
147
147
  backfill_audio=self.backfill_audio.get()
148
148
  ),
149
149
  screenshot=Screenshot(
150
+ enabled=self.screenshot_enabled.get(),
150
151
  width=self.screenshot_width.get(),
151
152
  height=self.screenshot_height.get(),
152
153
  quality=self.screenshot_quality.get(),
@@ -157,12 +158,14 @@ class ConfigApp:
157
158
  use_beginning_of_line_as_screenshot=self.use_beginning_of_line_as_screenshot.get()
158
159
  ),
159
160
  audio=Audio(
161
+ enabled=self.audio_enabled.get(),
160
162
  extension=self.audio_extension.get(),
161
163
  beginning_offset=float(self.beginning_offset.get()),
162
164
  end_offset=float(self.end_offset.get()),
163
165
  ffmpeg_reencode_options=self.ffmpeg_reencode_options.get(),
164
166
  external_tool = self.external_tool.get(),
165
167
  anki_media_collection=self.anki_media_collection.get(),
168
+ external_tool_enabled=self.external_tool_enabled.get(),
166
169
  ),
167
170
  obs=OBS(
168
171
  enabled=self.obs_enabled.get(),
@@ -171,7 +174,6 @@ class ConfigApp:
171
174
  host=self.obs_host.get(),
172
175
  port=int(self.obs_port.get()),
173
176
  password=self.obs_password.get(),
174
- start_buffer=self.obs_start_buffer.get(),
175
177
  get_game_from_scene=self.get_game_from_scene_name.get(),
176
178
  minimum_replay_size=int(self.minimum_replay_size.get())
177
179
  ),
@@ -679,6 +681,11 @@ class ConfigApp:
679
681
  screenshot_frame = ttk.Frame(self.notebook)
680
682
  self.notebook.add(screenshot_frame, text='Screenshot')
681
683
 
684
+ ttk.Label(screenshot_frame, text="Enabled:").grid(row=self.current_row, column=0, sticky='W')
685
+ self.screenshot_enabled = tk.BooleanVar(value=self.settings.screenshot.enabled)
686
+ ttk.Checkbutton(screenshot_frame, variable=self.screenshot_enabled).grid(row=self.current_row, column=1, sticky='W')
687
+ self.add_label_and_increment_row(screenshot_frame, "Enable or disable screenshot processing.", row=self.current_row, column=2)
688
+
682
689
  ttk.Label(screenshot_frame, text="Width:").grid(row=self.current_row, column=0, sticky='W')
683
690
  self.screenshot_width = ttk.Entry(screenshot_frame)
684
691
  self.screenshot_width.insert(0, str(self.settings.screenshot.width))
@@ -737,6 +744,11 @@ class ConfigApp:
737
744
  audio_frame = ttk.Frame(self.notebook)
738
745
  self.notebook.add(audio_frame, text='Audio')
739
746
 
747
+ ttk.Label(audio_frame, text="Enabled:").grid(row=self.current_row, column=0, sticky='W')
748
+ self.audio_enabled = tk.BooleanVar(value=self.settings.audio.enabled)
749
+ ttk.Checkbutton(audio_frame, variable=self.audio_enabled).grid(row=self.current_row, column=1, sticky='W')
750
+ self.add_label_and_increment_row(audio_frame, "Enable or disable audio processing.", row=self.current_row, column=2)
751
+
740
752
  ttk.Label(audio_frame, text="Audio Extension:").grid(row=self.current_row, column=0, sticky='W')
741
753
  self.audio_extension = ttk.Combobox(audio_frame, values=['opus', 'mp3', 'ogg', 'aac', 'm4a'])
742
754
  self.audio_extension.insert(0, self.settings.audio.extension)
@@ -777,10 +789,13 @@ class ConfigApp:
777
789
  self.external_tool = ttk.Entry(audio_frame)
778
790
  self.external_tool.insert(0, self.settings.audio.external_tool)
779
791
  self.external_tool.grid(row=self.current_row, column=1)
792
+ ttk.Label(audio_frame, text="Enabled:").grid(row=self.current_row, column=2, sticky='W')
793
+ self.external_tool_enabled = tk.BooleanVar(value=self.settings.audio.external_tool_enabled)
794
+ ttk.Checkbutton(audio_frame, variable=self.external_tool_enabled).grid(row=self.current_row, column=3, sticky='W')
780
795
  self.add_label_and_increment_row(audio_frame,
781
796
  "Path to External tool that opens the audio up for manual trimming. I recommend OcenAudio for in-place Editing.",
782
797
  row=self.current_row,
783
- column=2)
798
+ column=4)
784
799
 
785
800
  ttk.Button(audio_frame, text="Install Ocenaudio", command=self.download_and_install_ocen).grid(
786
801
  row=self.current_row, column=0, pady=5)
@@ -98,6 +98,7 @@ class Features:
98
98
  @dataclass_json
99
99
  @dataclass
100
100
  class Screenshot:
101
+ enabled: bool = True
101
102
  width: str = 0
102
103
  height: str = 0
103
104
  quality: str = 85
@@ -111,12 +112,14 @@ class Screenshot:
111
112
  @dataclass_json
112
113
  @dataclass
113
114
  class Audio:
115
+ enabled: bool = True
114
116
  extension: str = 'opus'
115
117
  beginning_offset: float = 0.0
116
118
  end_offset: float = 0.5
117
119
  ffmpeg_reencode_options: str = ''
118
120
  external_tool: str = ""
119
121
  anki_media_collection: str = ""
122
+ external_tool_enabled: bool = True
120
123
 
121
124
 
122
125
  @dataclass_json
GameSentenceMiner/gsm.py CHANGED
@@ -125,7 +125,7 @@ class VideoToAudioHandler(FileSystemEventHandler):
125
125
  tango = last_note.get_field(get_config().anki.word_field) if last_note else ''
126
126
  get_utility_window().reset_checkboxes()
127
127
 
128
- if get_config().anki.sentence_audio_field:
128
+ if get_config().anki.sentence_audio_field and get_config().audio.enabled:
129
129
  logger.debug("Attempting to get audio from video")
130
130
  final_audio_output, should_update_audio, vad_trimmed_audio = VideoToAudioHandler.get_audio(
131
131
  start_line,
@@ -135,7 +135,10 @@ class VideoToAudioHandler(FileSystemEventHandler):
135
135
  final_audio_output = ""
136
136
  should_update_audio = False
137
137
  vad_trimmed_audio = ""
138
- logger.info("No SentenceAudio Field in config, skipping audio processing!")
138
+ if not get_config().audio.enabled:
139
+ logger.info("Audio is disabled in config, skipping audio processing!")
140
+ elif not get_config().anki.sentence_audio_field:
141
+ logger.info("No SentenceAudio Field in config, skipping audio processing!")
139
142
  if get_config().anki.update_anki and last_note:
140
143
  anki.update_anki_card(last_note, note, audio_path=final_audio_output, video_path=video_path,
141
144
  tango=tango,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.5.12
3
+ Version: 2.5.13
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
@@ -1,10 +1,10 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- GameSentenceMiner/anki.py,sha256=kMl-VvBkT_VtEjfTjliIHLGZwrJhHzTT1lRQ6qCdtYw,13062
3
- GameSentenceMiner/config_gui.py,sha256=9w7qXuGwt2lMTo4xXwuZKZyaLCoXBvzIDxSMrJzsUi8,60787
4
- GameSentenceMiner/configuration.py,sha256=u6Jm-Ox7PSZ1Cf5_AkV6hvQInayq7jXjLduf1eMK7Rc,20119
2
+ GameSentenceMiner/anki.py,sha256=FHm76i7WYEs--szhzZjz0B6DW4JuDQopmjR3RjYBogs,13358
3
+ GameSentenceMiner/config_gui.py,sha256=WVSN239lyVm5GwKzE1HXiCSCu2CNpkcDm8TGKlTJpMc,62093
4
+ GameSentenceMiner/configuration.py,sha256=_lxd1x78NX7tktt6RU7nhO4zkKzSoNKFQ-0r1zwNilU,20208
5
5
  GameSentenceMiner/ffmpeg.py,sha256=fzOxrn-a4KqFdUY2oove164CTDOSsdPQtzqRW5f1P7c,12002
6
6
  GameSentenceMiner/gametext.py,sha256=LORVdE2WEo1CDI8gonc7qxrhbS4KFKXFQVKjhlkpLbc,7368
7
- GameSentenceMiner/gsm.py,sha256=H6kG2HerHhY37jXWGoQCLWjtzOoxAU_tAJ4RY9pAWbc,23970
7
+ GameSentenceMiner/gsm.py,sha256=OHOoO0U-YMjLnMvwG9zg63jDTcXLg-rG90Cw27l5yBo,24224
8
8
  GameSentenceMiner/model.py,sha256=JdnkT4VoPOXmOpRgFdvERZ09c9wLN6tUJxdrKlGZcqo,5305
9
9
  GameSentenceMiner/notification.py,sha256=FY39ChSRK0Y8TQ6lBGsLnpZUFPtFpSy2tweeXVoV7kc,2809
10
10
  GameSentenceMiner/obs.py,sha256=MlxRToq5wALPI1XrD8rxEU-N8mWII91cNJWY7rUa5uI,7642
@@ -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.12.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
25
- gamesentenceminer-2.5.12.dist-info/METADATA,sha256=iibLRrqHFjwy-4U4_j1JhHB3USB-W8CR0AMpW_JneF0,5433
26
- gamesentenceminer-2.5.12.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
- gamesentenceminer-2.5.12.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
28
- gamesentenceminer-2.5.12.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
29
- gamesentenceminer-2.5.12.dist-info/RECORD,,
24
+ gamesentenceminer-2.5.13.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
25
+ gamesentenceminer-2.5.13.dist-info/METADATA,sha256=WpCjip7e_2FhZIkC9bEgZhknsc9qjoAhZDw5Q8Tq0Uw,5433
26
+ gamesentenceminer-2.5.13.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
27
+ gamesentenceminer-2.5.13.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
28
+ gamesentenceminer-2.5.13.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
29
+ gamesentenceminer-2.5.13.dist-info/RECORD,,