import{_ as a,c as i,a0 as n,o as t}from"./chunks/framework.p2VkXzrt.js";const d=JSON.parse('{"title":"【插件】自定义口令功能","description":"","frontmatter":{"title":"【插件】自定义口令功能"},"headers":[],"relativePath":"issues/105.md","filePath":"issues/105.md","lastUpdated":null}'),p={name:"issues/105.md"};function l(e,s,o,h,k,u){return t(),i("div",null,s[0]||(s[0]=[n(`<h1 id="【插件】自定义口令功能" tabindex="-1">【插件】自定义口令功能 <a class="header-anchor" href="#【插件】自定义口令功能" aria-label="Permalink to &quot;【插件】自定义口令功能&quot;" target="_self">​</a></h1><p>自定义口令配置需要配置到 config.json 文件里，使用 config.json 方式启动。参考 &lt;/issues/94.html&gt; 。</p><p>口令的配置方式见 config-example.json 文件。口令对应的代码需要写到 <code>plugins/</code> 目录下面，如果是容器启动，则需要把这个目录挂载出来。</p><p>config.json 格式是下面这样的。</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;hardware&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;L07A&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;account&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;password&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;mi_did&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;cookie&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;verbose&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;music_path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;music&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;conf_path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;hostname&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;192.168.2.5&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;port&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">8090</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;public_port&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;proxy&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">null</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;search_prefix&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;bilisearch:&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;ffmpeg_location&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;./ffmpeg/bin&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;active_cmd&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;play,random_play,playlocal,play_music_list,stop&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;exclude_dirs&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;@eaDir&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;music_path_depth&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">10</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;disable_httpauth&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;httpauth_username&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;admin&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;httpauth_password&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;admin&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;music_list_url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;music_list_json&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;disable_download&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;key_word_dict&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;播放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;play&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;播放本地歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;playlocal&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;关机&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stop&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;下一首&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;play_next&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;单曲循环&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;set_play_type_one&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;全部循环&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;set_play_type_all&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;随机播放&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;random_play&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;分钟后关机&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stop_after_minute&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;播放列表&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;play_music_list&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;刷新列表&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;gen_music_list&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;set_volume#&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;set_volume&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;get_volume#&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;get_volume&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;本地播放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;playlocal&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;play&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;暂停&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stop&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;停止&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stop&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;停止播放&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;stop&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;测试自定义口令&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;exec#code1(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">hello</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;测试链接&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;exec#httpget(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">https://github.com/hanxi/xiaomusic</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)&quot;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">    },</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;key_match_order&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;set_volume#&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;get_volume#&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;分钟后关机&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;播放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;下一首&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;单曲循环&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;全部循环&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;随机播放&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;关机&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;刷新列表&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;播放列表&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;播放本地歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;本地播放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;暂停&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;停止&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;停止播放&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;测试自定义口令&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">        &quot;测试链接&quot;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">    ],</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;use_music_api&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;use_music_audio_id&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;1582971365183456177&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;use_music_id&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;355454500&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;log_file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;/tmp/xiaomusic.txt&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;fuzzy_match_cutoff&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">0.6</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;enable_fuzzy_match&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;stop_tts_msg&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;收到,再见&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;keywords_playlocal&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;播放本地歌曲,本地播放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;keywords_play&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;播放歌曲,放歌曲&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;keywords_stop&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;关机,暂停,停止,停止播放&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">    &quot;user_key_word_dict&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;测试自定义口令&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;exec#code1(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">hello</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">        &quot;测试链接&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;exec#httpget(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">https://github.com/hanxi/xiaomusic</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">)&quot;</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">    }</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>配置自定义口令时，只需要配置 user_key_word_dict 即可，会自动插入到 key_word_dict 里的。配置格式是：</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span> &quot;测试自定义口令&quot;: &quot;exec#code1(\\&quot;hello\\&quot;)&quot;,</span></span></code></pre></div><p>其中 &quot;测试自定义口令&quot; 就是对小爱音箱说的，<code>&quot;exec#code1(\\&quot;hello\\&quot;)&quot;</code> 就是要执行的插件代码，代码以 <code>exec#</code> 开头，后面紧跟着执行代码。这里 code1 是一个插件函数，插件函数需要在 plugin 目录里实现，一个文件只会导出一个与文件名相同的插件函数。所以 code1 函数是在 plugin/code1.py 里实现的。</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>async def code1(arg1):</span></span>
<span class="line"><span>    global log, xiaomusic</span></span>
<span class="line"><span>    log.info(f&quot;code1:{arg1}&quot;)</span></span>
<span class="line"><span>    await xiaomusic.do_tts(&quot;你好，我是自定义的测试口令&quot;)</span></span></code></pre></div><p>这里只是演示了打印日志和让小爱音箱说话。还有一个示例插件是 httpget ，可以用来访问 url 。</p><p>比如下面这样配置的话，当对小爱音箱说测试链接时，会去访问 url ，可以用来很多其他的事情。</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>&quot;测试链接&quot;: &quot;exec#httpget(\\&quot;https://github.com/hanxi/xiaomusic\\&quot;)</span></span></code></pre></div><p>最后还需要在 <code>active_cmd</code> 中配上口令用于唤醒：</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>  &quot;active_cmd&quot;: &quot;play,set_random_play,playlocal,play_music_list,play_music_list_index,stop_after_minute,stop,测试自定义口令&quot;,</span></span></code></pre></div><p>感兴趣的可以体验一下，写了有什么好玩的插件也可以在这里分享，或者提 pr 合并进官方库里作为自带插件。</p><h2 id="评论" tabindex="-1">评论 <a class="header-anchor" href="#评论" aria-label="Permalink to &quot;评论&quot;" target="_self">​</a></h2><h3 id="评论-1-carson512" tabindex="-1">评论 1 - carson512 <a class="header-anchor" href="#评论-1-carson512" aria-label="Permalink to &quot;评论 1 - carson512&quot;" target="_self">​</a></h3><p>如果开启服务的状态下 如何唤醒才能调用原有的播放QQ 网易云？而特定唤醒词调用xiaoai播放？</p><hr><h3 id="评论-2-hanxi" tabindex="-1">评论 2 - hanxi <a class="header-anchor" href="#评论-2-hanxi" aria-label="Permalink to &quot;评论 2 - hanxi&quot;" target="_self">​</a></h3><blockquote><p>如果开启服务的状态下 如何唤醒才能调用原有的播放QQ 网易云？而特定唤醒词调用xiaoai播放？</p></blockquote><p>不使用 xiaomusic 的唤醒词就会调用音箱自带的，比如说播放音乐</p><hr><h3 id="评论-3-shellingford37" tabindex="-1">评论 3 - shellingford37 <a class="header-anchor" href="#评论-3-shellingford37" aria-label="Permalink to &quot;评论 3 - shellingford37&quot;" target="_self">​</a></h3><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>[23:26:12] [0.3.30] [INFO] xiaomusic.py:531: 收到消息:测试自定义口令 控制面板:False did:290874427</span></span>
<span class="line"><span>[23:26:12] [0.3.30] [INFO] xiaomusic.py:577: 完全匹配指令. query:测试自定义口令 opvalue:exec#code1(&quot;hello&quot;)</span></span>
<span class="line"><span>[23:26:12] [0.3.30] [INFO] code1.py:3: code1:hello</span></span>
<span class="line"><span>[23:26:12] [0.3.30] [ERROR] xiaomusic.py:542: Execption XiaoMusic.do_tts() missing 1 required positional argument: &#39;value&#39;</span></span>
<span class="line"><span>Traceback (most recent call last):</span></span>
<span class="line"><span>  File &quot;/app/xiaomusic/xiaomusic.py&quot;, line 540, in do_check_cmd</span></span>
<span class="line"><span>    await func(did=did, arg1=oparg)</span></span>
<span class="line"><span>  File &quot;/app/xiaomusic/xiaomusic.py&quot;, line 890, in exec</span></span>
<span class="line"><span>    await self.plugin_manager.execute_plugin(code)</span></span>
<span class="line"><span>  File &quot;/app/xiaomusic/plugin.py&quot;, line 66, in execute_plugin</span></span>
<span class="line"><span>    await coroutine</span></span>
<span class="line"><span>  File &quot;/app/plugins/code1.py&quot;, line 4, in code1</span></span>
<span class="line"><span>    await xiaomusic.do_tts(&quot;你好，我是自定义的测试口令&quot;)</span></span>
<span class="line"><span>TypeError: XiaoMusic.do_tts() missing 1 required positional argument: &#39;value&#39;</span></span></code></pre></div><p>我用code1的代码执行报错，有大佬知道为什么吗？</p><hr><h3 id="评论-4-hanxi" tabindex="-1">评论 4 - hanxi <a class="header-anchor" href="#评论-4-hanxi" aria-label="Permalink to &quot;评论 4 - hanxi&quot;" target="_self">​</a></h3><p>@shellingford37 重构后漏改了，修复了。</p><hr><h3 id="评论-5-guoxiangke" tabindex="-1">评论 5 - guoxiangke <a class="header-anchor" href="#评论-5-guoxiangke" aria-label="Permalink to &quot;评论 5 - guoxiangke&quot;" target="_self">​</a></h3><p>先说播放歌曲，再说 测试自定义口令 就行</p><hr><h3 id="评论-6-czjcc" tabindex="-1">评论 6 - CZJCC <a class="header-anchor" href="#评论-6-czjcc" aria-label="Permalink to &quot;评论 6 - CZJCC&quot;" target="_self">​</a></h3><p>想请教下插件那个功能，如何把用户的语音输入作为参数内容传到自定义函数里</p><hr><h3 id="评论-7-hanxi" tabindex="-1">评论 7 - hanxi <a class="header-anchor" href="#评论-7-hanxi" aria-label="Permalink to &quot;评论 7 - hanxi&quot;" target="_self">​</a></h3><blockquote><p>想请教下插件那个功能，如何把用户的语音输入作为参数内容传到自定义函数里</p></blockquote><p>现在获取不到，等我加个接口获取吧。</p><hr><h3 id="评论-8-czjcc" tabindex="-1">评论 8 - CZJCC <a class="header-anchor" href="#评论-8-czjcc" aria-label="Permalink to &quot;评论 8 - CZJCC&quot;" target="_self">​</a></h3><p>666,支持以后我可以贡献一个接入通义模型的插件</p><hr><h3 id="评论-9-hanxi" tabindex="-1">评论 9 - hanxi <a class="header-anchor" href="#评论-9-hanxi" aria-label="Permalink to &quot;评论 9 - hanxi&quot;" target="_self">​</a></h3><p>@CZJCC 你可以更新看看 plugins/code1.py 的测试代码，我测试了是可以拿到语音输入的原始内容的。</p><hr><h3 id="评论-10-hanxi" tabindex="-1">评论 10 - hanxi <a class="header-anchor" href="#评论-10-hanxi" aria-label="Permalink to &quot;评论 10 - hanxi&quot;" target="_self">​</a></h3><p>文档更新了下，active_cmd 也需要配置一下才能正常唤醒。</p><hr><h3 id="评论-11-czjcc" tabindex="-1">评论 11 - CZJCC <a class="header-anchor" href="#评论-11-czjcc" aria-label="Permalink to &quot;评论 11 - CZJCC&quot;" target="_self">​</a></h3><blockquote><p>@CZJCC 你可以更新看看 plugins/code1.py 的测试代码，我测试了是可以拿到语音输入的原始内容的。</p></blockquote><p>我原先设想的事用户的话术是”通义提问为什么地球是圆的“，指令匹配的时候通义提问前缀匹配到类似于code1方法，为什么地球是圆的作为参数传入这个函数，但我看现在是拿历史记录实现的</p><hr><h3 id="评论-12-hanxi" tabindex="-1">评论 12 - hanxi <a class="header-anchor" href="#评论-12-hanxi" aria-label="Permalink to &quot;评论 12 - hanxi&quot;" target="_self">​</a></h3><p>是的，插件函数里面再切割一下前缀就行。last_record就是当前的那条语音数据。</p><hr><h3 id="评论-13-hanxi" tabindex="-1">评论 13 - hanxi <a class="header-anchor" href="#评论-13-hanxi" aria-label="Permalink to &quot;评论 13 - hanxi&quot;" target="_self">​</a></h3><blockquote><blockquote><p>@CZJCC 你可以更新看看 plugins/code1.py 的测试代码，我测试了是可以拿到语音输入的原始内容的。</p></blockquote><p>我原先设想的事用户的话术是”通义提问为什么地球是圆的“，指令匹配的时候通义提问前缀匹配到类似于code1方法，为什么地球是圆的作为参数传入这个函数，但我看现在是拿历史记录实现的</p></blockquote><p>是的，这样比较简单，交给插件里面处理也比较自由。</p><hr><h3 id="评论-14-mogeqian" tabindex="-1">评论 14 - mogeqian <a class="header-anchor" href="#评论-14-mogeqian" aria-label="Permalink to &quot;评论 14 - mogeqian&quot;" target="_self">​</a></h3><p>key_word_dict中的“播放歌曲”口令是不能修改的是吧？因为以前用小爱同学播放歌曲说习惯了，总是触发xiaomusic自动下载歌曲，我想把口令改成“查找歌曲”，这样我当说播放歌曲的时候就调用网易云音乐或者QQ音乐，当我说查找歌曲的时候就先看本地有没有歌曲，没有话就自动下载到本地。 当我先按照config-example.json的模板写好如下配置并重命名为config.json</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>  &quot;key_word_dict&quot;: {</span></span>
<span class="line"><span>    &quot;查找歌曲&quot;: &quot;play&quot;,</span></span>
<span class="line"><span>    &quot;播放本地歌曲&quot;: &quot;playlocal&quot;,</span></span>
<span class="line"><span>    &quot;关机&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;下一首&quot;: &quot;play_next&quot;,</span></span>
<span class="line"><span>    &quot;单曲循环&quot;: &quot;set_play_type_one&quot;,</span></span>
<span class="line"><span>    &quot;全部循环&quot;: &quot;set_play_type_all&quot;,</span></span>
<span class="line"><span>    &quot;随机播放&quot;: &quot;set_random_play&quot;,</span></span>
<span class="line"><span>    &quot;分钟后关机&quot;: &quot;stop_after_minute&quot;,</span></span>
<span class="line"><span>    &quot;播放列表&quot;: &quot;play_music_list&quot;,</span></span>
<span class="line"><span>    &quot;刷新列表&quot;: &quot;gen_music_list&quot;,</span></span>
<span class="line"><span>    &quot;本地播放歌曲&quot;: &quot;playlocal&quot;,</span></span>
<span class="line"><span>    &quot;下载歌曲&quot;: &quot;play&quot;,</span></span>
<span class="line"><span>    &quot;暂停&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;停止&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;停止播放&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;测试自定义口令&quot;: &quot;exec#code1(\\&quot;hello\\&quot;)&quot;,</span></span>
<span class="line"><span>    &quot;测试链接&quot;: &quot;exec#httpget(\\&quot;https://github.com/hanxi/xiaomusic\\&quot;)&quot;</span></span>
<span class="line"><span>  },</span></span>
<span class="line"><span>  &quot;key_match_order&quot;: [</span></span>
<span class="line"><span>    &quot;分钟后关机&quot;,</span></span>
<span class="line"><span>    &quot;查找歌曲&quot;,</span></span>
<span class="line"><span>    &quot;下一首&quot;,</span></span>
<span class="line"><span>    &quot;单曲循环&quot;,</span></span>
<span class="line"><span>    &quot;全部循环&quot;,</span></span>
<span class="line"><span>    &quot;随机播放&quot;,</span></span>
<span class="line"><span>    &quot;关机&quot;,</span></span>
<span class="line"><span>    &quot;刷新列表&quot;,</span></span>
<span class="line"><span>    &quot;播放列表&quot;,</span></span>
<span class="line"><span>    &quot;播放本地歌曲&quot;,</span></span>
<span class="line"><span>    &quot;本地播放歌曲&quot;,</span></span>
<span class="line"><span>    &quot;下载歌曲&quot;,</span></span>
<span class="line"><span>    &quot;暂停&quot;,</span></span>
<span class="line"><span>    &quot;停止&quot;,</span></span>
<span class="line"><span>    &quot;停止播放&quot;,</span></span>
<span class="line"><span>    &quot;测试自定义口令&quot;,</span></span>
<span class="line"><span>    &quot;测试链接&quot;</span></span>
<span class="line"><span>  ],</span></span></code></pre></div><p>用以下命令安装docker <code>docker run --name xiaomusic -p 5488:5488 -v /mnt/sharedata/audiodata/musci/xiaomusic:/app/music -v /mnt/data_sdb1/docker/xiaomusic/config.json:/app/config.json -e XIAOMUSIC_PORT=5488 hanxi/xiaomusic --config /app/config.json</code> 日志里提示的依然是：</p><p><code> key_word_dict={&#39;播放歌曲&#39;: &#39;play&#39;, &#39;播放本地歌曲&#39;: &#39;playlocal&#39;, &#39;关机&#39;: &#39;stop&#39;, &#39;下一首&#39;: &#39;play_next&#39;, &#39;上一首&#39;: &#39;play_prev&#39;, &#39;单曲循环&#39;: &#39;set_play_type_one&#39;, &#39;全部循环&#39;: &#39;set_play_type_all&#39;, &#39;随机播放&#39;: &#39;set_random_play&#39;, &#39;分钟后关机&#39;: &#39;stop_after_minute&#39;, &#39;播放列表&#39;: &#39;play_music_list&#39;, &#39;刷新列表&#39;: &#39;gen_music_list&#39;, &#39;加入收藏&#39;: &#39;add_to_favorites&#39;, &#39;收藏歌曲&#39;: &#39;add_to_favorites&#39;, &#39;取消收藏&#39;: &#39;del_from_favorites&#39;, &#39;播放列表第&#39;: &#39;play_music_list_index&#39;, &#39;本地播放歌曲&#39;: &#39;playlocal&#39;, &#39;查找歌曲&#39;: &#39;play&#39;, &#39;下载歌曲&#39;: &#39;play&#39;, &#39;暂停&#39;: &#39;stop&#39;, &#39;停止&#39;: &#39;stop&#39;, &#39;停止播放&#39;: &#39;stop&#39;, &#39;播放歌单&#39;: &#39;play_music_list&#39;, &#39;测试自定义口令&#39;: &#39;exec#code1(&quot;hello&quot;)&#39;, &#39;测试链接&#39;: &#39;exec#httpget(&quot;https://github.com/hanxi/xiaomusic&quot;)&#39;}, key_match_order=[&#39;分钟后关机&#39;, &#39;播放歌曲&#39;, &#39;下一首&#39;, &#39;上一首&#39;, &#39;单曲循环&#39;, &#39;全部循环&#39;, &#39;随机播放&#39;, &#39;关机&#39;, &#39;刷新列表&#39;, &#39;播放列表第&#39;, &#39;播放列表&#39;, &#39;加入收藏&#39;, &#39;收藏歌曲&#39;, &#39;取消收藏&#39;, &#39;播放本地歌曲&#39;, &#39;本地播放歌曲&#39;, &#39;查找歌曲&#39;, &#39;下载歌曲&#39;, &#39;暂停&#39;, &#39;停止&#39;, &#39;停止播放&#39;, &#39;播放歌单&#39;, &#39;测试自定义口令&#39;, &#39;测试链接&#39;]</code></p><p>似乎自定义的口令只能以插入的方式添加上去，并不能替换掉原来的口令</p><hr><h3 id="评论-15-hanxi" tabindex="-1">评论 15 - hanxi <a class="header-anchor" href="#评论-15-hanxi" aria-label="Permalink to &quot;评论 15 - hanxi&quot;" target="_self">​</a></h3><blockquote><p>key_word_dict中的“播放歌曲”口令是不能修改的是吧？因为以前用小爱同学播放歌曲说习惯了，总是触发xiaomusic自动下载歌曲，我想把口令改成“查找歌曲”，这样我当说播放歌曲的时候就调用网易云音乐或者QQ音乐，当我说查找歌曲的时候就先看本地有没有歌曲，没有话就自动下载到本地。 当我先按照config-example.json的模板写好如下配置并重命名为config.json</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>  &quot;key_word_dict&quot;: {</span></span>
<span class="line"><span>    &quot;查找歌曲&quot;: &quot;play&quot;,</span></span>
<span class="line"><span>    &quot;播放本地歌曲&quot;: &quot;playlocal&quot;,</span></span>
<span class="line"><span>    &quot;关机&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;下一首&quot;: &quot;play_next&quot;,</span></span>
<span class="line"><span>    &quot;单曲循环&quot;: &quot;set_play_type_one&quot;,</span></span>
<span class="line"><span>    &quot;全部循环&quot;: &quot;set_play_type_all&quot;,</span></span>
<span class="line"><span>    &quot;随机播放&quot;: &quot;set_random_play&quot;,</span></span>
<span class="line"><span>    &quot;分钟后关机&quot;: &quot;stop_after_minute&quot;,</span></span>
<span class="line"><span>    &quot;播放列表&quot;: &quot;play_music_list&quot;,</span></span>
<span class="line"><span>    &quot;刷新列表&quot;: &quot;gen_music_list&quot;,</span></span>
<span class="line"><span>    &quot;本地播放歌曲&quot;: &quot;playlocal&quot;,</span></span>
<span class="line"><span>    &quot;下载歌曲&quot;: &quot;play&quot;,</span></span>
<span class="line"><span>    &quot;暂停&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;停止&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;停止播放&quot;: &quot;stop&quot;,</span></span>
<span class="line"><span>    &quot;测试自定义口令&quot;: &quot;exec#code1(\\&quot;hello\\&quot;)&quot;,</span></span>
<span class="line"><span>    &quot;测试链接&quot;: &quot;exec#httpget(\\&quot;https://github.com/hanxi/xiaomusic\\&quot;)&quot;</span></span>
<span class="line"><span>  },</span></span>
<span class="line"><span>  &quot;key_match_order&quot;: [</span></span>
<span class="line"><span>    &quot;分钟后关机&quot;,</span></span>
<span class="line"><span>    &quot;查找歌曲&quot;,</span></span>
<span class="line"><span>    &quot;下一首&quot;,</span></span>
<span class="line"><span>    &quot;单曲循环&quot;,</span></span>
<span class="line"><span>    &quot;全部循环&quot;,</span></span>
<span class="line"><span>    &quot;随机播放&quot;,</span></span>
<span class="line"><span>    &quot;关机&quot;,</span></span>
<span class="line"><span>    &quot;刷新列表&quot;,</span></span>
<span class="line"><span>    &quot;播放列表&quot;,</span></span>
<span class="line"><span>    &quot;播放本地歌曲&quot;,</span></span>
<span class="line"><span>    &quot;本地播放歌曲&quot;,</span></span>
<span class="line"><span>    &quot;下载歌曲&quot;,</span></span>
<span class="line"><span>    &quot;暂停&quot;,</span></span>
<span class="line"><span>    &quot;停止&quot;,</span></span>
<span class="line"><span>    &quot;停止播放&quot;,</span></span>
<span class="line"><span>    &quot;测试自定义口令&quot;,</span></span>
<span class="line"><span>    &quot;测试链接&quot;</span></span>
<span class="line"><span>  ],</span></span></code></pre></div><p>用以下命令安装docker <code>docker run --name xiaomusic -p 5488:5488 -v /mnt/sharedata/audiodata/musci/xiaomusic:/app/music -v /mnt/data_sdb1/docker/xiaomusic/config.json:/app/config.json -e XIAOMUSIC_PORT=5488 hanxi/xiaomusic --config /app/config.json</code> 日志里提示的依然是：</p><p><code> key_word_dict={&#39;播放歌曲&#39;: &#39;play&#39;, &#39;播放本地歌曲&#39;: &#39;playlocal&#39;, &#39;关机&#39;: &#39;stop&#39;, &#39;下一首&#39;: &#39;play_next&#39;, &#39;上一首&#39;: &#39;play_prev&#39;, &#39;单曲循环&#39;: &#39;set_play_type_one&#39;, &#39;全部循环&#39;: &#39;set_play_type_all&#39;, &#39;随机播放&#39;: &#39;set_random_play&#39;, &#39;分钟后关机&#39;: &#39;stop_after_minute&#39;, &#39;播放列表&#39;: &#39;play_music_list&#39;, &#39;刷新列表&#39;: &#39;gen_music_list&#39;, &#39;加入收藏&#39;: &#39;add_to_favorites&#39;, &#39;收藏歌曲&#39;: &#39;add_to_favorites&#39;, &#39;取消收藏&#39;: &#39;del_from_favorites&#39;, &#39;播放列表第&#39;: &#39;play_music_list_index&#39;, &#39;本地播放歌曲&#39;: &#39;playlocal&#39;, &#39;查找歌曲&#39;: &#39;play&#39;, &#39;下载歌曲&#39;: &#39;play&#39;, &#39;暂停&#39;: &#39;stop&#39;, &#39;停止&#39;: &#39;stop&#39;, &#39;停止播放&#39;: &#39;stop&#39;, &#39;播放歌单&#39;: &#39;play_music_list&#39;, &#39;测试自定义口令&#39;: &#39;exec#code1(&quot;hello&quot;)&#39;, &#39;测试链接&#39;: &#39;exec#httpget(&quot;https://github.com/hanxi/xiaomusic&quot;)&#39;}, key_match_order=[&#39;分钟后关机&#39;, &#39;播放歌曲&#39;, &#39;下一首&#39;, &#39;上一首&#39;, &#39;单曲循环&#39;, &#39;全部循环&#39;, &#39;随机播放&#39;, &#39;关机&#39;, &#39;刷新列表&#39;, &#39;播放列表第&#39;, &#39;播放列表&#39;, &#39;加入收藏&#39;, &#39;收藏歌曲&#39;, &#39;取消收藏&#39;, &#39;播放本地歌曲&#39;, &#39;本地播放歌曲&#39;, &#39;查找歌曲&#39;, &#39;下载歌曲&#39;, &#39;暂停&#39;, &#39;停止&#39;, &#39;停止播放&#39;, &#39;播放歌单&#39;, &#39;测试自定义口令&#39;, &#39;测试链接&#39;]</code></p><p>似乎自定义的口令只能以插入的方式添加上去，并不能替换掉原来的口令</p></blockquote><p>可以在网页后台设置页面改。</p><hr><h3 id="评论-16-mogeqian" tabindex="-1">评论 16 - mogeqian <a class="header-anchor" href="#评论-16-mogeqian" aria-label="Permalink to &quot;评论 16 - mogeqian&quot;" target="_self">​</a></h3><p>不行，后台设置如图 <img src="https://github.com/user-attachments/assets/cc89512f-cab9-488d-b0d6-5b2a3a720ac2" alt="QQ截图20241111181411"> 日志如下：</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:1130: update_config_from_setting ok. data:Config(account=&#39;**&#39;, password=&#39;**&#39;, mi_did=&#39;726577518,570867755&#39;, miio_tts_command=&#39;&#39;, cookie=&#39;&#39;, verbose=False, music_path=&#39;music&#39;, download_path=&#39;music/download&#39;, conf_path=&#39;conf&#39;, cache_dir=&#39;cache&#39;, hostname=&#39;192.168.22.4&#39;, port=8090, public_port=0, proxy=&#39;&#39;, search_prefix=&#39;bilisearch:&#39;, ffmpeg_location=&#39;./ffmpeg/bin&#39;, active_cmd=&#39;play,set_random_play,playlocal,play_music_list,stop&#39;, exclude_dirs=&#39;@eaDir&#39;, music_path_depth=10, disable_httpauth=True, httpauth_username=&#39;******&#39;, httpauth_password=&#39;******&#39;, music_list_url=&#39;&#39;, music_list_json=&#39;&#39;, custom_play_list_json=&#39;&#39;, disable_download=False, key_word_dict={&#39;播放歌曲&#39;: &#39;play&#39;, &#39;播放本地歌曲&#39;: &#39;playlocal&#39;, &#39;关机&#39;: &#39;stop&#39;, &#39;下一首&#39;: &#39;play_next&#39;, &#39;上一首&#39;: &#39;play_prev&#39;, &#39;单曲循环&#39;: &#39;set_play_type_one&#39;, &#39;全部循环&#39;: &#39;set_play_type_all&#39;, &#39;随机播放&#39;: &#39;set_random_play&#39;, &#39;分钟后关机&#39;: &#39;stop_after_minute&#39;, &#39;播放列表&#39;: &#39;play_music_list&#39;, &#39;刷新列表&#39;: &#39;gen_music_list&#39;, &#39;加入收藏&#39;: &#39;add_to_favorites&#39;, &#39;收藏歌曲&#39;: &#39;add_to_favorites&#39;, &#39;取消收藏&#39;: &#39;del_from_favorites&#39;, &#39;播放列表第&#39;: &#39;play_music_list_index&#39;, &#39;本地播放歌曲&#39;: &#39;playlocal&#39;, &#39;查找歌曲&#39;: &#39;play&#39;, &#39;下载歌曲&#39;: &#39;play&#39;, &#39;暂停&#39;: &#39;stop&#39;, &#39;停止&#39;: &#39;stop&#39;, &#39;停止播放&#39;: &#39;stop&#39;, &#39;播放歌单&#39;: &#39;play_music_list&#39;, &#39;测试自定义口令&#39;: &#39;exec#code1(&quot;hello&quot;)&#39;, &#39;测试链接&#39;: &#39;exec#httpget(&quot;https://github.com/hanxi/xiaomusic&quot;)&#39;}, key_match_order=[&#39;分钟后关机&#39;, &#39;播放歌曲&#39;, &#39;下一首&#39;, &#39;上一首&#39;, &#39;单曲循环&#39;, &#39;全部循环&#39;, &#39;随机播放&#39;, &#39;关机&#39;, &#39;刷新列表&#39;, &#39;播放列表第&#39;, &#39;播放列表&#39;, &#39;加入收藏&#39;, &#39;收藏歌曲&#39;, &#39;取消收藏&#39;, &#39;播放本地歌曲&#39;, &#39;本地播放歌曲&#39;, &#39;查找歌曲&#39;, &#39;下载歌曲&#39;, &#39;暂停&#39;, &#39;停止&#39;, &#39;停止播放&#39;, &#39;播放歌单&#39;, &#39;测试自定义口令&#39;, &#39;测试链接&#39;], use_music_api=False, use_music_audio_id=&#39;1582971365183456177&#39;, use_music_id=&#39;355454500&#39;, log_file=&#39;/tmp/xiaomusic.txt&#39;, fuzzy_match_cutoff=0.6, enable_fuzzy_match=True, stop_tts_msg=&#39;收到,再见&#39;, enable_config_example=False, keywords_playlocal=&#39;播放本地歌曲,本地播放歌曲&#39;, keywords_play=&#39;查找歌曲,下载歌曲&#39;, keywords_stop=&#39;关机,暂停,停止,停止播放&#39;, keywords_playlist=&#39;播放列表,播放歌单&#39;, user_key_word_dict={&#39;测试自定义口令&#39;: &#39;exec#code1(&quot;hello&quot;)&#39;, &#39;测试链接&#39;: &#39;exec#httpget(&quot;https://github.com/hanxi/xiaomusic&quot;)&#39;}, enable_force_stop=False, devices={&#39;726577518&#39;: Device(did=&#39;726577518&#39;, device_id=&#39;******&#39;, hardware=&#39;LX06&#39;, name=&#39;小爱音箱Pro&#39;, play_type=&#39;&#39;, cur_music=&#39;&#39;, cur_playlist=&#39;全部&#39;), &#39;570867755&#39;: Device(did=&#39;570867755&#39;, device_id=&#39;*********&#39;, hardware=&#39;L15A&#39;, name=&#39;小米AI音箱(第二代)&#39;, play_type=&#39;&#39;, cur_music=&#39;&#39;, cur_playlist=&#39;全部&#39;)}, group_list=&#39;&#39;, remove_id3tag=False, convert_to_mp3=False, delay_sec=3, continue_play=False, pull_ask_sec=1, crontab_json=&#39;&#39;, enable_yt_dlp_cookies=False, get_ask_by_mina=False)</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:1133: 语音控制已启动, 用【分钟后关机/播放歌曲/下一首/上一首/单曲循环/全部循环/随机播放/关机/刷新列表/播放列表第/播放列表/加入收藏/收藏歌曲/取消收藏/播放本地歌曲/本地播放歌曲/查找歌曲/下载歌曲/暂停/停止/停止播放/播放歌单/测试自定义口令/测试链接】开头来控制</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:543: 协程时间循环未启动</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:1250: 没打乱 全部 [&#39;乌兰托娅 火红的萨日朗&#39;, &#39;凤凰传奇麝香夫人&#39;] ... [&#39;罗大佑童年&#39;, &#39;阿嬷&#39;] with len: 7</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:1250: 没打乱 全部 [&#39;乌兰托娅 火红的萨日朗&#39;, &#39;凤凰传奇麝香夫人&#39;] ... [&#39;罗大佑童年&#39;, &#39;阿嬷&#39;] with len: 7</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] analytics.py:28: analytics init ok</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:104: Startup OK. Config(account=&#39;***&#39;, password=&#39;***&#39;, mi_did=&#39;726577518,570867755&#39;, miio_tts_command=&#39;&#39;, cookie=&#39;&#39;, verbose=False, music_path=&#39;music&#39;, download_path=&#39;music/download&#39;, conf_path=&#39;conf&#39;, cache_dir=&#39;cache&#39;, hostname=&#39;192.168.22.4&#39;, port=8090, public_port=0, proxy=&#39;&#39;, search_prefix=&#39;bilisearch:&#39;, ffmpeg_location=&#39;./ffmpeg/bin&#39;, active_cmd=&#39;play,set_random_play,playlocal,play_music_list,stop&#39;, exclude_dirs=&#39;@eaDir&#39;, music_path_depth=10, disable_httpauth=True, httpauth_username=&#39;******&#39;, httpauth_password=&#39;******&#39;, music_list_url=&#39;&#39;, music_list_json=&#39;&#39;, custom_play_list_json=&#39;&#39;, disable_download=False, key_word_dict={&#39;播放歌曲&#39;: &#39;play&#39;, &#39;播放本地歌曲&#39;: &#39;playlocal&#39;, &#39;关机&#39;: &#39;stop&#39;, &#39;下一首&#39;: &#39;play_next&#39;, &#39;上一首&#39;: &#39;play_prev&#39;, &#39;单曲循环&#39;: &#39;set_play_type_one&#39;, &#39;全部循环&#39;: &#39;set_play_type_all&#39;, &#39;随机播放&#39;: &#39;set_random_play&#39;, &#39;分钟后关机&#39;: &#39;stop_after_minute&#39;, &#39;播放列表&#39;: &#39;play_music_list&#39;, &#39;刷新列表&#39;: &#39;gen_music_list&#39;, &#39;加入收藏&#39;: &#39;add_to_favorites&#39;, &#39;收藏歌曲&#39;: &#39;add_to_favorites&#39;, &#39;取消收藏&#39;: &#39;del_from_favorites&#39;, &#39;播放列表第&#39;: &#39;play_music_list_index&#39;, &#39;本地播放歌曲&#39;: &#39;playlocal&#39;, &#39;查找歌曲&#39;: &#39;play&#39;, &#39;下载歌曲&#39;: &#39;play&#39;, &#39;暂停&#39;: &#39;stop&#39;, &#39;停止&#39;: &#39;stop&#39;, &#39;停止播放&#39;: &#39;stop&#39;, &#39;播放歌单&#39;: &#39;play_music_list&#39;, &#39;测试自定义口令&#39;: &#39;exec#code1(&quot;hello&quot;)&#39;, &#39;测试链接&#39;: &#39;exec#httpget(&quot;https://github.com/hanxi/xiaomusic&quot;)&#39;}, key_match_order=[&#39;分钟后关机&#39;, &#39;播放歌曲&#39;, &#39;下一首&#39;, &#39;上一首&#39;, &#39;单曲循环&#39;, &#39;全部循环&#39;, &#39;随机播放&#39;, &#39;关机&#39;, &#39;刷新列表&#39;, &#39;播放列表第&#39;, &#39;播放列表&#39;, &#39;加入收藏&#39;, &#39;收藏歌曲&#39;, &#39;取消收藏&#39;, &#39;播放本地歌曲&#39;, &#39;本地播放歌曲&#39;, &#39;查找歌曲&#39;, &#39;下载歌曲&#39;, &#39;暂停&#39;, &#39;停止&#39;, &#39;停止播放&#39;, &#39;播放歌单&#39;, &#39;测试自定义口令&#39;, &#39;测试链接&#39;], use_music_api=False, use_music_audio_id=&#39;1582971365183456177&#39;, use_music_id=&#39;355454500&#39;, log_file=&#39;/tmp/xiaomusic.txt&#39;, fuzzy_match_cutoff=0.6, enable_fuzzy_match=True, stop_tts_msg=&#39;收到,再见&#39;, enable_config_example=False, keywords_playlocal=&#39;播放本地歌曲,本地播放歌曲&#39;, keywords_play=&#39;查找歌曲,下载歌曲&#39;, keywords_stop=&#39;关机,暂停,停止,停止播放&#39;, keywords_playlist=&#39;播放列表,播放歌单&#39;, user_key_word_dict={&#39;测试自定义口令&#39;: &#39;exec#code1(&quot;hello&quot;)&#39;, &#39;测试链接&#39;: &#39;exec#httpget(&quot;https://github.com/hanxi/xiaomusic&quot;)&#39;}, enable_force_stop=False, devices={&#39;726577518&#39;: Device(did=&#39;726577518&#39;, device_id=&#39;*****&#39;, hardware=&#39;LX06&#39;, name=&#39;小爱音箱Pro&#39;, play_type=&#39;&#39;, cur_music=&#39;&#39;, cur_playlist=&#39;全部&#39;), &#39;570867755&#39;: Device(did=&#39;570867755&#39;, device_id=&#39;*********&#39;, hardware=&#39;L15A&#39;, name=&#39;小米AI音箱(第二代)&#39;, play_type=&#39;&#39;, cur_music=&#39;&#39;, cur_playlist=&#39;全部&#39;)}, group_list=&#39;&#39;, remove_id3tag=False, convert_to_mp3=False, delay_sec=3, continue_play=False, pull_ask_sec=1, crontab_json=&#39;&#39;, enable_yt_dlp_cookies=False, get_ask_by_mina=False)</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] httpserver.py:111: disable_httpauth:True</span></span>
<span class="line"><span>[18:08:04] [0.3.46] [INFO] Started server process [1]</span></span>
<span class="line"><span>[18:08:04] [0.3.46] [INFO] Waiting for application startup.</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:541: 启动后台构建 tag cache</span></span>
<span class="line"><span>[18:08:04] [0.3.46] [INFO] Application startup complete.</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:513: 已从【cache/tag_cache.json】加载 tag cache</span></span>
<span class="line"><span>[18:08:04] [0.3.46] [INFO] Uvicorn running on http://[&#39;0.0.0.0&#39;, &#39;::&#39;]:8090 (Press CTRL+C to quit)</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:527: 保存：tag cache 已保存到【cache/tag_cache.json】</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:577: tag 更新完成</span></span>
<span class="line"><span>[2024-11-11 18:08:04] [0.3.46] [INFO] xiaomusic.py:248: 选中的设备: {&#39;726577518&#39;: Device(did=&#39;726577518&#39;, device_id=&#39;******&#39;, hardware=&#39;LX06&#39;, name=&#39;小爱音箱Pro&#39;, play_type=&#39;&#39;, cur_music=&#39;&#39;, cur_playlist=&#39;全部&#39;), &#39;570867755&#39;: Device(did=&#39;570867755&#39;, device_id=&#39;*********&#39;, hardware=&#39;L15A&#39;, name=&#39;小米AI音箱(第二代)&#39;, play_type=&#39;&#39;, cur_music=&#39;&#39;, cur_playlist=&#39;全部&#39;)}</span></span>
<span class="line"><span>[18:08:34] [0.3.46] [INFO] 172.20.0.1:35058 - &quot;GET /static/default/setting.html HTTP/1.1&quot; 304</span></span>
<span class="line"><span>[18:08:34] [0.3.46] [INFO] 172.20.0.1:35058 - &quot;GET /getversion HTTP/1.1&quot; 200</span></span></code></pre></div><p>使用的docker-compose命令安装 services: xiaomusic: image: hanxi/xiaomusic container_name: xiaomusic restart: unless-stopped ports: - 8090:8090 volumes: - /mnt/sharedata/audiodata/musci/xiaomusic:/app/music - /mnt/data_sdb1/docker/xiaomusic/config.json:/app/config.json command: [&#39;--config&#39;, &#39;/app/config.json&#39;]</p><p>根据日志的提示，&#39;播放歌曲&#39;: &#39;play&#39;依然存在，只是增加了 &#39;查找歌曲&#39;: &#39;play&#39;, &#39;下载歌曲&#39;: &#39;play&#39;, 这两个关于play的自定义口令，所以实际上play有三条口令 “播放歌曲、查找歌曲、下载歌曲”，能否删除掉&#39;播放歌曲&#39;: &#39;play&#39;这个系统默认的口令？只使用 &#39;查找歌曲&#39;: &#39;play&#39;, &#39;下载歌曲&#39;: &#39;play&#39;, 这两个关于play的自定义口令</p><hr><h3 id="评论-17-hanxi" tabindex="-1">评论 17 - hanxi <a class="header-anchor" href="#评论-17-hanxi" aria-label="Permalink to &quot;评论 17 - hanxi&quot;" target="_self">​</a></h3><p>@mogeqian 另外提个 issue 吧，现在应该是不支持删除默认的口令。</p><hr><h3 id="评论-18-mogeqian" tabindex="-1">评论 18 - mogeqian <a class="header-anchor" href="#评论-18-mogeqian" aria-label="Permalink to &quot;评论 18 - mogeqian&quot;" target="_self">​</a></h3><p>好的，已经重开了一个issue #259</p><hr><p><a href="https://github.com/hanxi/xiaomusic/issues/105" target="_self">链接到 GitHub Issue</a></p>`,84)]))}const r=a(p,[["render",l]]);export{d as __pageData,r as default};
