GameSentenceMiner 2.19.16__py3-none-any.whl → 2.19.17__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 CHANGED
@@ -13,6 +13,8 @@ def handle_error_in_initialization(e):
13
13
  sys.exit(1)
14
14
 
15
15
  Icon = None
16
+ Menu = None
17
+ MenuItem = None
16
18
 
17
19
  try:
18
20
  import GameSentenceMiner.util.configuration
@@ -41,7 +43,7 @@ try:
41
43
  from PIL import Image
42
44
  try:
43
45
  pass
44
- # from pystray import Icon, Menu, MenuItem
46
+ from pystray import Icon, Menu, MenuItem
45
47
  except Exception:
46
48
  logger.warning("pystray not installed correctly, tray icon will not work.")
47
49
  from watchdog.events import FileSystemEventHandler
@@ -228,9 +228,19 @@ def get_screenshot(video_file, screenshot_timing, try_selector=False):
228
228
  output_image = make_unique_file_name(os.path.join(
229
229
  get_temporary_directory(), f"{obs.get_current_game(sanitize=True)}.{get_config().screenshot.extension}"))
230
230
 
231
+ pre_input_args = []
232
+ pre_input_args_string = ""
233
+ if get_config().screenshot.custom_ffmpeg_settings:
234
+ if '-hwaccel' in get_config().screenshot.custom_ffmpeg_settings:
235
+ hwaccel_args = get_config().screenshot.custom_ffmpeg_settings.split(" ")
236
+ hwaccel_index = hwaccel_args.index('-hwaccel')
237
+ pre_input_args.extend(hwaccel_args[hwaccel_index:hwaccel_index + 2])
238
+ pre_input_args_string = " ".join(pre_input_args)
239
+
231
240
  # Base command for extracting the frame
232
241
  ffmpeg_command = ffmpeg_base_command_list + [
233
242
  "-ss", f"{screenshot_timing}",
243
+ ] + pre_input_args + [
234
244
  "-i", f"{video_file}",
235
245
  "-vframes", "1" # Extract only one frame
236
246
  ]
@@ -252,7 +262,7 @@ def get_screenshot(video_file, screenshot_timing, try_selector=False):
252
262
  ffmpeg_command.extend(["-vf", ",".join(video_filters)])
253
263
 
254
264
  if get_config().screenshot.custom_ffmpeg_settings:
255
- ffmpeg_command.extend(get_config().screenshot.custom_ffmpeg_settings.replace("\"", "").split(" "))
265
+ ffmpeg_command.extend(get_config().screenshot.custom_ffmpeg_settings.replace("\"", "").replace(pre_input_args_string, "").split())
256
266
  else:
257
267
  # Ensure quality settings are strings
258
268
  ffmpeg_command.extend(["-compression_level", "6", "-q:v", str(get_config().screenshot.quality)])
