BetterLyrics.Sdk
1.0.3
dotnet add package BetterLyrics.Sdk --version 1.0.3
NuGet\Install-Package BetterLyrics.Sdk -Version 1.0.3
<PackageReference Include="BetterLyrics.Sdk" Version="1.0.3" />
<PackageVersion Include="BetterLyrics.Sdk" Version="1.0.3" />
<PackageReference Include="BetterLyrics.Sdk" />
paket add BetterLyrics.Sdk --version 1.0.3
#r "nuget: BetterLyrics.Sdk, 1.0.3"
#:package BetterLyrics.Sdk@1.0.3
#addin nuget:?package=BetterLyrics.Sdk&version=1.0.3
#tool nuget:?package=BetterLyrics.Sdk&version=1.0.3
BetterLyrics.Sdk
The BetterLyrics SDK provides the essential interfaces, base classes, and services required to build plugins for BetterLyrics. By implementing the provided interfaces, you can extend the app with custom lyrics sources, translators, and transliterators.
Compatibility
| BetterLyrics version | BetterLyrics.Sdk version |
|---|---|
| ⇐1.3.479 | 1.0.0 |
| >1.3.497 | 1.0.3 |
We recommend using the latest version of both BetterLyrics and BetterLyrics.Sdk to ensure you have access to the latest features and improvements.
Core Interfaces & Base Classes
IPlugin
The entry point for all plugins. Every plugin MUST implement IPlugin.
It defines the metadata of your plugin (Title, Description, Author, Id, Version, etc.) and provides the lifecycle hooks InitializeAsync() and DisposeAsync().
PluginBase<TConfig> (Recommended)
An abstract base class that implements IPlugin and significantly simplifies the boilerplate code for handling plugin settings.
Instead of manually mapping configuration dictionaries, you can define a strongly typed TConfig class. PluginBase uses Reflection and the SettingBuilder to automatically generate the settings UI in BetterLyrics and automatically bind configuration changes to your properties.
Plugin Capabilities (Feature Interfaces)
To add capabilities to BetterLyrics, your plugin class should implement one or more of the following feature interfaces:
ILyricsSource
Implement this to provide a custom lyrics search and fetching engine.
GetLyricsAsync(title, artist, album, duration, token): Called by the host when searching for lyrics. You must return aLyricsSearchResultrecord which can contain the Raw lyrics text, Translation, Transliteration, and a Reference URL.
ILyricsTranslator
Implement this to provide lyrics translation services.
GetTranslationAsync(text, targetLangTag): Translates the given lyrics string into the language specified by theLanguageTag.
ILyricsTransliterator
Implement this to provide transliteration (e.g., converting Japanese Kanji to Romaji, or Chinese characters to Pinyin).
GetTransliterationAsync(text, targetLangTag, token): Returns the transliterated string.
SDK Services & Context (IPluginContext)
When your plugin's InitializeAsync(IPluginContext context) is called, the host passes an IPluginContext which provides access to several built-in services:
ILocalizer
Used for internationalization and retrieving localized strings.
- You can access language strings via
Localizer["Key"]. - Provides the
CurrentLanguageproperty.
IAIService
Provides access to the built-in AI capabilities of BetterLyrics.
ChatAsync(systemPrompt, userPrompt): Allows your plugin to leverage LLM generation natively.
IConfigurator
Allows raw access to read and write plugin settings.
- Note: If you inherit from
PluginBase<TConfig>, you rarely need to use this directly, asPluginBasemanages settings injection for you.
Settings & UI Schema
BetterLyrics automatically generates a settings UI for your plugin without you writing any XAML. You do this by returning a dictionary of SettingDef from GetSettingDefDict().
If you use PluginBase<TConfig>, you can define properties in your config class and use the SettingBuilder helpers to expose them:
BoolSettingDef(ToggleSwitch): Created viaSettingBuilder.Bool()TextSettingDef(TextBox): Created viaSettingBuilder.Text()orSettingBuilder.Password()(for masked input)NumberSettingDef(NumberBox): Created viaSettingBuilder.Number()ChoiceSettingDef(ComboBox): Created viaSettingBuilder.Choice()ActionSettingDef(Button): Created viaSettingBuilder.Action()
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net10.0-windows10.0.26100 is compatible. |
-
net10.0
- NLanguageTag (>= 4.1.2)
-
net10.0-windows10.0.26100
- NLanguageTag (>= 4.1.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.