Skip to content

Commit 02daee4

Browse files
authored
Merge pull request #69 from voicevox-client/tuna2134-patch-2
Add is initialized speaker
2 parents f210d56 + aca6dc6 commit 02daee4

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

tests/test_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
async def test_basic():
88
async with Client() as client:
99
await client.init_speaker(1)
10-
assert await client.check_inited_speaker(1)
10+
assert await client.is_inited_speaker(1)

vvclient/client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,11 @@ async def init_speaker(self, speaker: int, *, skip_reinit: bool = False, core_ve
9393
if core_version:
9494
params["core_version"] = core_version
9595
await self.http.initialize_speaker(params)
96+
97+
async def is_inited_speaker(self, speaker: int, *, core_version: Optional[str] = None) -> bool:
98+
params = {
99+
"speaker": speaker
100+
}
101+
if core_version:
102+
params["core_version"] = core_version
103+
return await self.http.is_initialized_speaker(params)

vvclient/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ async def core_versions(self) -> List[str]:
6262
async def initialize_speaker(self, params: Dict[str, Union[str, int]]) -> None:
6363
return await self.request(Route("POST", "/initialize_speaker"), params=params)
6464

65-
async def is_initialized_speaker(self, params: Dict[str, Union[str, int]) -> bool:
65+
async def is_initialized_speaker(self, params: Dict[str, Union[str, int]]) -> bool:
6666
return await self.request(Route("GET", "/is_initialized_speaker"), params=params)

0 commit comments

Comments
 (0)