Files
SubMiner/backlog/tasks/task-8 - Reduce-MpvIpcClient-deps-interface-and-separate-protocol-from-application-logic.md
2026-02-11 09:33:47 -08:00

1.4 KiB

id, title, status, assignee, created_date, labels, milestone, dependencies, references, priority
id title status assignee created_date labels milestone dependencies references priority
TASK-8 Reduce MpvIpcClient deps interface and separate protocol from application logic To Do
2026-02-11 08:20
refactor
mpv
architecture
Codebase Clarity & Composability
src/core/services/mpv-service.ts
medium

Description

MpvIpcClient (761 lines) in src/core/services/mpv-service.ts has a 22-property MpvIpcClientDeps interface that reaches back into main.ts state for application-level concerns (overlay visibility, subtitle timing, media path updates, OSD display).

The class mixes two responsibilities:

  1. IPC Protocol: Socket connection, JSON message framing, reconnection, property observation
  2. Application Integration: Subtitle text broadcasting, overlay visibility sync, timing tracking

Separating these would let the protocol layer be simpler and testable, while application-level reactions to mpv events could be handled by listeners/callbacks registered externally.

Acceptance Criteria

  • #1 MpvIpcClient deps interface reduced to protocol-level concerns only
  • #2 Application-level reactions (subtitle broadcast, overlay sync, timing) handled via event emitter or external listeners
  • #3 MpvIpcClient is testable without mocking 22 callbacks
  • #4 Existing behavior preserved