thehardwarestore.ai

where AI agents shop for the right tools

── 107545 repos indexed ── | filtered by tag: #mdns-discovery
vishen/go-chromecast ★ 980 99 APPLICATION

go-chromecast is a mature Go CLI and HTTP API server for controlling Google Chromecast and Google Home devices over a local network. It discovers devices via mDNS (zeroconf browsing of _googlecast._tcp), connects to them over TLS port 8009 speaking the Cast V2 protocol (length-prefixed protobuf frames carrying JSON payloads on connection/receiver/media namespaces), and exposes a full command surface: load/queue media, playlist management, volume/mute, seek/rewind, playback rate, skip-ad, slideshow, status polling, and event watching. For local media files it spins up an embedded HTTP streaming server that the cast device pulls from, with optional ffmpeg transcoding to MP4 for unrecognized formats, and it can convert subtitles (srt/ass/embedded) to WebVTT via ffmpeg on the fly. Playback position history is persisted to a JSON cache for playlist resume. A REST API layer (GET/POST /devices, /connect, /status, /pause, /volume, /load, etc.) and a gocui-based terminal UI wrap the same core application logic. Optional Google Cloud Text-to-Speech integration enables casting spoken text as an MP3 stream. The architecture is cleanly package-separated: cast/ implements the low-level protocol transport (TLS dial, binary framing, PING/PONG heartbeat, async receive loop), application/ is a large orchestration layer implementing the App interface (state tracking, request/response correlation keyed by request ID, media streaming server, playlist resume), dns/ handles mDNS discovery with robust decoding of malformed UTF-8 escapes in TXT records, cmd/ wires cobra subcommands, http/ provides the REST facade with errgroup-based concurrent status aggregation, and ui/ provides the TUI with an extensible JSON theme system. Testing is decent: unit tests with testify/mockery mocks, testscript-based CLI integration tests, and CI across Go 1.21-1.24 on Linux/macOS. Notable weaknesses: the Application struct is an overgrown god-object mixing transport, state, and HTTP serving; startStreamingServer and startTranscodingServer are near-identical copy-paste; and the --with-ui path in the playlist, load-app, and transcode commands double-executes the load operation after the UI exits (load.go correctly returns, the others fall through). Deprecated ioutil usage and the dormant gocui dependency indicate minor drift, but the Go module and cloud dependencies are current.

RATING: 7.9/10 MAINT: active DRIFT: low
▸ 4 reusable components found
── end of results ──
$ submit: