BetterLyrics is a feature-rich WinUI3 desktop application for Windows that displays and customizes synchronized song lyrics. The application serves as both a lyrics visualizer and a music player, supporting multiple display modes (standard, fullscreen, desktop wallpaper, docked, taskbar) with GPU-accelerated rendering via Win2D and ComputeSharp pixel shaders. It integrates with the Windows Global System Media Transport Controls (GSMTC) to work with external players like Spotify, Apple Music, and NetEase, and provides its own local media playback engine with a music library browser and playlist management. The architecture follows MVVM (CommunityToolkit.Mvvm) with a service layer and dependency injection, separating platform-agnostic logic in 'BetterLyrics.Core', UI in 'BetterLyrics.WinUI3', and a plugin SDK in 'BetterLyrics.Sdk'. Core data flows include lyrics retrieval from multiple providers (QQ, Netease, Kugou, Apple Music, LrcLib) with caching, metadata extraction via TagLib, and analytics tracking stored in LiteDB. The plugin SDK allows third-party developers to extend lyrics sources, translations, transliterations, and AI services via isolated AssemblyLoadContext. Reusable components include generic helpers (Debouncer, ValueTransition, FullyObservableCollection), a comprehensive lyrics format parser (LRC, TTML, QRC/KRC), and a plugin framework with auto-generated settings UI.
This repository contains a PotPlayer subtitle translation plugin written in AngleScript. It provides real-time subtitle translation by sending subtitle text to OpenAI-compatible chat completion APIs. Two variants are included: one with context (sends recent subtitles for better accuracy) and one without (faster, no context). The plugin handles configuration via a dual-layer system: installer-injected defaults that can be overridden by PotPlayer's settings panel. It supports retry logic, request delays, hallucination detection, small model mode, and context caching (including OpenAI prompt caching and Gemini cached content). The installer is a separate component built with Inno Setup that provides a GUI for selecting variant, configuring API settings, and injecting defaults into the script files. The code demonstrates solid engineering with careful error handling, configuration precedence, and extensibility for multi-provider support.