From 4e47695f8999154ac057fc10a4dd8e36eae4b113 Mon Sep 17 00:00:00 2001 From: Alex Cortelyou <1689668+acortelyou@users.noreply.github.com> Date: Wed, 27 Mar 2024 22:30:21 -0700 Subject: [PATCH] New: Add additional fields to Webhook Manual Interaction Required events (cherry picked from commit 1ec1ce58e9f095222e7fe4a8c74a0720fed71558) Closes #9874 --- .../Notifications/Webhook/WebhookBase.cs | 2 ++ .../Webhook/WebhookDownloadStatusMessage.cs | 18 ++++++++++++++++++ .../Webhook/WebhookManualInteractionPayload.cs | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 src/NzbDrone.Core/Notifications/Webhook/WebhookDownloadStatusMessage.cs diff --git a/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs b/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs index b5442c24d..fa0e8f9ad 100644 --- a/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs +++ b/src/NzbDrone.Core/Notifications/Webhook/WebhookBase.cs @@ -212,6 +212,8 @@ namespace NzbDrone.Core.Notifications.Webhook DownloadClient = message.DownloadClientInfo?.Name, DownloadClientType = message.DownloadClientInfo?.Type, DownloadId = message.DownloadId, + DownloadStatus = message.TrackedDownload.Status.ToString(), + DownloadStatusMessages = message.TrackedDownload.StatusMessages.Select(x => new WebhookDownloadStatusMessage(x)).ToList(), CustomFormatInfo = new WebhookCustomFormatInfo(remoteMovie.CustomFormats, remoteMovie.CustomFormatScore), Release = new WebhookGrabbedRelease(message.Release) }; diff --git a/src/NzbDrone.Core/Notifications/Webhook/WebhookDownloadStatusMessage.cs b/src/NzbDrone.Core/Notifications/Webhook/WebhookDownloadStatusMessage.cs new file mode 100644 index 000000000..5e8b47870 --- /dev/null +++ b/src/NzbDrone.Core/Notifications/Webhook/WebhookDownloadStatusMessage.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Linq; +using NzbDrone.Core.Download.TrackedDownloads; + +namespace NzbDrone.Core.Notifications.Webhook +{ + public class WebhookDownloadStatusMessage + { + public string Title { get; set; } + public List Messages { get; set; } + + public WebhookDownloadStatusMessage(TrackedDownloadStatusMessage statusMessage) + { + Title = statusMessage.Title; + Messages = statusMessage.Messages.ToList(); + } + } +} diff --git a/src/NzbDrone.Core/Notifications/Webhook/WebhookManualInteractionPayload.cs b/src/NzbDrone.Core/Notifications/Webhook/WebhookManualInteractionPayload.cs index 56d717c7b..6b2cfa0cd 100644 --- a/src/NzbDrone.Core/Notifications/Webhook/WebhookManualInteractionPayload.cs +++ b/src/NzbDrone.Core/Notifications/Webhook/WebhookManualInteractionPayload.cs @@ -7,6 +7,8 @@ namespace NzbDrone.Core.Notifications.Webhook public string DownloadClient { get; set; } public string DownloadClientType { get; set; } public string DownloadId { get; set; } + public string DownloadStatus { get; set; } + public List DownloadStatusMessages { get; set; } public WebhookCustomFormatInfo CustomFormatInfo { get; set; } public WebhookGrabbedRelease Release { get; set; } }