Skip to content

Commit

Permalink
feat: 唤醒口令配置支持配语音词,简化自定义口令配置 see #105
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxi committed Jul 8, 2024
1 parent 0ddbe58 commit 901506a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions xiaomusic/xiaomusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,17 @@ def match_cmd(self, query, ctrl_panel):
if opkey in KEY_WORD_ARG_BEFORE_DICT:
oparg = argpre
opvalue = self.config.key_word_dict.get(opkey)
if not ctrl_panel and not self.isplaying():
if self.active_cmd and opvalue not in self.active_cmd:
self.log.info(f"不在激活命令中 {opvalue}")
continue

if (
(not ctrl_panel)
and (not self.isplaying())
and self.active_cmd
and (opvalue not in self.active_cmd)
and (opkey not in self.active_cmd)
):
self.log.info(f"不在激活命令中 {opvalue}")
continue

self.log.info(f"匹配到指令. opkey:{opkey} opvalue:{opvalue} oparg:{oparg}")
return (opvalue, oparg)
self.log.info(f"未匹配到指令 {query} {ctrl_panel}")
Expand Down

0 comments on commit 901506a

Please sign in to comment.