Skip to content

Commit

Permalink
Merge pull request #69 from voicevox-client/tuna2134-patch-2
Browse files Browse the repository at this point in the history
Add is initialized speaker
  • Loading branch information
tuna2134 committed May 16, 2024
2 parents f210d56 + aca6dc6 commit 02daee4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
async def test_basic():
async with Client() as client:
await client.init_speaker(1)
assert await client.check_inited_speaker(1)
assert await client.is_inited_speaker(1)
8 changes: 8 additions & 0 deletions vvclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,11 @@ async def init_speaker(self, speaker: int, *, skip_reinit: bool = False, core_ve
if core_version:
params["core_version"] = core_version
await self.http.initialize_speaker(params)

async def is_inited_speaker(self, speaker: int, *, core_version: Optional[str] = None) -> bool:
params = {
"speaker": speaker
}
if core_version:
params["core_version"] = core_version
return await self.http.is_initialized_speaker(params)
2 changes: 1 addition & 1 deletion vvclient/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ async def core_versions(self) -> List[str]:
async def initialize_speaker(self, params: Dict[str, Union[str, int]]) -> None:
return await self.request(Route("POST", "/initialize_speaker"), params=params)

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

0 comments on commit 02daee4

Please sign in to comment.