@@ -598,14 +608,23 @@ def get_screenshot_time(video_path, game_line, default_beginning=False, vad_resu
598
608
  def process_image(image_file):
599
609
  output_image = make_unique_file_name(
600
610
  os.path.join(get_temporary_directory(), f"{obs.get_current_game(sanitize=True)}.{get_config().screenshot.extension}"))
611
+
612
+ pre_input_args = []
613
+ pre_input_args_string = ""
614
+ if get_config().screenshot.custom_ffmpeg_settings:
615
+ if '-hwaccel' in get_config().screenshot.custom_ffmpeg_settings:
616
+ hwaccel_args = get_config().screenshot.custom_ffmpeg_settings.split()
617
+ hwaccel_index = hwaccel_args.index('-hwaccel')
618
+ pre_input_args.extend(hwaccel_args[hwaccel_index:hwaccel_index + 2])
619
+ pre_input_args_string = " ".join(pre_input_args)
601
620
 
602
621
  # FFmpeg command to process the input image
603
- ffmpeg_command = ffmpeg_base_command_list + [
622
+ ffmpeg_command = ffmpeg_base_command_list + pre_input_args + [
604
623
  "-i", image_file
605
624
  ]
606
625
 
607
626
  if get_config().screenshot.custom_ffmpeg_settings:
608
- ffmpeg_command.extend(get_config().screenshot.custom_ffmpeg_settings.split(" "))
627
+ ffmpeg_command.extend(get_config().screenshot.custom_ffmpeg_settings.replace(pre_input_args_string, "").split())
609
628
  else:
610
629
  ffmpeg_command.extend(["-compression_level", "6", "-q:v", get_config().screenshot.quality])
611
630
 
@@ -769,7 +788,7 @@ def reencode_file_with_user_config(input_file, final_output_audio, user_ffmpeg_o
769
788
  command = ffmpeg_base_command_list + [
770
789
  "-i", input_file,
771
790
  "-map", "0:a"
772
- ] + user_ffmpeg_options.replace("\"", "").split(" ") + [
791
+ ] + user_ffmpeg_options.replace("\"", "").split() + [
773
792
  temp_file
774
793
  ]
775
794
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.19.16
3
+ Version: 2.19.17
4
4
  Summary: A tool for mining sentences from games. Update: Dependencies, replay buffer based line searching, and bug fixes.
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -1,7 +1,7 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  GameSentenceMiner/anki.py,sha256=SvmkL-7AqMKtCWfgwyxALvEHBOoxmQabi_uSYahf5nU,29982
3
3
  GameSentenceMiner/gametext.py,sha256=4PPm7QSWDmvsyooVjFANkd1Vnoy5ixbGRMHfYfhwGs0,13320
4
- GameSentenceMiner/gsm.py,sha256=3jmcW5NZ8VDsGgwr_RaWEcTtd_HdBSA-smdtAeGbZlo,36938
4
+ GameSentenceMiner/gsm.py,sha256=yMqKvDZysR2gDnaf2EgOBr_naLvWOPJLBK3rrK9M1Ps,36964
5
5
  GameSentenceMiner/obs.py,sha256=UB4_OJ-vZQbHyuupB8JmwhSFdYyQX_5f5TpRXU1D7Kk,43300
6
6
  GameSentenceMiner/vad.py,sha256=iMSsoUZ7-aNoWKzDKfOHdB3Zk5U2hV7x5hqTny6rj08,21501
7
7
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -45,7 +45,7 @@ GameSentenceMiner/util/audio_player.py,sha256=-yFsf0qoTSS1ga5rCmEJZJGUSJzXCvfZHY
45
45
  GameSentenceMiner/util/configuration.py,sha256=lmk0CEGbu-wFU40O-1X8MvLZNNpNT3g1apghgOjidCM,49265
46
46
  GameSentenceMiner/util/db.py,sha256=iCHUzlgOJgNjQ5-oDa7gnDWmzdlEryOzbXfn9ToQPfY,33034
47
47
  GameSentenceMiner/util/electron_config.py,sha256=KfeJToeFFVw0IR5MKa-gBzpzaGrU-lyJbR9z-sDEHYU,8767
48
- GameSentenceMiner/util/ffmpeg.py,sha256=KZhoVVCGnlPIoVJ83XVQmjHDnzO4WefZRoLyceS6pEE,40100
48
+ GameSentenceMiner/util/ffmpeg.py,sha256=tK-bSfmODmCPqi5y5tXitCInhx-4Et5iAa1fucYDvnQ,41150
49
49
  GameSentenceMiner/util/games_table.py,sha256=VM68MAsdyE6tpdwM4bDSk67qioBOvsEO8-TpnRmUnSo,12003
50
50
  GameSentenceMiner/util/get_overlay_coords.py,sha256=jQ0hcrEh9CfvjlBRJez3Ly-er4MjBWC2zirA-hYz5hQ,26462
51
51
  GameSentenceMiner/util/gsm_utils.py,sha256=mASECTmN10c2yPL4NEfLg0Y0YWwFso1i6r_hhJPR3MY,10974
@@ -135,9 +135,9 @@ GameSentenceMiner/web/templates/components/kanji_grid/thousand_character_classic
135
135
  GameSentenceMiner/web/templates/components/kanji_grid/wanikani_levels.json,sha256=8wjnnaYQqmho6t5tMxrIAc03512A2tYhQh5dfsQnfAM,11372
136
136
  GameSentenceMiner/web/templates/components/kanji_grid/words_hk_frequency_list.json,sha256=wRkqZNPzz6DT9OTPHpXwfqW96Qb96stCQNNgOL-ZdKk,17535
137
137
  GameSentenceMiner/wip/__init___.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
138
- gamesentenceminer-2.19.16.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
139
- gamesentenceminer-2.19.16.dist-info/METADATA,sha256=MM_hRX6w_NZIzWWtjo1bk0RmG66SkAx0EkMoYC6K15E,8187
140
- gamesentenceminer-2.19.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
141
- gamesentenceminer-2.19.16.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
142
- gamesentenceminer-2.19.16.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
143
- gamesentenceminer-2.19.16.dist-info/RECORD,,
138
+ gamesentenceminer-2.19.17.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
139
+ gamesentenceminer-2.19.17.dist-info/METADATA,sha256=c6GkA9_ukfEfIFZokGYfucUlWoZ7WqVn3vl3MI4ygx4,8187
140
+ gamesentenceminer-2.19.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
141
+ gamesentenceminer-2.19.17.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
142
+ gamesentenceminer-2.19.17.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
143
+ gamesentenceminer-2.19.17.dist-info/RECORD,,