aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Plugins/MusicBrainz/Configuration/PluginConfiguration.cs
blob: a97b56743d65a05ce983b5df2ad3b9c3538537cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using MediaBrowser.Model.Plugins;
using MetaBrainz.MusicBrainz;

namespace MediaBrowser.Providers.Plugins.MusicBrainz.Configuration;

/// <summary>
/// MusicBrainz plugin configuration.
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
    private const string DefaultServer = "https://musicbrainz.org";

    private const double DefaultRateLimit = 1.0;

    private string _server = DefaultServer;

    private double _rateLimit = DefaultRateLimit;

    /// <summary>
    /// Gets or sets the server url.
    /// </summary>
    public string Server
    {
        get => _server;

        set => _server = value.TrimEnd('/');
    }

    /// <summary>
    /// Gets or sets the rate limit.
    /// </summary>
    public double RateLimit
    {
        get => _rateLimit;
        set
        {
            if (value < DefaultRateLimit && _server == DefaultServer)
            {
                _rateLimit = DefaultRateLimit;
            }
            else
            {
                _rateLimit = value;
            }
        }
    }

    /// <summary>
    /// Gets or sets a value indicating whether to replace the artist name.
    /// </summary>
    public bool ReplaceArtistName { get; set; }
}