From 71bd88e5317368574c88fb2108639ac6ed07d79e Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 26 Sep 2022 19:07:17 -0500 Subject: [PATCH] New: Add Release group to history for all events Fixes #1499 Co-Authored-By: Mark McDowall --- src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs | 2 ++ src/NzbDrone.Core/Download/IgnoredDownloadService.cs | 1 + src/NzbDrone.Core/History/HistoryService.cs | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs b/src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs index 4a6372506..d23993b35 100644 --- a/src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs +++ b/src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using NzbDrone.Common.Messaging; +using NzbDrone.Core.Download.TrackedDownloads; using NzbDrone.Core.Qualities; namespace NzbDrone.Core.Download @@ -13,5 +14,6 @@ public class DownloadIgnoredEvent : IEvent public DownloadClientItemClientInfo DownloadClientInfo { get; set; } public string DownloadId { get; set; } public string Message { get; set; } + public TrackedDownload TrackedDownload { get; set; } } } diff --git a/src/NzbDrone.Core/Download/IgnoredDownloadService.cs b/src/NzbDrone.Core/Download/IgnoredDownloadService.cs index f18093b3c..81a85831e 100644 --- a/src/NzbDrone.Core/Download/IgnoredDownloadService.cs +++ b/src/NzbDrone.Core/Download/IgnoredDownloadService.cs @@ -42,6 +42,7 @@ public bool IgnoreDownload(TrackedDownload trackedDownload) SourceTitle = trackedDownload.DownloadItem.Title, DownloadClientInfo = trackedDownload.DownloadItem.DownloadClientInfo, DownloadId = trackedDownload.DownloadItem.DownloadId, + TrackedDownload = trackedDownload, Message = "Manually ignored" }; diff --git a/src/NzbDrone.Core/History/HistoryService.cs b/src/NzbDrone.Core/History/HistoryService.cs index ba3ca4f0a..5fc83ab26 100644 --- a/src/NzbDrone.Core/History/HistoryService.cs +++ b/src/NzbDrone.Core/History/HistoryService.cs @@ -200,6 +200,7 @@ public void Handle(BookImportIncompleteEvent message) }; history.Data.Add("StatusMessages", message.TrackedDownload.StatusMessages.ToJson()); + history.Data.Add("ReleaseGroup", message.TrackedDownload?.RemoteBook?.ParsedBookInfo?.ReleaseGroup); _historyRepository.Insert(history); } } @@ -235,6 +236,7 @@ public void Handle(TrackImportedEvent message) history.Data.Add("ImportedPath", message.ImportedBook.Path); history.Data.Add("DownloadClient", message.DownloadClientInfo?.Type); history.Data.Add("DownloadClientName", message.DownloadClientInfo?.Name); + history.Data.Add("ReleaseGroup", message.BookInfo.ReleaseGroup); _historyRepository.Insert(history); } @@ -286,6 +288,7 @@ public void Handle(BookFileDeletedEvent message) }; history.Data.Add("Reason", message.Reason.ToString()); + history.Data.Add("ReleaseGroup", message.BookFile.ReleaseGroup); _historyRepository.Insert(history); } @@ -307,6 +310,7 @@ public void Handle(BookFileRenamedEvent message) history.Data.Add("SourcePath", sourcePath); history.Data.Add("Path", path); + history.Data.Add("ReleaseGroup", message.BookFile.ReleaseGroup); _historyRepository.Insert(history); } @@ -358,6 +362,7 @@ public void Handle(DownloadIgnoredEvent message) }; history.Data.Add("DownloadClient", message.DownloadClientInfo.Name); + history.Data.Add("ReleaseGroup", message.TrackedDownload?.RemoteBook?.ParsedBookInfo?.ReleaseGroup); history.Data.Add("Message", message.Message); historyToAdd.Add(history);