GameSentenceMiner 2.5.13__py3-none-any.whl → 2.5.14__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/communication/websocket.py +9 -0
- GameSentenceMiner/configuration.py +1 -3
- GameSentenceMiner/gsm.py +10 -4
- {gamesentenceminer-2.5.13.dist-info → gamesentenceminer-2.5.14.dist-info}/METADATA +1 -1
- {gamesentenceminer-2.5.13.dist-info → gamesentenceminer-2.5.14.dist-info}/RECORD +9 -9
- {gamesentenceminer-2.5.13.dist-info → gamesentenceminer-2.5.14.dist-info}/WHEEL +0 -0
- {gamesentenceminer-2.5.13.dist-info → gamesentenceminer-2.5.14.dist-info}/entry_points.txt +0 -0
- {gamesentenceminer-2.5.13.dist-info → gamesentenceminer-2.5.14.dist-info}/licenses/LICENSE +0 -0
- {gamesentenceminer-2.5.13.dist-info → gamesentenceminer-2.5.14.dist-info}/top_level.txt +0 -0
@@ -3,6 +3,7 @@ import os.path
|
|
3
3
|
|
4
4
|
import websockets
|
5
5
|
import json
|
6
|
+
from enum import Enum
|
6
7
|
|
7
8
|
from websocket import WebSocket
|
8
9
|
|
@@ -13,6 +14,14 @@ CONFIG_FILE = os.path.join(get_app_directory(), "shared_config.json")
|
|
13
14
|
websocket: WebSocket = None
|
14
15
|
handle_websocket_message = None
|
15
16
|
|
17
|
+
|
18
|
+
class FunctionName(Enum):
|
19
|
+
QUIT = "quit"
|
20
|
+
START = "start"
|
21
|
+
STOP = "stop"
|
22
|
+
QUIT_OBS = "quit_obs"
|
23
|
+
START_OBS = "start_obs"
|
24
|
+
|
16
25
|
async def do_websocket_connection(port):
|
17
26
|
"""
|
18
27
|
Connects to the WebSocket server running in the Electron app.
|
@@ -312,9 +312,6 @@ class Config:
|
|
312
312
|
self.sync_shared_field(config.hotkeys, profile.hotkeys, "take_screenshot")
|
313
313
|
self.sync_shared_field(config.hotkeys, profile.hotkeys, "open_utility")
|
314
314
|
self.sync_shared_field(config.hotkeys, profile.hotkeys, "play_latest_audio")
|
315
|
-
# self.sync_shared_field(config.advanced, profile.advanced, "audio_player_path")
|
316
|
-
# self.sync_shared_field(config.advanced, profile.advanced, "video_player_path")
|
317
|
-
# self.sync_shared_field(config.advanced, profile.advanced, "show_screenshot_buttons")
|
318
315
|
self.sync_shared_field(config.anki, profile.anki, "url")
|
319
316
|
self.sync_shared_field(config.anki, profile.anki, "sentence_field")
|
320
317
|
self.sync_shared_field(config.anki, profile.anki, "sentence_audio_field")
|
@@ -340,6 +337,7 @@ class Config:
|
|
340
337
|
|
341
338
|
return self
|
342
339
|
|
340
|
+
|
343
341
|
def sync_shared_field(self, config, config2, field_name):
|
344
342
|
try:
|
345
343
|
config_value = getattr(config, field_name, None)
|
GameSentenceMiner/gsm.py
CHANGED
@@ -23,7 +23,8 @@ from GameSentenceMiner import obs
|
|
23
23
|
from GameSentenceMiner import util
|
24
24
|
from GameSentenceMiner.communication import Message
|
25
25
|
from GameSentenceMiner.communication.send import send_restart_signal
|
26
|
-
from GameSentenceMiner.communication.websocket import connect_websocket, register_websocket_message_handler
|
26
|
+
from GameSentenceMiner.communication.websocket import connect_websocket, register_websocket_message_handler, \
|
27
|
+
FunctionName
|
27
28
|
from GameSentenceMiner.configuration import *
|
28
29
|
from GameSentenceMiner.downloader.download_tools import download_obs_if_needed, download_ffmpeg_if_needed
|
29
30
|
from GameSentenceMiner.ffmpeg import get_audio_and_trim, get_video_timings
|
@@ -445,6 +446,7 @@ def run_tray():
|
|
445
446
|
# proc.wait()
|
446
447
|
|
447
448
|
def close_obs():
|
449
|
+
obs.disconnect_from_obs()
|
448
450
|
if obs.obs_process:
|
449
451
|
try:
|
450
452
|
subprocess.run(["taskkill", "/PID", str(obs.obs_process.pid), "/F"], check=True, capture_output=True, text=True)
|
@@ -553,12 +555,16 @@ def post_init():
|
|
553
555
|
|
554
556
|
util.run_new_thread(do_post_init)
|
555
557
|
|
556
|
-
|
557
558
|
def handle_websocket_message(message: Message):
|
558
|
-
match message.function:
|
559
|
-
case
|
559
|
+
match FunctionName(message.function):
|
560
|
+
case FunctionName.QUIT:
|
560
561
|
cleanup()
|
561
562
|
sys.exit(0)
|
563
|
+
case FunctionName.QUIT_OBS:
|
564
|
+
close_obs()
|
565
|
+
case FunctionName.START_OBS:
|
566
|
+
obs.start_obs()
|
567
|
+
obs.connect_to_obs()
|
562
568
|
case _:
|
563
569
|
logger.debug(f"unknown message from electron websocket: {message.to_json()}")
|
564
570
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
GameSentenceMiner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
2
|
GameSentenceMiner/anki.py,sha256=FHm76i7WYEs--szhzZjz0B6DW4JuDQopmjR3RjYBogs,13358
|
3
3
|
GameSentenceMiner/config_gui.py,sha256=WVSN239lyVm5GwKzE1HXiCSCu2CNpkcDm8TGKlTJpMc,62093
|
4
|
-
GameSentenceMiner/configuration.py,sha256=
|
4
|
+
GameSentenceMiner/configuration.py,sha256=obBhz7aAFkhQAhIqrocv2jRTOqIJ0tFEI_saUCyMAMc,19924
|
5
5
|
GameSentenceMiner/ffmpeg.py,sha256=fzOxrn-a4KqFdUY2oove164CTDOSsdPQtzqRW5f1P7c,12002
|
6
6
|
GameSentenceMiner/gametext.py,sha256=LORVdE2WEo1CDI8gonc7qxrhbS4KFKXFQVKjhlkpLbc,7368
|
7
|
-
GameSentenceMiner/gsm.py,sha256=
|
7
|
+
GameSentenceMiner/gsm.py,sha256=ZdYVJKilDFEGdC3g5V5pjSr4G2JkNNDIt7BQX6yc28A,24456
|
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
|
@@ -13,7 +13,7 @@ GameSentenceMiner/util.py,sha256=Awhy57vX4NgQzygqKaGQn2EJ75T0uiXlhmINFOWlQkU,682
|
|
13
13
|
GameSentenceMiner/utility_gui.py,sha256=H4aOddlsrVR768RwbMzYScCziuOz1JeySUigNrPlaac,7692
|
14
14
|
GameSentenceMiner/communication/__init__.py,sha256=_jGn9PJxtOAOPtJ2rI-Qu9hEHVZVpIvWlxKvqk91_zI,638
|
15
15
|
GameSentenceMiner/communication/send.py,sha256=oOJdCS6-LNX90amkRn5FL2xqx6THGm56zHR2ntVIFTE,229
|
16
|
-
GameSentenceMiner/communication/websocket.py,sha256=
|
16
|
+
GameSentenceMiner/communication/websocket.py,sha256=pTcUe_ZZRp9REdSU4qalhPmbT_1DKa7w18j6RfFLELA,3074
|
17
17
|
GameSentenceMiner/downloader/Untitled_json.py,sha256=RUUl2bbbCpUDUUS0fP0tdvf5FngZ7ILdA_J5TFYAXUQ,15272
|
18
18
|
GameSentenceMiner/downloader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
GameSentenceMiner/downloader/download_tools.py,sha256=mI1u_FGBmBqDIpCH3jOv8DOoZ3obgP5pIf9o9SVfX2Q,8131
|
@@ -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.
|
25
|
-
gamesentenceminer-2.5.
|
26
|
-
gamesentenceminer-2.5.
|
27
|
-
gamesentenceminer-2.5.
|
28
|
-
gamesentenceminer-2.5.
|
29
|
-
gamesentenceminer-2.5.
|
24
|
+
gamesentenceminer-2.5.14.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
25
|
+
gamesentenceminer-2.5.14.dist-info/METADATA,sha256=sm1RIt4O0bGoTOY3gMeVxcj7qbm_whFLk_6Jgf_blVk,5433
|
26
|
+
gamesentenceminer-2.5.14.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
27
|
+
gamesentenceminer-2.5.14.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
28
|
+
gamesentenceminer-2.5.14.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
29
|
+
gamesentenceminer-2.5.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|