GameSentenceMiner 2.0.0.dev1__py3-none-any.whl → 2.0.1__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/obs.py +44 -7
- {GameSentenceMiner-2.0.0.dev1.dist-info → GameSentenceMiner-2.0.1.dist-info}/METADATA +8 -2
- {GameSentenceMiner-2.0.0.dev1.dist-info → GameSentenceMiner-2.0.1.dist-info}/RECORD +6 -6
- {GameSentenceMiner-2.0.0.dev1.dist-info → GameSentenceMiner-2.0.1.dist-info}/WHEEL +0 -0
- {GameSentenceMiner-2.0.0.dev1.dist-info → GameSentenceMiner-2.0.1.dist-info}/entry_points.txt +0 -0
- {GameSentenceMiner-2.0.0.dev1.dist-info → GameSentenceMiner-2.0.1.dist-info}/top_level.txt +0 -0
GameSentenceMiner/obs.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import time
|
2
|
+
from sys import platform
|
2
3
|
|
3
|
-
import obswebsocket
|
4
4
|
from obswebsocket import obsws, requests
|
5
|
-
from obswebsocket.exceptions import ConnectionFailure
|
6
5
|
|
7
6
|
from . import util
|
8
7
|
from . import configuration
|
@@ -14,6 +13,47 @@ client: obsws = None
|
|
14
13
|
# REFERENCE: https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md
|
15
14
|
|
16
15
|
|
16
|
+
def get_obs_websocket_config_values():
|
17
|
+
if platform == "win32":
|
18
|
+
config_path = os.path.expanduser(r"~\AppData\Roaming\obs-studio\plugin_config\obs-websocket\config.json")
|
19
|
+
elif platform == "darwin": # macOS
|
20
|
+
config_path = os.path.expanduser(
|
21
|
+
"~/Library/Application Support/obs-studio/plugin_config/obs-websocket/config.json")
|
22
|
+
elif platform == "linux":
|
23
|
+
config_path = os.path.expanduser("~/.config/obs-studio/plugin_config/obs-websocket/config.json")
|
24
|
+
else:
|
25
|
+
raise Exception("Unsupported operating system.")
|
26
|
+
|
27
|
+
# Check if config file exists
|
28
|
+
if not os.path.isfile(config_path):
|
29
|
+
raise FileNotFoundError(f"OBS WebSocket config not found at {config_path}")
|
30
|
+
|
31
|
+
# Read the JSON configuration
|
32
|
+
with open(config_path, 'r') as file:
|
33
|
+
config = json.load(file)
|
34
|
+
|
35
|
+
# Extract values
|
36
|
+
server_enabled = config.get("server_enabled", False)
|
37
|
+
server_port = config.get("server_port", 4455) # Default to 4455 if not set
|
38
|
+
server_password = config.get("server_password", None)
|
39
|
+
|
40
|
+
if not server_enabled:
|
41
|
+
logger.info("OBS WebSocket server is not enabled. Enabling it now... Restart OBS for changes to take effect.")
|
42
|
+
config["server_enabled"] = True
|
43
|
+
|
44
|
+
with open(config_path, 'w') as file:
|
45
|
+
json.dump(config, file, indent=4)
|
46
|
+
|
47
|
+
if get_config().obs.password == 'your_password':
|
48
|
+
logger.info("OBS WebSocket password is not set. Setting it now...")
|
49
|
+
config = get_master_config()
|
50
|
+
config.get_config().obs.port = server_port
|
51
|
+
config.get_config().obs.password = server_password
|
52
|
+
with open(get_config_path(), 'w') as file:
|
53
|
+
json.dump(config.to_dict(), file, indent=4)
|
54
|
+
reload_config()
|
55
|
+
|
56
|
+
|
17
57
|
def on_connect(obs):
|
18
58
|
logger.info("Connected to OBS WebSocket.")
|
19
59
|
time.sleep(2)
|
@@ -28,14 +68,11 @@ def on_disconnect(obs):
|
|
28
68
|
def connect_to_obs(start_replay=False):
|
29
69
|
global client
|
30
70
|
if get_config().obs.enabled:
|
71
|
+
get_obs_websocket_config_values()
|
31
72
|
client = obsws(host=get_config().obs.host, port=get_config().obs.port,
|
32
73
|
password=get_config().obs.password, authreconnect=1, on_connect=on_connect,
|
33
74
|
on_disconnect=on_disconnect)
|
34
|
-
|
35
|
-
client.connect()
|
36
|
-
except ConnectionFailure:
|
37
|
-
logger.error("OBS Websocket Connection Has not been Set up, please set it up in Settings")
|
38
|
-
exit(1)
|
75
|
+
client.connect()
|
39
76
|
|
40
77
|
time.sleep(1)
|
41
78
|
if start_replay and get_config().obs.start_buffer:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: GameSentenceMiner
|
3
|
-
Version: 2.0.
|
3
|
+
Version: 2.0.1
|
4
4
|
Summary: A tool for mining sentences from games.
|
5
5
|
Author-email: Beangate <bpwhelan95@gmail.com>
|
6
6
|
License: MIT License
|
@@ -38,6 +38,12 @@ Requires-Dist: pywin32
|
|
38
38
|
|
39
39
|
# Sentence Mining Game Audio Trim Helper
|
40
40
|
|
41
|
+
## WARNING
|
42
|
+
|
43
|
+
This project is in process of a major rewrite, and this README will be updated soon with the new process.
|
44
|
+
|
45
|
+
---
|
46
|
+
|
41
47
|
This project automates the recording of game sentence audio to help with Anki Card Creation.
|
42
48
|
|
43
49
|
This allows us to create cards from texthooker/yomitan, and automatically get screenshot and sentence audio from the
|
@@ -280,7 +286,7 @@ Screenshots to help with setup:
|
|
280
286
|
|
281
287
|
1. Start game
|
282
288
|
2. Hook Game with Agent (or textractor) with clipboard enabled
|
283
|
-
3. start script: `python
|
289
|
+
3. start script: `python -m src.GameSentenceMiner.gsm`
|
284
290
|
1. Create Anki Card with target word (through a texthooker page/Yomitan)
|
285
291
|
2. (If full-auto-mode not on) Trigger Hotkey to record replay buffer
|
286
292
|
4. When finished gaming, end script
|
@@ -7,14 +7,14 @@ GameSentenceMiner/gametext.py,sha256=GpR9P8h3GmmKH46Dw13kJPx66n3jGjFCiV8Fcrqn9E8
|
|
7
7
|
GameSentenceMiner/gsm.py,sha256=Lnj59KHV4l5eEgffkswBlRCONgYB_Id3L0pTajUzsvI,14937
|
8
8
|
GameSentenceMiner/model.py,sha256=oh8VVT8T1UKekbmP6MGNgQ8jIuQ_7Rg4GPzDCn2kJo8,1999
|
9
9
|
GameSentenceMiner/notification.py,sha256=sWgIIXhaB9WV1K_oQGf5-IR6q3dakae_QS-RuIvbcEs,1939
|
10
|
-
GameSentenceMiner/obs.py,sha256=
|
10
|
+
GameSentenceMiner/obs.py,sha256=gutnRk30jIxuvrpEosR9jw2h_tll36wgtAZkUF-vWDY,5256
|
11
11
|
GameSentenceMiner/util.py,sha256=OYg0j_rT9F7v3aJRwWnHvdWMYyxGlimrvw7U2C9ifeY,4441
|
12
12
|
GameSentenceMiner/vad/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
13
13
|
GameSentenceMiner/vad/silero_trim.py,sha256=r7bZYEj-NUXGKgD2UIhLrbTPyq0rau97qGtrMZcRK4A,1517
|
14
14
|
GameSentenceMiner/vad/vosk_helper.py,sha256=lWmlGMhmg_0QoWeCHrXwz9wDKPqY37BckHCekGVtJUI,5794
|
15
15
|
GameSentenceMiner/vad/whisper_helper.py,sha256=9kmPeSs6jRcKSVxYY-vtyTcqVUDORR4q1nl8fqxHHn4,3379
|
16
|
-
GameSentenceMiner-2.0.
|
17
|
-
GameSentenceMiner-2.0.
|
18
|
-
GameSentenceMiner-2.0.
|
19
|
-
GameSentenceMiner-2.0.
|
20
|
-
GameSentenceMiner-2.0.
|
16
|
+
GameSentenceMiner-2.0.1.dist-info/METADATA,sha256=1Do_9ICUOyK_eo89olnaBQhg-yHyLEDtyky8NXh4-_8,13534
|
17
|
+
GameSentenceMiner-2.0.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
18
|
+
GameSentenceMiner-2.0.1.dist-info/entry_points.txt,sha256=2APEP25DbfjSxGeHtwBstMH8mulVhLkqF_b9bqzU6vQ,65
|
19
|
+
GameSentenceMiner-2.0.1.dist-info/top_level.txt,sha256=V1hUY6xVSyUEohb0uDoN4UIE6rUZ_JYx8yMyPGX4PgQ,18
|
20
|
+
GameSentenceMiner-2.0.1.dist-info/RECORD,,
|
File without changes
|
{GameSentenceMiner-2.0.0.dev1.dist-info → GameSentenceMiner-2.0.1.dist-info}/entry_points.txt
RENAMED
File without changes
|
File without changes
|