mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 22:07:32 -04:00
New: (Discord) Add size grab field and improve field selection
This commit is contained in:
parent
67355ec07b
commit
e5d7a21714
3 changed files with 19 additions and 4 deletions
|
@ -65,6 +65,11 @@ namespace NzbDrone.Core.Notifications.Discord
|
|||
discordField.Name = "Host";
|
||||
discordField.Value = message.Host ?? string.Empty;
|
||||
break;
|
||||
case DiscordGrabFieldType.Size:
|
||||
discordField.Name = "Size";
|
||||
discordField.Value = BytesToString(message.Release.Size.GetValueOrDefault(0));
|
||||
discordField.Inline = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (discordField.Name.IsNotNullOrWhiteSpace() && discordField.Value.IsNotNullOrWhiteSpace())
|
||||
|
|
|
@ -7,6 +7,7 @@ namespace NzbDrone.Core.Notifications.Discord
|
|||
DownloadClient,
|
||||
GrabTrigger,
|
||||
Source,
|
||||
Host
|
||||
Host,
|
||||
Size
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,19 @@ namespace NzbDrone.Core.Notifications.Discord
|
|||
public DiscordSettings()
|
||||
{
|
||||
//Set Default Fields
|
||||
GrabFields = new List<int> { 0, 1, 2, 3, 5, 6, 7, 8, 9 };
|
||||
GrabFields = new List<int>
|
||||
{
|
||||
(int)DiscordGrabFieldType.Release,
|
||||
(int)DiscordGrabFieldType.Indexer,
|
||||
(int)DiscordGrabFieldType.DownloadClient,
|
||||
(int)DiscordGrabFieldType.GrabTrigger,
|
||||
(int)DiscordGrabFieldType.Source,
|
||||
(int)DiscordGrabFieldType.Host,
|
||||
(int)DiscordGrabFieldType.Size
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly DiscordSettingsValidator Validator = new DiscordSettingsValidator();
|
||||
private static readonly DiscordSettingsValidator Validator = new ();
|
||||
|
||||
[FieldDefinition(0, Label = "Webhook URL", HelpText = "Discord channel webhook url")]
|
||||
public string WebHookUrl { get; set; }
|
||||
|
@ -36,7 +45,7 @@ namespace NzbDrone.Core.Notifications.Discord
|
|||
[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; }
|
||||
|
||||
[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 NzbDroneValidationResult Validate()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue