Files
Felitendo 43aa326c20 feat: allow disabling the rate limit for self-hosted LRCLIB servers
Adds a DisableRateLimit option that skips the request gap entirely. It
only takes effect when the base URL points at a self-hosted instance;
requests to lrclib.net and any URL the provider would fall back from
stay rate limited.

The limiter now tracks its watermark with Stopwatch instead of
DateTime.UtcNow, so a wall-clock jump backwards can no longer stall
every request for the length of the jump.
2026-09-15 15:45:00 +02:00

84 lines
3.2 KiB
C#

using System.Diagnostics.CodeAnalysis;
using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.Lyrics.Configuration;
/// <summary>
/// Configuration for lyrics plugin.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// Gets or sets a value indicating whether to use strict search.
/// </summary>
public bool UseStrictSearch { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to exclude artist name.
/// </summary>
public bool ExcludeArtistName { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether to exclude album name.
/// </summary>
public bool ExcludeAlbumName { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether to enable adaptive retry backoff.
/// </summary>
public bool EnableAdaptiveRetryBackoff { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether to enforce a per-run processing cap.
/// </summary>
public bool EnableRunCap { get; set; } = true;
/// <summary>
/// Gets or sets the maximum number of tracks to process per run.
/// </summary>
public int MaxTracksPerRun { get; set; } = 2000;
/// <summary>
/// Gets or sets the state entry retention in days.
/// </summary>
public int FailureStateTtlDays { get; set; } = 90;
/// <summary>
/// Gets or sets the adaptive backoff schedule in days.
/// </summary>
[SuppressMessage("Performance", "CA1819:Properties should not return arrays", Justification = "Plugin configuration is persisted and exchanged via simple array values.")]
public int[] BackoffScheduleDays { get; set; } = [1, 3, 7, 30];
/// <summary>
/// Gets or sets a value indicating whether to filter LRCLIB matches by track duration.
/// </summary>
public bool EnableDurationFilter { get; set; } = true;
/// <summary>
/// Gets or sets the duration tolerance in seconds for accepting an LRCLIB match.
/// Results whose duration differs from the local track by more than this value are rejected.
/// Ignored when <see cref="EnableDurationFilter"/> is false.
/// </summary>
public int DurationToleranceSeconds { get; set; } = 15;
/// <summary>
/// Gets or sets the base URL for the LRCLIB API.
/// Defaults to the public instance. Set to an absolute http(s) URL to use a self-hosted instance.
/// A trailing path is preserved (e.g. https://example.com/lrclib), so reverse-proxy subpaths work.
/// Empty, whitespace, or non-http(s) values are ignored and the default is used.
/// </summary>
public string LrclibBaseUrl { get; set; } = "https://lrclib.net";
/// <summary>
/// Gets or sets a value indicating whether the minimum gap between LRCLIB requests is removed.
/// Only honored when <see cref="LrclibBaseUrl"/> points at a self-hosted instance; requests to
/// the public lrclib.net stay rate limited regardless of this setting.
/// </summary>
public bool DisableRateLimit { get; set; }
/// <summary>
/// Gets or sets the legacy state cursor value.
/// </summary>
public int StateCursor { get; set; }
}