From 6670aa71160d0b27cf02cdd009a664d1442c2449 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 Co-Authored-By: Mark McDowall --- src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs | 2 ++ src/NzbDrone.Core/Download/IgnoredDownloadService.cs | 1 + src/NzbDrone.Core/History/EntityHistoryService.cs | 8 ++++++++ 3 files changed, 11 insertions(+) diff --git a/src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs b/src/NzbDrone.Core/Download/DownloadIgnoredEvent.cs index ca999c88e..490bff25f 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 @@ namespace NzbDrone.Core.Download 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 ceaea619d..02d01cb5d 100644 --- a/src/NzbDrone.Core/Download/IgnoredDownloadService.cs +++ b/src/NzbDrone.Core/Download/IgnoredDownloadService.cs @@ -42,6 +42,7 @@ namespace NzbDrone.Core.Download SourceTitle = trackedDownload.DownloadItem.Title, DownloadClientInfo = trackedDownload.DownloadItem.DownloadClientInfo, DownloadId = trackedDownload.DownloadItem.DownloadId, + TrackedDownload = trackedDownload, Message = "Manually ignored" }; diff --git a/src/NzbDrone.Core/History/EntityHistoryService.cs b/src/NzbDrone.Core/History/EntityHistoryService.cs index 302f23801..93c29fe8e 100644 --- a/src/NzbDrone.Core/History/EntityHistoryService.cs +++ b/src/NzbDrone.Core/History/EntityHistoryService.cs @@ -197,6 +197,7 @@ namespace NzbDrone.Core.History }; history.Data.Add("StatusMessages", message.TrackedDownload.StatusMessages.ToJson()); + history.Data.Add("ReleaseGroup", message.TrackedDownload?.RemoteAlbum?.ParsedAlbumInfo?.ReleaseGroup); _historyRepository.Insert(history); } } @@ -234,6 +235,7 @@ namespace NzbDrone.Core.History history.Data.Add("DroppedPath", message.TrackInfo.Path); history.Data.Add("ImportedPath", message.ImportedTrack.Path); history.Data.Add("DownloadClient", message.DownloadClientInfo.Name); + history.Data.Add("ReleaseGroup", message.TrackInfo.ReleaseGroup); _historyRepository.Insert(history); } @@ -276,6 +278,8 @@ namespace NzbDrone.Core.History DownloadId = message.TrackedDownload.DownloadItem.DownloadId }; + history.Data.Add("ReleaseGroup", message.TrackedDownload?.RemoteAlbum?.ParsedAlbumInfo?.ReleaseGroup); + _historyRepository.Insert(history); } } @@ -307,6 +311,7 @@ namespace NzbDrone.Core.History }; history.Data.Add("Reason", message.Reason.ToString()); + history.Data.Add("ReleaseGroup", message.TrackFile.ReleaseGroup); _historyRepository.Insert(history); } @@ -332,6 +337,7 @@ namespace NzbDrone.Core.History history.Data.Add("SourcePath", sourcePath); history.Data.Add("Path", path); + history.Data.Add("ReleaseGroup", message.TrackFile.ReleaseGroup); _historyRepository.Insert(history); } @@ -355,6 +361,7 @@ namespace NzbDrone.Core.History }; history.Data.Add("TagsScrubbed", message.Scrubbed.ToString()); + history.Data.Add("ReleaseGroup", message.TrackFile.ReleaseGroup); history.Data.Add("Diff", message.Diff.Select(x => new { Field = x.Key, @@ -388,6 +395,7 @@ namespace NzbDrone.Core.History }; history.Data.Add("DownloadClient", message.DownloadClientInfo.Name); + history.Data.Add("ReleaseGroup", message.TrackedDownload?.RemoteAlbum?.ParsedAlbumInfo?.ReleaseGroup); history.Data.Add("Message", message.Message); historyToAdd.Add(history);