Developer Guide
June 1, 2026 ยท View on GitHub
Best practices for library and plugin contributors. For quick tasks, jump to the how-to guides.
Assembly load isolation
Summary only. The canonical reference lives in Plugin isolation.
- Reference
Lidarr.Plugin.Abstractionsas compile-time only. - Ship
Lidarr.Plugin.Commonnext to your plugin DLL. - Keep cross-boundary types limited to Abstractions.
HTTP resilience
HttpClientExtensions.ExecuteWithResilienceAsynchandles retries,Retry-After, and concurrency limits.- Pass
perRequestTimeoutwhen a hard deadline is required; the helper raisesTimeoutExceptionwhile honouring caller cancellations. - Keep
ContentDecodingSnifferHandlernear the end of your pipeline to rescue mislabelled gzip payloads without buffering large bodies. - Compose handlers: authentication first (OAuth), then resilience, then content sniffing.
- Centralize retry budgets so you do not fight host-level throttling.
Authentication
- Use
OAuthStreamingAuthenticationService+OAuthDelegatingHandlerfor bearer flows. - Implement
IStreamingTokenProviderbacked by the plugin settings. - For API keys or query token schemes, wrap refresh logic behind a semaphore to avoid thundering herds.
Sanitisation
Sanitize.UrlComponentfor query parameters.Sanitize.PathSegmentwithFileNameSanitizerfor filesystem-safe names.- Never HTML encode search terms.
Signing & hashing
- Implement
IRequestSignerwhen the service requires MD5/HMAC tokens. - Helpers:
Md5ConcatSigner,HmacSha256Signer, plusHashingUtilityfor generic hashes.
Downloads
- Use
SimpleDownloadOrchestratorfor resumable downloads. - Keep track metadata in
DownloadProgressevents. - Validate files with
ValidateDownloadedFileand optional container signature checks.
Models & matching
- Populate
StreamingAlbum.ExternalIdsandStreamingTrack.ExternalIdsfor cross-service matching. - Set
MusicBrainzIdwhen known. - Use
QualityMapperto translate service-specific quality tiers.
Indexer streaming & pagination
- Override
Search*StreamAsyncwhen the API streams results. - Use
FetchPagedAsync<T>for offset/next links.
Settings
- Define settings via
ISettingsProvideras described in the Settings reference. - Provide defaults for optional keys.
Preview detection
PreviewDetectionUtility.IsLikelyPreviewuses duration + URL heuristics to filter 30โ90 second samples.