fixup! Fixed: Marking queued item as failed not blocking the correct Torrent Info Hash

This commit is contained in:
Mark McDowall 2024-08-07 17:06:28 -07:00
parent da49f2a2f5
commit fc29a10268
3 changed files with 9 additions and 16 deletions

View File

@ -4,6 +4,7 @@ using System.Linq;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Download;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.Indexers;
using NzbDrone.Core.Messaging.Commands;
using NzbDrone.Core.Messaging.Events;
@ -185,7 +186,6 @@ namespace NzbDrone.Core.Blocklisting
Indexer = message.Data.GetValueOrDefault("indexer"),
Protocol = (DownloadProtocol)Convert.ToInt32(message.Data.GetValueOrDefault("protocol")),
Message = message.Message,
TorrentInfoHash = message.TorrentInfoHash,
Languages = message.Languages
};
@ -199,7 +199,14 @@ namespace NzbDrone.Core.Blocklisting
blocklist.ReleaseType = releaseType;
}
_blocklistRepository.Insert(blocklist);
if (message.TrackedDownload == null)
{
blocklist.TorrentInfoHash = message.Data.GetValueOrDefault("torrentInfoHash", null);
}
else
{
blocklist.TorrentInfoHash = message.TrackedDownload.Protocol == DownloadProtocol.Torrent ? message.TrackedDownload.DownloadItem.DownloadId : null;
}
}
public void HandleAsync(SeriesDeletedEvent message)

View File

@ -21,7 +21,6 @@ namespace NzbDrone.Core.Download
public string DownloadClient { get; set; }
public string DownloadId { get; set; }
public string Message { get; set; }
public string TorrentInfoHash { get; set; }
public Dictionary<string, string> Data { get; set; }
public TrackedDownload TrackedDownload { get; set; }
public List<Language> Languages { get; set; }

View File

@ -125,8 +125,6 @@ namespace NzbDrone.Core.Download
{
Enum.TryParse(historyItem.Data.GetValueOrDefault(EpisodeHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
var torrentInfoHash = GetTorrentInfoHash(historyItem, trackedDownload);
var downloadFailedEvent = new DownloadFailedEvent
{
SeriesId = historyItem.SeriesId,
@ -141,22 +139,11 @@ namespace NzbDrone.Core.Download
Languages = historyItem.Languages,
SkipRedownload = skipRedownload,
ReleaseSource = releaseSource,
TorrentInfoHash = torrentInfoHash
};
_eventAggregator.PublishEvent(downloadFailedEvent);
}
private string GetTorrentInfoHash(EpisodeHistory historyItem, TrackedDownload trackedDownload)
{
if (trackedDownload == null)
{
return historyItem.Data.GetValueOrDefault("torrentInfoHash", null);
}
return trackedDownload.Protocol == DownloadProtocol.Torrent ? trackedDownload.DownloadItem.DownloadId : null;
}
private List<int> GetEpisodeIds(List<EpisodeHistory> historyItems)
{
return historyItems.Select(h => h.EpisodeId).Distinct().ToList();