Skip to main content

Play Music with xiaomi AI speaker

Project description

xiaomusic

使用小爱同学播放音乐,音乐使用 yt-dlp 下载。

运行

  • 使用 install_dependencies.sh 下载依赖
  • 使用 pdm 安装环境
  • 参考 xiaogpt 设置好环境变量
export MI_USER="xxxxx"
export MI_PASS="xxxx"
export MI_DID=00000

然后启动即可。默认监听了端口 8090 , 使用其他端口自行修改。

pdm run xiaomusic.py

支持口令

  • 播放歌曲
  • 播放歌曲+歌名 比如:播放歌曲周杰伦晴天
  • 下一首
  • 单曲循环
  • 全部循环

已测试设备

"L07A": ("5-1", "5-5"),  # Redmi小爱音箱Play(l7a)

支持音乐格式

  • mp3
  • flac

本地音乐会搜索 mp3 和 flac 格式的文件,下载的歌曲是 mp3 格式的。

在 Docker 里使用

docker run -e MI_USER=<your-xiaomi-account> -e MI_PASS=<your-xiaomi-password> -e MI_DID=<your-xiaomi-speaker-mid> -e MI_HARDWARE='L07A' -e XIAOMUSIC_PROXY=<proxy-for-yt-dlp> -e XIAOMUSIC_HOSTNAME=192.168.2.5 -p 8090:8090 -v ./music:/app/music hanxi/xiaomusic
  • XIAOMUSIC_PROXY 用于配置代理,默认为空,yt-dlp 工具下载歌曲会用到。
  • MI_HARDWARE 是小米音箱的型号,默认为'L07A'
  • 注意端口必须映射为与容器内一致,XIAOMUSIC_HOSTNAME 需要设置为宿主机的 IP 地址,否则小爱无法正常播放。
  • 可以把 /app/music 目录映射到本地,用于保存下载的歌曲。

本地编译Docker Image

docker build -t xiaomusic .

感谢

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xiaomusic-0.1.5.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

xiaomusic-0.1.5-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file xiaomusic-0.1.5.tar.gz.

File metadata

  • Download URL: xiaomusic-0.1.5.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for xiaomusic-0.1.5.tar.gz
Algorithm Hash digest
SHA256 1c5e5e38ea9662514dc22962b4476a85cc503ffb6cce946030094445ce10d354
MD5 feb16ac9b9395eaacd0d906cde998a5e
BLAKE2b-256 99243e1073b7cc870bfbe32003218e9383c86d321f1c3f9b0ce85903d5c44525

See more details on using hashes here.

File details

Details for the file xiaomusic-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: xiaomusic-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for xiaomusic-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8c078113805f71826f8a25cf87d205e17fb6b4a4602b0cd4c94534c89bdd19cb
MD5 baa16eaf204b6e46e53d65c3e1cf3dd0
BLAKE2b-256 feda17e176593c655eb407b3427b756e1fe1d1c9bce72020062ef41d0e6af9c6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page