GameSentenceMiner 2.19.5__py3-none-any.whl → 2.19.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.

Potentially problematic release.


This version of GameSentenceMiner might be problematic. Click here for more details.

GameSentenceMiner/gsm.py CHANGED
@@ -144,6 +144,8 @@ procs_to_close = []
144
144
  settings_window: config_gui.ConfigApp = None
145
145
  obs_paused = False
146
146
  root = None
147
+ file_watcher_observer = None # Global observer for file watching
148
+ file_watcher_path = None # Track the currently watched path
147
149
  warnings.simplefilter("ignore", DeprecationWarning)
148
150
 
149
151
 
@@ -595,6 +597,14 @@ def cleanup():
595
597
  if gsm_tray:
596
598
  gsm_tray.stop()
597
599
 
600
+ # Stop file watcher observer
601
+ if file_watcher_observer:
602
+ try:
603
+ file_watcher_observer.stop()
604
+ file_watcher_observer.join()
605
+ except Exception as e:
606
+ logger.error(f"Error stopping file watcher observer: {e}")
607
+
598
608
  for video in gsm_state.videos_to_remove:
599
609
  try:
600
610
  if os.path.exists(video):
@@ -622,6 +632,43 @@ def handle_exit():
622
632
  return _handle_exit
623
633
 
624
634
 
635
+ def start_file_watcher():
636
+ """Start or restart the file watcher with current config."""
637
+ global file_watcher_observer, file_watcher_path
638
+
639
+ # Stop existing observer if running
640
+ if file_watcher_observer:
641
+ try:
642
+ file_watcher_observer.stop()
643
+ file_watcher_observer.join(timeout=2)
644
+ logger.info("Stopped existing file watcher")
645
+ except Exception as e:
646
+ logger.error(f"Error stopping file watcher: {e}")
647
+
648
+ # Create and start new observer
649
+ watch_path = get_config().paths.folder_to_watch
650
+ os.makedirs(watch_path, exist_ok=True)
651
+
652
+ file_watcher_observer = Observer()
653
+ file_watcher_observer.schedule(VideoToAudioHandler(), watch_path, recursive=False)
654
+ file_watcher_observer.start()
655
+ file_watcher_path = watch_path
656
+ logger.info(f"File watcher started for: {watch_path}")
657
+
658
+
659
+ def on_config_changed():
660
+ """Called when config is saved/changed. Restarts file watcher if path changed."""
661
+ global file_watcher_path
662
+
663
+ new_path = get_config().paths.folder_to_watch
664
+
665
+ if file_watcher_path != new_path:
666
+ logger.info(f"Watch path changed from '{file_watcher_path}' to '{new_path}', restarting file watcher...")
667
+ start_file_watcher()
668
+ else:
669
+ logger.debug("Config changed, but watch path unchanged - no restart needed")
670
+
671
+
625
672
  def initialize(reloading=False):
626
673
  global obs_process
627
674
  if not reloading:
@@ -703,6 +750,10 @@ def async_loop():
703
750
  await obs.connect_to_obs(connections=3, check_output=True)
704
751
  await register_scene_switcher_callback()
705
752
  await check_obs_folder_is_correct()
753
+
754
+ # Start file watcher after OBS path is verified/corrected
755
+ start_file_watcher()
756
+
706
757
  vad_processor.init()
707
758
  await init_overlay_processor()
708
759
 
@@ -787,10 +838,6 @@ async def async_main(reloading=False):
787
838
  settings_window = config_gui.ConfigApp(root)
788
839
  gsm_state.config_app = settings_window
789
840
  initialize_async()
790
- observer = Observer()
791
- observer.schedule(VideoToAudioHandler(),
792
- get_config().paths.folder_to_watch, recursive=False)
793
- observer.start()
794
841
  if is_windows():
795
842
  register_hotkeys()
796
843
 
@@ -821,16 +868,11 @@ async def async_main(reloading=False):
821
868
  # audio_path="C:/path/to/my/audio.mp3",
822
869
  # translation="Hello world! How are you?"))
823
870
  settings_window.add_save_hook(gsm_tray.update_icon)
871
+ settings_window.add_save_hook(on_config_changed)
824
872
  settings_window.on_exit = exit_program
825
873
  root.mainloop()
826
874
  except KeyboardInterrupt:
827
875
  cleanup()
828
-
829
- try:
830
- observer.stop()
831
- observer.join()
832
- except Exception as e:
833
- logger.error(f"Error stopping observer: {e}")
834
876
  except Exception as e:
835
877
  handle_error_in_initialization(e)
836
878
 
GameSentenceMiner/obs.py CHANGED
@@ -817,7 +817,7 @@ def set_fit_to_screen_for_scene_items(scene_name: str):
817
817
  'positionX': 0, 'positionY': 0,
818
818
  }
819
819
 
820
- if not already_cropped:
820
+ if not True:
821
821
  fit_to_screen_transform.update({
822
822
  'cropLeft': 0 if not aspect_ratio_different or canvas_width > source_width else (source_width - canvas_width) // 2,
823
823
  'cropRight': 0 if not aspect_ratio_different or canvas_width > source_width else (source_width - canvas_width) // 2,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GameSentenceMiner
3
- Version: 2.19.5
3
+ Version: 2.19.6
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,8 +1,8 @@
1
1
  GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  GameSentenceMiner/anki.py,sha256=jySFPzDYz0vItb12kwZ-rm9WmtxO8Kr41wK1JdwRnU4,29638
3
3
  GameSentenceMiner/gametext.py,sha256=4PPm7QSWDmvsyooVjFANkd1Vnoy5ixbGRMHfYfhwGs0,13320
4
- GameSentenceMiner/gsm.py,sha256=Do-1RRdsC9jqu1artpYN4mQIYT2XGxPPDeYbLKtHMdM,34569
5
- GameSentenceMiner/obs.py,sha256=MdT3zQJqTe72MAxawxBafK-4a9UoRWdFDJn_V2TsIp4,37988
4
+ GameSentenceMiner/gsm.py,sha256=dg41VMDLzR3U8-Xm1oHGfU2JKL8cyH-WacqY6tLrWyM,36164
5
+ GameSentenceMiner/obs.py,sha256=QLeJujJk48L0mphmPHa0hE46P09qQx34z41lla1ud-o,37977
6
6
  GameSentenceMiner/vad.py,sha256=iMSsoUZ7-aNoWKzDKfOHdB3Zk5U2hV7x5hqTny6rj08,21501
7
7
  GameSentenceMiner/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  GameSentenceMiner/ai/ai_prompting.py,sha256=mq9Odv_FpohXagU-OoSZbLWttdrEl1M1NiqnodeUpD8,29126
@@ -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.5.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
139
- gamesentenceminer-2.19.5.dist-info/METADATA,sha256=xwGq1yfz_7IFRoEDN7XEp5XLObfTTe8VLfttIePJ8KA,8180
140
- gamesentenceminer-2.19.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
141
- gamesentenceminer-2.19.5.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
142
- gamesentenceminer-2.19.5.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
143
- gamesentenceminer-2.19.5.dist-info/RECORD,,
138
+ gamesentenceminer-2.19.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
139
+ gamesentenceminer-2.19.6.dist-info/METADATA,sha256=UsYLvq5EK3i2B84SK2JvJ9tyKLXFa0KsZY7Jnl2JAsg,8180
140
+ gamesentenceminer-2.19.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
141
+ gamesentenceminer-2.19.6.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
142
+ gamesentenceminer-2.19.6.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
143
+ gamesentenceminer-2.19.6.dist-info/RECORD,,