1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2025-01-03 13:34:54 +00:00

Fixed: Improve field selection for Discord settings

Closes #4387
This commit is contained in:
Bogdan 2023-12-31 08:43:16 +02:00
parent 2109d171e8
commit 7a71c3397b

View file

@ -19,11 +19,38 @@ public class DiscordSettings : IProviderConfig
public DiscordSettings() public DiscordSettings()
{ {
// Set Default Fields // Set Default Fields
GrabFields = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; GrabFields = new[]
ImportFields = new[] { 0, 1, 2, 3, 5, 6, 7, 8, 9 }; {
(int)DiscordGrabFieldType.Overview,
(int)DiscordGrabFieldType.Rating,
(int)DiscordGrabFieldType.Genres,
(int)DiscordGrabFieldType.Quality,
(int)DiscordGrabFieldType.Group,
(int)DiscordGrabFieldType.Size,
(int)DiscordGrabFieldType.Links,
(int)DiscordGrabFieldType.Release,
(int)DiscordGrabFieldType.Poster,
(int)DiscordGrabFieldType.Fanart,
(int)DiscordGrabFieldType.Indexer,
(int)DiscordGrabFieldType.CustomFormats,
(int)DiscordGrabFieldType.CustomFormatScore
};
ImportFields = new[]
{
(int)DiscordImportFieldType.Overview,
(int)DiscordImportFieldType.Rating,
(int)DiscordImportFieldType.Genres,
(int)DiscordImportFieldType.Quality,
(int)DiscordImportFieldType.Group,
(int)DiscordImportFieldType.Size,
(int)DiscordImportFieldType.Links,
(int)DiscordImportFieldType.Release,
(int)DiscordImportFieldType.Poster,
(int)DiscordImportFieldType.Fanart
};
} }
private static readonly DiscordSettingsValidator Validator = new DiscordSettingsValidator(); private static readonly DiscordSettingsValidator Validator = new ();
[FieldDefinition(0, Label = "Webhook URL", HelpText = "Discord channel webhook url")] [FieldDefinition(0, Label = "Webhook URL", HelpText = "Discord channel webhook url")]
public string WebHookUrl { get; set; } public string WebHookUrl { get; set; }
@ -37,10 +64,10 @@ public DiscordSettings()
[FieldDefinition(3, Label = "Host", Advanced = true, HelpText = "Override the Host that shows for this notification, Blank is machine name", Type = FieldType.Textbox)] [FieldDefinition(3, Label = "Host", Advanced = true, HelpText = "Override the Host that shows for this notification, Blank is machine name", Type = FieldType.Textbox)]
public string Author { get; set; } public string Author { get; set; }
[FieldDefinition(4, Label = "On Grab Fields", Advanced = true, SelectOptions = typeof(DiscordGrabFieldType), HelpText = "Change the fields that are passed in for this 'on grab' notification", Type = FieldType.TagSelect)] [FieldDefinition(4, Label = "On Grab Fields", Advanced = true, SelectOptions = typeof(DiscordGrabFieldType), HelpText = "Change the fields that are passed in for this 'on grab' notification", Type = FieldType.Select)]
public IEnumerable<int> GrabFields { get; set; } public IEnumerable<int> GrabFields { get; set; }
[FieldDefinition(5, Label = "On Import Fields", Advanced = true, SelectOptions = typeof(DiscordImportFieldType), HelpText = "Change the fields that are passed for this 'on import' notification", Type = FieldType.TagSelect)] [FieldDefinition(5, Label = "On Import Fields", Advanced = true, SelectOptions = typeof(DiscordImportFieldType), HelpText = "Change the fields that are passed for this 'on import' notification", Type = FieldType.Select)]
public IEnumerable<int> ImportFields { get; set; } public IEnumerable<int> ImportFields { get; set; }
public NzbDroneValidationResult Validate() public NzbDroneValidationResult Validate()