Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions stackchan_server/ws_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

_BASE_DIR = Path(__file__).resolve().parent
_RECORDINGS_DIR = _BASE_DIR / "recordings"
_RECORDINGS_DIR.mkdir(parents=True, exist_ok=True)

_WS_HEADER_FMT = "<BBBHH" # kind, msg_type, reserved, seq, payload_bytes
_WS_HEADER_SIZE = struct.calcsize(_WS_HEADER_FMT)
Expand Down Expand Up @@ -67,7 +66,8 @@ class _WsMsgType(IntEnum):


def create_voicevox_client() -> VVClient:
return VVClient(base_uri="http://localhost:50021")
voicevox_url = os.getenv("STACKCHAN_VOICEVOX_URL", "http://localhost:50021")
return VVClient(base_uri=voicevox_url)


class WsProxy:
Expand All @@ -77,6 +77,7 @@ def __init__(self, websocket: WebSocket, speech_client: speech.SpeechClient):
self.recordings_dir = _RECORDINGS_DIR
self._debug_recording = _DEBUG_RECORDING_ENABLED
if self._debug_recording:
_RECORDINGS_DIR.mkdir(parents=True, exist_ok=True)
self.recordings_dir.mkdir(parents=True, exist_ok=True)

self._pcm_buffer = bytearray()
Expand Down