提交config.json模板文件

This commit is contained in:
涵曦 2024-06-30 03:54:39 +00:00
parent 69573f3fa4
commit 27e9d92a0a
2 changed files with 34 additions and 1 deletions

28
config-example.json Normal file
View File

@ -0,0 +1,28 @@
{
"hardware": "L07A",
"account": "",
"password": "",
"mi_did": "",
"cookie": "",
"verbose": false,
"music_path": "music",
"conf_path": null,
"hostname": "192.168.2.5",
"port": 8090,
"proxy": null,
"search_prefix": "ytsearch:",
"ffmpeg_location": "./ffmpeg/bin",
"active_cmd": "play,random_play,playlocal,play_music_list,stop",
"exclude_dirs": "@eaDir",
"music_path_depth": 10,
"disable_httpauth": true,
"httpauth_username": "admin",
"httpauth_password": "admin",
"music_list_url": "",
"music_list_json": "",
"disable_download": false,
"use_music_api": false,
"log_file": "/tmp/xiaomusic.txt",
"fuzzy_match_cutoff": 0.6,
"enable_fuzzy_match": true
}

View File

@ -3,7 +3,7 @@ from __future__ import annotations
import argparse
import json
import os
from dataclasses import dataclass
from dataclasses import dataclass,asdict
from xiaomusic.utils import validate_proxy
@ -107,6 +107,11 @@ class Config:
keywords_stop = os.getenv("XIAOMUSIC_KEYWORDS_STOP", "关机,暂停,停止")
self.append_keyword(keywords_stop, "stop")
# 保存配置到 config-example.json 文件
#with open("config-example.json", "w") as f:
# data = asdict(self)
# json.dump(data, f, ensure_ascii=False, indent=4)
@classmethod
def from_options(cls, options: argparse.Namespace) -> Config:
config = {}