$ show lyswhut/lx-music-desktop
lx-music-desktop is a cross-platform Electron-based music player (Vue 3 + TypeScript) that aggregates multiple Chinese streaming services (NetEase, Tencent, Kugou, Kuwo, Migu, Baidu, Xiami). It provides music search, playback, playlist management, lyrics (including desktop lyric windows and karaoke-style font rendering), downloads with quality tiers, audio effects (EQ, convolution reverb, pitch shifting), cross-device synchronization over a custom WebSocket protocol, and an HTTP Open API for third-party control. The architecture spans three processes: main (Electron window/tray/IPC, SQLite persistence via better-sqlite3), renderer (Vue app with custom reactive stores and a plugin-based audio engine), and renderer-lyric (dedicated always-on-top lyric window). All built-in music sources were removed in v2.6.0 following a Tencent legal complaint; the app now relies entirely on user-supplied Music API scripts, introducing a sandboxed script runtime with security warnings. The repository is actively maintained (last commit 2026-09-19) but the project is in a transition phaseβthe maintainer has announced a successor project ('Any Listen'), and the codebase shows signs of legacy accumulation: extensive commented-out code, duplicated components (e.g., MusicSortModal), hardcoded API endpoints/signatures that break frequently, and a custom store implementation diverging from Vuex/Pinia. Despite this, the code is well-organized around provider SDK adapters, composable logic hooks, and a clear main/renderer IPC boundary, with several genuinely reusable patterns.
The LLM identified 5 files worth highlighting for reuse:
A self-contained, promise-based download manager supporting resumable HTTP downloads, concurrency limiting, retry logic, progress events, and cancellation. It is isolated from the rest of the codebase (imports only standard Node/browser utilities) and could be dropped into any JS/TS project requiring robust file downloads.
A canvas-based lyric rendering engine that animates individual characters/tokens in sync with audio timing, supporting word-level highlighting and custom fonts. It is forkable into any lyric or karaoke display system without Electron dependencies, demonstrating non-obvious canvas animation and timing logic.
Manages versioned snapshots of playlist data with throttled file writes, MD5-based integrity checks, and merge/overwrite strategies for conflict resolution. The pattern of snapshotting with dirty flags and throttled persistence is reusable for any local-first sync or caching system that needs to reconcile remote and local changes without losing data.
Central registry that standardizes the interface across all music providers (search, songlist, leaderboard, lyric, metadata) and exposes a single API for the rest of the app. Each provider SDK implements the same contract, making it easy to add/remove sources. This adapter pattern is directly applicable to any multi-provider data aggregation system, demonstrating clean interface isolation and fallback logic.
Builds a Web Audio API graph (source β analyser β biquad EQ β pitch shifter β convolver β panner β gain) and exposes a small, well-typed event/settings API. It abstracts away the complexity of chaining audio nodes, device selection, and effect toggles, and is reusable as a reference for any web-based audio player wanting a modular effect chain.