Skip to content

Commit

Permalink
feat: 支持替换默认口令,而不是追加 close #259
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxi committed Nov 19, 2024
1 parent 0c99f4d commit 323a832
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions xiaomusic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,12 @@
# 默认口令
def default_key_word_dict():
return {
"播放歌曲": "play",
"播放本地歌曲": "playlocal",
"关机": "stop",
"下一首": "play_next",
"上一首": "play_prev",
"单曲循环": "set_play_type_one",
"全部循环": "set_play_type_all",
"随机播放": "set_random_play",
"分钟后关机": "stop_after_minute",
"播放列表": "play_music_list",
"刷新列表": "gen_music_list",
"加入收藏": "add_to_favorites",
"收藏歌曲": "add_to_favorites",
Expand All @@ -47,7 +43,6 @@ def default_user_key_word_dict():
def default_key_match_order():
return [
"分钟后关机",
"播放歌曲",
"下一首",
"上一首",
"单曲循环",
Expand Down Expand Up @@ -188,6 +183,9 @@ def init_keyword(self):
self.append_keyword(self.keywords_stop, "stop")
self.append_keyword(self.keywords_playlist, "play_music_list")
self.append_user_keyword()
self.key_match_order = [
x for x in self.key_match_order if x in self.key_word_dict
]

def __post_init__(self) -> None:
if self.proxy:
Expand Down

0 comments on commit 323a832

Please sign in to comment.