GameSentenceMiner 2.13.4.post2__py3-none-any.whl → 2.13.5.post1__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
@@ -175,7 +175,7 @@ class VideoToAudioHandler(FileSystemEventHandler):
175
175
  anki.update_anki_card(
176
176
  last_note, note, audio_path=final_audio_output, video_path=video_path,
177
177
  tango=tango,
178
- should_update_audio=vad_result.success,
178
+ should_update_audio=vad_result.output_audio,
179
179
  ss_time=ss_timing,
180
180
  game_line=mined_line,
181
181
  selected_lines=selected_lines
@@ -618,6 +618,29 @@ async def run_test_code():
618
618
  if boxes:
619
619
  await texthooking_page.send_word_coordinates_to_overlay(boxes)
620
620
  await asyncio.sleep(2)
621
+
622
+
623
+ async def check_if_script_is_running():
624
+ """Check if the script is already running and kill it if so."""
625
+ if os.path.exists(os.path.join(get_app_directory(), "current_pid.txt")):
626
+ with open(os.path.join(get_app_directory(), "current_pid.txt"), "r") as f:
627
+ pid = int(f.read().strip())
628
+ if psutil.pid_exists(pid) and 'python' in psutil.Process(pid).name().lower():
629
+ logger.info(f"Script is already running with PID: {pid}")
630
+ psutil.Process(pid).terminate() # Attempt to terminate the existing process
631
+ logger.info("Sent SIGTERM to the existing process.")
632
+ notification.send_error_notification(
633
+ "Script was already running. Terminating the existing process.")
634
+ return True
635
+ return False
636
+
637
+
638
+ async def log_current_pid():
639
+ """Log the current process ID."""
640
+ current_pid = os.getpid()
641
+ logger.info(f"Current process ID: {current_pid}")
642
+ with open(os.path.join(get_app_directory(), "current_pid.txt"), "w") as f:
643
+ f.write(str(current_pid))
621
644
 
622
645
 
623
646
  async def async_main(reloading=False):
@@ -638,6 +661,9 @@ async def async_main(reloading=False):
638
661
  run_new_thread(post_init2)
639
662
  run_new_thread(run_text_hooker_page)
640
663
  run_new_thread(async_loop)
664
+
665
+ # await check_if_script_is_running()
666
+ # await log_current_pid()
641
667
 
642
668
  # Register signal handlers for graceful shutdown
643
669
  signal.signal(signal.SIGTERM, handle_exit()) # Handle `kill` commands
GameSentenceMiner/vad.py CHANGED
@@ -376,8 +376,8 @@ vad_processor = VADSystem()
376
376
  # Test cases for all VADProcessors
377
377
  def test_vad_processors():
378
378
  logger.setLevel(logging.DEBUG)
379
- test_audio = r"C:\Users\Beangate\GSM\Electron App\test\tmptnl4a93q_untrimmed.opus"
380
- output_dir = r"C:\Users\Beangate\GSM\Electron App\test\output"
379
+ test_audio = r"C:\Users\Beangate\GSM\GameSentenceMiner\GameSentenceMiner\test\tmpso7v0265.opus"
380
+ output_dir = r"C:\Users\Beangate\GSM\GameSentenceMiner\GameSentenceMiner\test\output"
381
381
  os.makedirs(output_dir, exist_ok=True)
382
382
  processors = [
383
383
  (WhisperVADProcessor(), "after_splice_whisper.opus"),
@@ -396,12 +396,20 @@ def test_vad_processors():
396
396
 
397
397
  get_config().vad.cut_and_splice_segments = False
398
398
  get_config().vad.trim_beginning = True
399
+ get_config().vad.add_audio_on_no_results = True
399
400
  for processor, out_name in processors:
400
401
  logger.info("Testing Trim Audio with " + processor.vad_system_name)
401
402
  out_path = os.path.join(output_dir, out_name.replace("after_splice_", "after_trim_"))
402
403
  if os.path.exists(out_path):
403
404
  os.remove(out_path)
404
- processor.process_audio(test_audio, out_path, None)
405
+ result = processor.process_audio(test_audio, out_path, None)
406
+ print(result)
407
+
408
+ vad_system = VADSystem()
409
+ vad_system.init()
410
+
411
+ result = vad_system.trim_audio_with_vad(test_audio, os.path.join(output_dir, "after_vad.opus"), None)
412
+ print(result)
405
413
 
406
414
 
407
415
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.13.4.post2
3
+ Version: 2.13.5.post1
4
4
  Summary: A tool for mining sentences from games. Update: Overlay?
5
5
  Author-email: Beangate <bpwhelan95@gmail.com>
6
6
  License: MIT License
@@ -2,9 +2,9 @@ GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
2
2
  GameSentenceMiner/anki.py,sha256=FUwcWO0-arzfQjejQmDKP7pNNakhboo8InQ4s_jv6AY,19099
3
3
  GameSentenceMiner/config_gui.py,sha256=x8H3HXoRlnfgiFczAoCe1wiCoQDP8MWV0v7am36q3Co,126479
4
4
  GameSentenceMiner/gametext.py,sha256=qR32LhXAo1_a4r01zd7Pm2Yj4ByYCw58u78JdFkSxh4,10939
5
- GameSentenceMiner/gsm.py,sha256=fG_3z-l6ADtx8Au2b6u514_kCWPdwYE03_U7IVLiE3Y,26649
5
+ GameSentenceMiner/gsm.py,sha256=5LBoV_vCjR6cKvpbQBOVXfI15FYae2qLFC3rXe8pApY,27852
6
6
  GameSentenceMiner/obs.py,sha256=alh8G-0vEWxV46WqgVsgNU5_PC5JNzyXJdmVetjiGRo,18819
7
- GameSentenceMiner/vad.py,sha256=-Q1KtDJnT8zRFeEc4LLyAECf07YOUM15UDRrnWkuDgo,18817
7
+ GameSentenceMiner/vad.py,sha256=zFReBMvNEEaQ_YEozCTCaMdV-o40FwtlxYRb17cYZio,19125
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  GameSentenceMiner/ai/ai_prompting.py,sha256=iHkEx2pQJ-tEyejOgYy4G0DcZc8qvBugVL6-CQpPSME,26089
10
10
  GameSentenceMiner/assets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -67,9 +67,9 @@ GameSentenceMiner/web/templates/index.html,sha256=Gv3CJvNnhAzIVV_QxhNq4OD-pXDt1v
67
67
  GameSentenceMiner/web/templates/text_replacements.html,sha256=tV5c8mCaWSt_vKuUpbdbLAzXZ3ATZeDvQ9PnnAfqY0M,8598
68
68
  GameSentenceMiner/web/templates/utility.html,sha256=3flZinKNqUJ7pvrZk6xu__v67z44rXnaK7UTZ303R-8,16946
69
69
  GameSentenceMiner/wip/get_overlay_coords.py,sha256=nJRytHJwUBToXeAIkf45HP7Yv42YO-ILbP5h8GVeE2Q,19791
70
- gamesentenceminer-2.13.4.post2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
71
- gamesentenceminer-2.13.4.post2.dist-info/METADATA,sha256=hTRHD0U9JWSUrAbWNaNXVd8QnIg6FwiUxL4Oge-d-2s,1469
72
- gamesentenceminer-2.13.4.post2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- gamesentenceminer-2.13.4.post2.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
74
- gamesentenceminer-2.13.4.post2.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
75
- gamesentenceminer-2.13.4.post2.dist-info/RECORD,,
70
+ gamesentenceminer-2.13.5.post1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
71
+ gamesentenceminer-2.13.5.post1.dist-info/METADATA,sha256=RZAfAc3aTumTUQeL_1T6iGHryRRDKn4q7erBdbqUvG8,1469
72
+ gamesentenceminer-2.13.5.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ gamesentenceminer-2.13.5.post1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
74
+ gamesentenceminer-2.13.5.post1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
75
+ gamesentenceminer-2.13.5.post1.dist-info/RECORD,,