Avoid default category on existing Transmission configurations

Co-authored-by: Mark McDowall <mark@mcdowall.ca>
(cherry picked from commit bd656ae7f66fc9224ef2a57857152ee5d54d54f8)
pull/5329/head
Bogdan 2 months ago
parent 7255126af5
commit 25a80aa29d

@ -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; }

Loading…
Cancel
Save