Skip to content

fix: make playback work on Windows#4

Merged
SuperCoolPencil merged 1 commit into
SuperCoolPencil:mainfrom
joshkerr:fix/windows-compat
May 12, 2026
Merged

fix: make playback work on Windows#4
SuperCoolPencil merged 1 commit into
SuperCoolPencil:mainfrom
joshkerr:fix/windows-compat

Conversation

@joshkerr

Copy link
Copy Markdown

Summary

Three independent fixes that together make cue usable on Windows. I hit these in order trying to play a movie with mpv (installed via scoop) on Windows 11.

1. Plex JSON decoder rejects boolean stream flags

Plex now returns stream flags (default, forced, selected, external) as JSON booleans on some servers, but plex.Stream declared them as int. ResolvePlayable failed with:

json: cannot unmarshal bool into Go struct field Stream...default of type int

…which surfaced in the TUI as a generic "failed to parse response" when pressing play. Fixed by introducing a flexBool type that accepts both forms.

2. No Windows path in the player launcher

detectPlayer only handled darwin / linux, so on Windows it fell through to launchDefault, which ran xdg-open — not a thing on Windows. Added a windowsPlayers list (mpv, vlc) and switched the default fallback to cmd /c start "" <url>.

3. mpv IPC used Unix domain sockets

net.Dial("unix", …) doesn't work on Windows — mpv's --input-ipc-server uses named pipes there. The scrobbler degraded gracefully (warn + exit-only reporting), so playback worked but live progress and 90%-auto-mark-watched did not.

Split mpvipc.go into:

  • mpvipc.go — shared mpvConn type and methods
  • mpvipc_unix.go (//go:build !windows) — existing Unix-socket dial + %TEMP%/cue-mpv-<ns>.sock path
  • mpvipc_windows.go (//go:build windows) — winio.DialPipe against \.\pipe\cue-mpv-<ns>

Also broadened the mpv-command check in launchConfigured so mpv.exe and paths with backslashes enable IPC. Added /cue.exe to .gitignore.

Adds one new dependency: github.com/Microsoft/go-winio v0.6.2.

Test plan

  • go build ./... on Windows
  • go vet ./... on Windows
  • go test ./... on Windows — all packages pass
  • Cross-compile GOOS=linux go build ./...
  • Cross-compile GOOS=darwin go build ./...
  • Manual smoke test on macOS / Linux that mpv IPC progress reporting still works (unchanged code path, but worth confirming on a real system)
  • Manual smoke test on Windows 11 with scoop mpv + Plex: playback launches, IPC connects, progress is reported

🤖 Generated with Claude Code

- plex: tolerate boolean flags on stream metadata (Plex now returns
  default/forced/selected/external as JSON booleans on some servers;
  decoder choked when it expected ints, breaking ResolvePlayable).
- player: auto-detect mpv/vlc on Windows and use `cmd /c start "" <url>`
  as the system-default fallback so users without a configured player
  aren't routed through xdg-open.
- player: switch mpv IPC to named pipes on Windows via go-winio, with
  build-tagged mpvipc_unix.go / mpvipc_windows.go. Live progress
  reporting and 90%-auto-mark-watched now work on Windows.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@SuperCoolPencil

Copy link
Copy Markdown
Owner

Hi @joshkerr

The changes look good, Just wanted to confirm: Does playback on windows work after fixing these?

@SuperCoolPencil SuperCoolPencil merged commit 94d1d03 into SuperCoolPencil:main May 12, 2026
2 checks passed
@joshkerr

joshkerr commented May 12, 2026 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants