Skip to content

Commit

Permalink
fix: #514 xiaogpt need play
Browse files Browse the repository at this point in the history
Signed-off-by: yihong0618 <[email protected]>
  • Loading branch information
yihong0618 committed May 20, 2024
1 parent f5b8324 commit 241abfd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xiaogpt/tts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async def worker():
continue
logger.debug("Playing URL %s (%s seconds)", url, duration)
await asyncio.gather(
self.mina_service.play_by_url(self.device_id, url),
self.mina_service.play_by_url(self.device_id, url, _type=1),
self.wait_for_duration(duration),
)
await task
Expand Down
4 changes: 2 additions & 2 deletions xiaogpt/xiaogpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,15 @@ async def get_if_xiaoai_is_playing(self):
# WTF xiaomi api
is_playing = (
json.loads(playing_info.get("data", {}).get("info", "{}")).get("status", -1)
>= 1
== 1
)
return is_playing

async def stop_if_xiaoai_is_playing(self):
is_playing = await self.get_if_xiaoai_is_playing()
if is_playing:
# stop it
await self.mina_service.player_stop(self.device_id)
await self.mina_service.player_pause(self.device_id)

async def wakeup_xiaoai(self):
return await miio_command(
Expand Down

0 comments on commit 241abfd

Please sign in to comment.