Skip to content

[ncm-cli] Windows: play command fails without TUI - mpv not spawned #5

@Aurore1221

Description

@Aurore1221

Environment

  • OS: Windows 11 (26200.8037)
  • ncm-cli: installed via npm install -g @music163/ncm-cli
  • mpv: v0.41.0 (installed via winget install shinchiro.mpv, located at C:\Program Files\MPV Player\mpv.exe)
  • Node.js: >= 18
  • Player config: ncm-cli config set player mpv

Problem

ncm-cli play --song does not work on Windows without TUI running. The command returns {"success": true, "message": "歌曲已发送到播放服务"} but no mpv process is spawned and playback state remains stopped.

With TUI running (user manually runs ncm-cli tui in a separate terminal): playback works perfectly. ncm-cli next, ncm-cli state, ncm-cli queue add all function correctly.

Without TUI running: the play command silently fails. mpv is never started.

This makes it impossible to use ncm-cli for programmatic playback (e.g., via Claude Code or other AI agents) without requiring the user to manually keep a TUI window open.

Steps to Reproduce

  1. ncm-cli config set player mpv → ✓
  2. ncm-cli login --check → ✓ logged in
  3. Close any TUI windows
  4. ncm-cli play --song --encrypted-id <id> --original-id <id>
  5. Response: {"success": true, "message": "歌曲已发送到播放服务"}
  6. ncm-cli state{"status": "stopped"}
  7. tasklist | grep mpv → no mpv process

Expected Behavior

ncm-cli play should be able to start mpv and play audio independently, without requiring TUI to be running. A headless/daemon playback mode would be ideal for AI agent integration scenarios.

Additional Context

  • The orpheus player option only supports macOS, leaving mpv as the only option on Windows
  • mpv is correctly installed and works when launched manually: "C:\Program Files\MPV Player\mpv.exe" --version → OK
  • The likely cause: mpv is not in the default system PATH (installed to C:\Program Files\MPV Player\), and ncm-cli may not be resolving the mpv binary path correctly outside of TUI context
  • Even after adding mpv to PATH (ncm-cli config set player mpv succeeds), the standalone play command still does not spawn mpv

Suggestion

  1. Support a headless daemon mode (e.g., ncm-cli daemon start) that manages mpv without TUI
  2. Or allow play to directly spawn mpv when no daemon/TUI is running
  3. On Windows, consider checking common installation paths for mpv (e.g., C:\Program Files\MPV Player\)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions