PluginConfiguration.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. private const string DefaultServer = "https://musicbrainz.org";
  9. private const double DefaultRateLimit = 1.0;
  10. private string _server = DefaultServer;
  11. private double _rateLimit = DefaultRateLimit;
  12. /// <summary>
  13. /// Gets or sets the server url.
  14. /// </summary>
  15. public string Server
  16. {
  17. get => _server;
  18. set => _server = value.TrimEnd('/');
  19. }
  20. /// <summary>
  21. /// Gets or sets the rate limit.
  22. /// </summary>
  23. public double RateLimit
  24. {
  25. get => _rateLimit;
  26. set
  27. {
  28. if (value < DefaultRateLimit && _server == DefaultServer)
  29. {
  30. _rateLimit = DefaultRateLimit;
  31. }
  32. else
  33. {
  34. _rateLimit = value;
  35. }
  36. }
  37. }
  38. /// <summary>
  39. /// Gets or sets a value indicating whether to replace the artist name.
  40. /// </summary>
  41. public bool ReplaceArtistName { get; set; }
  42. }