From 7f4e51be08ea43984f3c6a0eaaaa263d095a7eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B6=B5=E6=9B=A6?= Date: Tue, 2 Jul 2024 13:25:38 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=92=AD=E6=94=BE=E6=AD=8C=E6=9B=B2?= =?UTF-8?q?=E6=97=B6=E8=A2=AB=E5=85=B6=E4=BB=96=E6=8C=87=E4=BB=A4=E6=89=93?= =?UTF-8?q?=E6=96=AD=E5=90=8E=E6=B2=A1=E6=9C=89=E7=BB=A7=E7=BB=AD=E6=92=AD?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaomusic/xiaomusic.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xiaomusic/xiaomusic.py b/xiaomusic/xiaomusic.py index 509546f..afec419 100644 --- a/xiaomusic/xiaomusic.py +++ b/xiaomusic/xiaomusic.py @@ -301,6 +301,10 @@ class XiaoMusic: sec = min(8, int(len(value) / 3)) await asyncio.sleep(sec) self.log.info(f"do_tts ok. cur_music:{self.cur_music}") + await self.check_replay() + + # 继续播放被打断的歌曲 + async def check_replay(self): if self.isplaying() and not self.isdownloading(): # 继续播放歌曲 self.log.info("现在继续播放歌曲") @@ -634,6 +638,7 @@ class XiaoMusic: opvalue, oparg = self.match_cmd(query, ctrl_panel) if not opvalue: await asyncio.sleep(1) + await self.check_replay() continue try: @@ -688,9 +693,7 @@ class XiaoMusic: continue self.log.info(f"匹配到指令. opkey:{opkey} opvalue:{opvalue} oparg:{oparg}") return (opvalue, oparg) - if self.isplaying(): - self.log.info("未匹配到指令,自动停止") - return ("stop", "notts") + self.log.info(f"未匹配到指令 {query} {ctrl_panel}") return (None, None) # 判断是否播放下一首歌曲