$ show pear-devs/pear-desktop
Pear Desktop is an Electron-based desktop application that wraps YouTube Music into a native-like experience with an extensive plugin system. It provides a custom UI built with SolidJS and Material Design 3 (via patched @mdui), system tray integration, media controls, and cross-platform support (Windows, macOS, Linux). The application enhances YouTube Music with over 50 plugins covering audio effects (equalizer, crossfade, compressor), visual customization (album color theme, ambient mode, transparent player), social integrations (Discord Rich Presence, Last.fm scrobbling, collaborative listening via Music Together), and utilities (downloader, synced lyrics, API server, sponsorblock). The architecture follows a clear separation of concerns: main process (Electron), renderer process (SolidJS), and a plugin lifecycle with backend, renderer, and menu contexts. Plugins are loaded dynamically via custom Vite virtual modules and communicate through IPC. The codebase demonstrates strong engineering practices with TypeScript, strict linting, automated CI/CD, and internationalization across 70+ languages. While heavily coupled to YouTube Music's internal APIs and DOM structure, the plugin system and utility abstractions (e.g., createPlugin, VolumeFader, ScrobblerBase) are well-designed and potentially reusable in other Electron music player projects.
The LLM identified 4 files worth highlighting for reuse:
Provides `createPlugin`, `createBackend`, and `createRenderer` factory functions that standardize the plugin lifecycle (start, stop, onConfigChange, onPlayerApiReady). This pattern decouples plugin logic from the main application and allows plugins to be developed independently. The abstraction is clean, type-safe, and could be extracted to build a plugin system for any Electron app.
Implements a `VolumeFader` class that handles linear and logarithmic volume transitions between audio sources. It encapsulates gain node management, fade duration, and state tracking. This is a self-contained audio utility that could be reused in any web audio project requiring smooth volume transitions.
Parses LRC (LyRiCs) format text into structured time-tagged lyrics lines. Handles edge cases like multiple timestamps per line, metadata tags, and malformed input. The parser is a pure function with no external dependencies, making it easily reusable in any application that needs to parse synced lyrics.
Defines an abstract `ScrobblerBase` class that standardizes the scrobbling lifecycle: authentication, now-playing updates, scrobble submission, and error handling. Concrete implementations (Last.fm, ListenBrainz) extend this base. The pattern is a clean example of the Template Method pattern and could be reused to add new scrobbling services with minimal code.