How cqjjjzr/musicbee-desktoplyrics works
Project type and purpose
• This is a Windows‐based plugin for the MusicBee media player.
• Purpose: display synchronized LRC lyrics on the desktop, optionally in cooperation with a separate NeteaseLyrics plugin to render double‐line lyrics.
File structure
• Top level: solution and project files (.sln, .csproj), source files (.cs), config files (app.config, packages.config), Fody configuration (FodyWeavers.xml/xsd).
• Source folders:
– Forms/UI: FrmLyrics.{cs,Designer.cs,resx}, FrmSettings.{cs,Designer.cs,resx}
– Controllers and services: LyricsController.cs, LyricsRenderer.cs, MusicBeeInterface.cs
– Parsing: LyricParser.cs
– Rendering support: Gdiplus.cs, GdiplusPInvoke.cs, UnmanagedHelper.cs
– Utilities: FontConverter.cs
• Properties: AssemblyInfo.cs
• No client/server split – all logic lives in a single .NET assembly loaded by MusicBee.
README for additional insights
• Confirms plugin nature and LRC format requirement.
• Mentions optional integration with NeteaseLyrics plugin for double‐line support.
Main components to capture
a. MusicBee Host
b. DesktopLyrics Plugin
• Entry point & integration: MusicBeeInterface (implements plugin callbacks)
• Core Controller: LyricsController (orchestrates parsing, rendering)
• Parser: LyricParser (parses LRC files, builds time‐tagged lyric model; handles offset)
• Renderer: LyricsRenderer (drives the lyrics update loop, computes current line)
• Desktop UI: FrmLyrics (borderless, transparent form that draws lyrics)
• Rendering infrastructure: Gdiplus wrappers (Gdiplus.cs, GdiplusPInvoke.cs), UnmanagedHelper (native interop), FontConverter
• Configuration: app.config (plugin settings persistence), FodyWeavers (assembly weaving)
• Optional integration point: NeteaseLyrics plugin (external service for splitting double‐line LRC)
c. External LRC files (local or downloaded by other plugins)
d. User configuration store
Relationships and data flow
1. MusicBee triggers “song changed” event → MusicBeeInterface receives callback.
2. MusicBeeInterface asks LyricsController to load and synchronize LRC.
3. LyricsController calls LyricParser to read .lrc file, builds in‐memory model.
5. LyricsController passes model + style to LyricsRenderer.
7. If NeteaseLyrics is present and double‐line tokens exist, input is pre‐split by slash.
8. User may open FrmSettings at any time; changes are persisted and immediately affect rendering.
Architectural patterns and principles
• Plugin‐host boundary: clear separation between MusicBeeInterface (host adapter) and internal logic.
• MVC‐like structure inside plugin:
– Model: lyric data, style settings
– View: FrmLyrics (display), FrmSettings (configuration)
– Controller: LyricsController orchestrates parsing → rendering → UI update
• Single assembly, event‐driven flow
• Use of native interop wrappers for GDI+ to render custom text