fixup! Fixed: Marking queued item as failed not blocking the correct Torrent Info Hash
This commit is contained in:
parent
da49f2a2f5
commit
fc29a10268
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||||
using NzbDrone.Common.Extensions;
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
using NzbDrone.Core.Download;
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.Download.TrackedDownloads;
|
||||||
using NzbDrone.Core.Indexers;
|
using NzbDrone.Core.Indexers;
|
||||||
using NzbDrone.Core.Messaging.Commands;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Core.Messaging.Events;
|
using NzbDrone.Core.Messaging.Events;
|
||||||
|
@ -185,7 +186,6 @@ namespace NzbDrone.Core.Blocklisting
|
||||||
Indexer = message.Data.GetValueOrDefault("indexer"),
|
Indexer = message.Data.GetValueOrDefault("indexer"),
|
||||||
Protocol = (DownloadProtocol)Convert.ToInt32(message.Data.GetValueOrDefault("protocol")),
|
Protocol = (DownloadProtocol)Convert.ToInt32(message.Data.GetValueOrDefault("protocol")),
|
||||||
Message = message.Message,
|
Message = message.Message,
|
||||||
TorrentInfoHash = message.TorrentInfoHash,
|
|
||||||
Languages = message.Languages
|
Languages = message.Languages
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -199,7 +199,14 @@ namespace NzbDrone.Core.Blocklisting
|
||||||
blocklist.ReleaseType = releaseType;
|
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)
|
public void HandleAsync(SeriesDeletedEvent message)
|
||||||
|
|
|
@ -21,7 +21,6 @@ namespace NzbDrone.Core.Download
|
||||||
public string DownloadClient { get; set; }
|
public string DownloadClient { get; set; }
|
||||||
public string DownloadId { get; set; }
|
public string DownloadId { get; set; }
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
public string TorrentInfoHash { get; set; }
|
|
||||||
public Dictionary<string, string> Data { get; set; }
|
public Dictionary<string, string> Data { get; set; }
|
||||||
public TrackedDownload TrackedDownload { get; set; }
|
public TrackedDownload TrackedDownload { get; set; }
|
||||||
public List<Language> Languages { get; set; }
|
public List<Language> Languages { get; set; }
|
||||||
|
|
|
@ -125,8 +125,6 @@ namespace NzbDrone.Core.Download
|
||||||
{
|
{
|
||||||
Enum.TryParse(historyItem.Data.GetValueOrDefault(EpisodeHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
|
Enum.TryParse(historyItem.Data.GetValueOrDefault(EpisodeHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource);
|
||||||
|
|
||||||
var torrentInfoHash = GetTorrentInfoHash(historyItem, trackedDownload);
|
|
||||||
|
|
||||||
var downloadFailedEvent = new DownloadFailedEvent
|
var downloadFailedEvent = new DownloadFailedEvent
|
||||||
{
|
{
|
||||||
SeriesId = historyItem.SeriesId,
|
SeriesId = historyItem.SeriesId,
|
||||||
|
@ -141,22 +139,11 @@ namespace NzbDrone.Core.Download
|
||||||
Languages = historyItem.Languages,
|
Languages = historyItem.Languages,
|
||||||
SkipRedownload = skipRedownload,
|
SkipRedownload = skipRedownload,
|
||||||
ReleaseSource = releaseSource,
|
ReleaseSource = releaseSource,
|
||||||
TorrentInfoHash = torrentInfoHash
|
|
||||||
};
|
};
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(downloadFailedEvent);
|
_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)
|
private List<int> GetEpisodeIds(List<EpisodeHistory> historyItems)
|
||||||
{
|
{
|
||||||
return historyItems.Select(h => h.EpisodeId).Distinct().ToList();
|
return historyItems.Select(h => h.EpisodeId).Distinct().ToList();
|
||||||
|
|
Loading…
Reference in New Issue