diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs index 49293822d..55fffe9cd 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using System.Text.RegularExpressions; using FluentValidation; using NzbDrone.Common.Extensions; @@ -28,6 +29,7 @@ namespace NzbDrone.Core.Download.Clients.Transmission { private static readonly TransmissionSettingsValidator Validator = new TransmissionSettingsValidator(); + // This constructor is used when creating a new instance, such as the user adding a new Transmission client. public TransmissionSettings() { Host = "localhost"; @@ -36,6 +38,18 @@ namespace NzbDrone.Core.Download.Clients.Transmission MusicCategory = "lidarr"; } + // TODO: Remove this in v3 + // This constructor is used when deserializing from JSON, it will set the + // category to the deserialized value, defaulting to null. + [JsonConstructor] + public TransmissionSettings(string musicCategory = null) + { + Host = "localhost"; + Port = 9091; + UrlBase = "/transmission/"; + MusicCategory = musicCategory; + } + [FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)] public string Host { get; set; }