Fixed: Rejecting import for a release that was grabbed again

This commit is contained in:
Mark McDowall 2020-01-31 17:25:44 -08:00
parent c615ef476a
commit e9b537b6e6
1 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.History; using NzbDrone.Core.History;
@ -39,14 +40,18 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
var episodeHistory = _historyService.FindByEpisodeId(episode.Id); var episodeHistory = _historyService.FindByEpisodeId(episode.Id);
var lastImported = episodeHistory.FirstOrDefault(h => h.EventType == HistoryEventType.DownloadFolderImported); var lastImported = episodeHistory.FirstOrDefault(h => h.EventType == HistoryEventType.DownloadFolderImported);
var lastGrabbed = episodeHistory.FirstOrDefault(h => h.EventType == HistoryEventType.Grabbed);
if (lastImported == null) if (lastImported == null)
{ {
continue; continue;
} }
// TODO: Ignore last imported check if the same release was grabbed again // If the release was grabbed again after importing don't reject it
// See: https://github.com/Sonarr/Sonarr/issues/2393 if (lastGrabbed != null && lastGrabbed.Date.After(lastImported.Date))
{
continue;
}
if (lastImported.DownloadId == downloadClientItem.DownloadId) if (lastImported.DownloadId == downloadClientItem.DownloadId)
{ {