PluginConfiguration.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using MediaBrowser.Model.Plugins;
  2. namespace MediaBrowser.Providers.Plugins.MusicBrainz.Configuration;
  3. /// <summary>
  4. /// MusicBrainz plugin configuration.
  5. /// </summary>
  6. public class PluginConfiguration : BasePluginConfiguration
  7. {
  8. /// <summary>
  9. /// The default server URL.
  10. /// </summary>
  11. public const string DefaultServer = "https://musicbrainz.org";
  12. /// <summary>
  13. /// The default rate limit.
  14. /// </summary>
  15. public const double DefaultRateLimit = 1.0;
  16. private string _server = DefaultServer;
  17. private double _rateLimit = DefaultRateLimit;
  18. /// <summary>
  19. /// Gets or sets the server URL.
  20. /// </summary>
  21. public string Server
  22. {
  23. get => _server;
  24. set => _server = value.TrimEnd('/');
  25. }
  26. /// <summary>
  27. /// Gets or sets the rate limit.
  28. /// </summary>
  29. public double RateLimit
  30. {
  31. get => _rateLimit;
  32. set
  33. {
  34. if (value < DefaultRateLimit && _server == DefaultServer)
  35. {
  36. _rateLimit = DefaultRateLimit;
  37. }
  38. else
  39. {
  40. _rateLimit = value;
  41. }
  42. }
  43. }
  44. /// <summary>
  45. /// Gets or sets a value indicating whether to replace the artist name.
  46. /// </summary>
  47. public bool ReplaceArtistName { get; set; }
  48. }