Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

采用config.json配置方式 #94

Open
hanxi opened this issue Jun 30, 2024 · 3 comments
Open

采用config.json配置方式 #94

hanxi opened this issue Jun 30, 2024 · 3 comments
Labels
文档 帮助文档

Comments

@hanxi
Copy link
Owner

hanxi commented Jun 30, 2024

docker 方式部署默认推荐使用环境变量的方式来配置参数,如果是自己用命令行启动,目前支持的参数配置比较少,但是是支持 --config 参数。

使用 pip 安装 xiaomusic 【0.1.83版本才支持 pip 安装】

pip install xiaomusic

依赖的 ffmpeg 需要自己安装。

image

仓库中有个 config-example.json 文件,可以把这个文件拷贝为 config.json 然后修改 config.json 里的配置,再用下面的命令启动。

xiaomusic --config ./config.json

默认的 config.json 模板如下:

{
    "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
}

如果采用 docker compose 启动想用 config.json 的配置方式,可以这样配:

services:
  xiaomusic:
    image: hanxi/xiaomusic
    container_name: xiaomusic
    restart: unless-stopped
    ports:
      - 8090:8090
    volumes:
      - ./music:/app/music
      - ./config.json:/app/config.json
    command: ['--config', '/app/config.json']

主要就是把 config.json 文件映射进容器和传 --config 参数。

@hanxi hanxi added the 文档 帮助文档 label Jun 30, 2024
@alitime
Copy link

alitime commented Jun 30, 2024

正需要,有配置文件方便多了

@hanxi
Copy link
Owner Author

hanxi commented Jun 30, 2024

ffmpeg 如果是用 apt install 这类系统工具安装的,默认会在 /usr/bin 目录下,ffmpeg_location 这个参数就需要设置为 /usr/bin .

目前 armv7 cpu 的 docker 镜像里的 ffmpeg 有问题,最好是用 pip 方式安装运行。

@hanxi
Copy link
Owner Author

hanxi commented Jul 3, 2024

ffmpeg 如果是用 apt install 这类系统工具安装的,默认会在 /usr/bin 目录下,ffmpeg_location 这个参数就需要设置为 /usr/bin .

目前 armv7 cpu 的 docker 镜像里的 ffmpeg 有问题,最好是用 pip 方式安装运行。

armv7 问题已经解决。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
文档 帮助文档
Projects
None yet
Development

No branches or pull requests

2 participants