GameSentenceMiner 2.13.5__py3-none-any.whl → 2.13.6__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
@@ -941,8 +941,10 @@ class OBSScreenshotThread(threading.Thread):
941
941
  logger.error("No active source found in the current scene.")
942
942
  time.sleep(1)
943
943
  continue
944
- img = obs.get_screenshot_PIL(source_name=self.current_source_name, width=self.width, height=self.height, img_format='png', compression=80)
945
-
944
+ # start_time = time.time()
945
+ img = obs.get_screenshot_PIL(source_name=self.current_source_name, width=self.width, height=self.height, img_format='jpg', compression=80)
946
+ # logger.info(f"OBS screenshot taken in {time.time() - start_time:.2f} seconds.")
947
+
946
948
  if img is not None:
947
949
  if not img.getbbox():
948
950
  logger.info("OBS Not Capturing anything, sleeping.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.13.5
3
+ Version: 2.13.6
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,7 +2,7 @@ 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
7
  GameSentenceMiner/vad.py,sha256=zFReBMvNEEaQ_YEozCTCaMdV-o40FwtlxYRb17cYZio,19125
8
8
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -29,7 +29,7 @@ GameSentenceMiner/owocr/owocr/__main__.py,sha256=XQaqZY99EKoCpU-gWQjNbTs7Kg17HvB
29
29
  GameSentenceMiner/owocr/owocr/config.py,sha256=qM7kISHdUhuygGXOxmgU6Ef2nwBShrZtdqu4InDCViE,8103
30
30
  GameSentenceMiner/owocr/owocr/lens_betterproto.py,sha256=oNoISsPilVVRBBPVDtb4-roJtAhp8ZAuFTci3TGXtMc,39141
31
31
  GameSentenceMiner/owocr/owocr/ocr.py,sha256=NHo-sjE_ZGUjPzzJqMDmFs29xbIvvQQyCBRQ61PTyfo,62221
32
- GameSentenceMiner/owocr/owocr/run.py,sha256=ex0TZp3WTN2qTjrZ5D3Q-Gma4iZ0NPXGaHddTPIqRYs,68229
32
+ GameSentenceMiner/owocr/owocr/run.py,sha256=-0MBg6aADE5ILnt5BFeq4v8cOAy4C577o1ToT0HzKrk,68388
33
33
  GameSentenceMiner/owocr/owocr/screen_coordinate_picker.py,sha256=Na6XStbQBtpQUSdbN3QhEswtKuU1JjReFk_K8t5ezQE,3395
34
34
  GameSentenceMiner/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
35
  GameSentenceMiner/util/audio_offset_selector.py,sha256=8Stk3BP-XVIuzRv9nl9Eqd2D-1yD3JrgU-CamBywJmY,8542
@@ -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.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
71
- gamesentenceminer-2.13.5.dist-info/METADATA,sha256=RHvswnzR9CzZXs1sBjfBUXuXWqSHR-jP_c-AvH5OcY8,1463
72
- gamesentenceminer-2.13.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- gamesentenceminer-2.13.5.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
74
- gamesentenceminer-2.13.5.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
75
- gamesentenceminer-2.13.5.dist-info/RECORD,,
70
+ gamesentenceminer-2.13.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
71
+ gamesentenceminer-2.13.6.dist-info/METADATA,sha256=_baiRFxmvTAP2B_FR8HUasTmJ7zcBEbpbILtjw0QSTs,1463
72
+ gamesentenceminer-2.13.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ gamesentenceminer-2.13.6.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
74
+ gamesentenceminer-2.13.6.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
75
+ gamesentenceminer-2.13.6.dist-info/RECORD,,