From a8bca8fc59553ab08517e574b52983c1d64c638e Mon Sep 17 00:00:00 2001 From: "Formatter [BOT]" Date: Sat, 9 May 2026 14:30:21 +0000 Subject: [PATCH] =?UTF-8?q?Auto-format=20code=20=F0=9F=A7=B9=F0=9F=8C=9F?= =?UTF-8?q?=F0=9F=A4=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xiaomusic/config.py | 4 +++- xiaomusic/device_player.py | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/xiaomusic/config.py b/xiaomusic/config.py index 46910e6..fc9ea65 100644 --- a/xiaomusic/config.py +++ b/xiaomusic/config.py @@ -143,7 +143,9 @@ class Config: os.getenv("XIAOMUSIC_ENABLE_FUZZY_MATCH", "true").lower() == "true" ) # 模糊搜索返回的最大结果数量(用于多结果选择功能) - fuzzy_match_max_results: int = int(os.getenv("XIAOMUSIC_FUZZY_MATCH_MAX_RESULTS", "100")) + fuzzy_match_max_results: int = int( + os.getenv("XIAOMUSIC_FUZZY_MATCH_MAX_RESULTS", "100") + ) stop_tts_msg: str = os.getenv("XIAOMUSIC_STOP_TTS_MSG", "收到,再见") enable_config_example: bool = False diff --git a/xiaomusic/device_player.py b/xiaomusic/device_player.py index f08943b..dafd993 100644 --- a/xiaomusic/device_player.py +++ b/xiaomusic/device_player.py @@ -272,7 +272,9 @@ class XiaoMusicDevice: if len(names) > 1: self._pending_selection = names self._pending_selection_count = len(names) - selection_text = f"共找到{len(names)}条匹配记录,请重新呼叫小爱同学并告诉她第几个" + selection_text = ( + f"共找到{len(names)}条匹配记录,请重新呼叫小爱同学并告诉她第几个" + ) self.log.info(selection_text) await self.xiaomusic.do_tts(self.did, selection_text) return @@ -1068,7 +1070,11 @@ class XiaoMusicDevice: Args: index: 用户选择的序号(从1开始) """ - if not self._pending_selection or index < 1 or index > len(self._pending_selection): + if ( + not self._pending_selection + or index < 1 + or index > len(self._pending_selection) + ): await self.xiaomusic.do_tts(self.did, "选择无效") return