$ show raitonoberu/sptlrx
sptlrx is a command-line application that displays synchronized lyrics in the terminal. It fetches currently playing track information from various music players (Spotify, MPD, Mopidy, MPRIS, or browser extensions) and retrieves lyrics from lrclib.net or local LRC files. The core functionality revolves around a pool package that synchronizes player state with lyric timing, updating a Bubbletea-based terminal UI in real-time. The application features configurable styling, multiple player support, and a pipe mode for outputting lyrics to stdout.
The LLM identified 2 files worth highlighting for reuse:
The pool package decouples music player state from lyric display logic. It uses a goroutine to monitor player changes (track, position, play state) and a ticker to update the current lyric line based on playback position. The getIndex function efficiently finds the current lyric line using a two-way search algorithm. This component is highly reusable as it only depends on abstract player and lyrics provider interfaces, making it adaptable to any media-synchronized text display scenario.
The lyrics package provides a clean abstraction for lyrics sources with a simple Provider interface. It includes robust utility functions for detecting LRC timestamp lines (IsTimestampLine) and parsing them into structured data (ParseLrcLine), handling various timestamp formats and edge cases. This package is easily extractable as it has zero internal dependencies and could be used in any lyrics processing application, whether fetching from APIs or parsing local files.