1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

Fixed: Persist indexer flags for automatic imports

This commit is contained in:
Bogdan 2024-07-31 06:06:59 +03:00 committed by Qstick
parent 29ef75960d
commit 6f306a22e5
2 changed files with 15 additions and 5 deletions

View File

@ -138,7 +138,7 @@ public TrackedDownload TrackDownload(DownloadClientDefinition downloadClient, Do
if (historyItems.Any()) if (historyItems.Any())
{ {
var firstHistoryItem = historyItems.FirstOrDefault(); var firstHistoryItem = historyItems.First();
var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == MovieHistoryEventType.Grabbed); var grabbedEvent = historyItems.FirstOrDefault(v => v.EventType == MovieHistoryEventType.Grabbed);
trackedDownload.Indexer = grabbedEvent?.Data?.GetValueOrDefault("indexer"); trackedDownload.Indexer = grabbedEvent?.Data?.GetValueOrDefault("indexer");

View File

@ -7,9 +7,9 @@
using NzbDrone.Core.CustomFormats; using NzbDrone.Core.CustomFormats;
using NzbDrone.Core.DecisionEngine; using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download; using NzbDrone.Core.Download;
using NzbDrone.Core.Download.TrackedDownloads;
using NzbDrone.Core.MediaFiles.MovieImport.Aggregation; using NzbDrone.Core.MediaFiles.MovieImport.Aggregation;
using NzbDrone.Core.Movies; using NzbDrone.Core.Movies;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.MediaFiles.MovieImport namespace NzbDrone.Core.MediaFiles.MovieImport
@ -30,7 +30,7 @@ public class ImportDecisionMaker : IMakeImportDecision
private readonly IAggregationService _aggregationService; private readonly IAggregationService _aggregationService;
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IDetectSample _detectSample; private readonly IDetectSample _detectSample;
private readonly IParsingService _parsingService; private readonly ITrackedDownloadService _trackedDownloadService;
private readonly ICustomFormatCalculationService _formatCalculator; private readonly ICustomFormatCalculationService _formatCalculator;
private readonly Logger _logger; private readonly Logger _logger;
@ -39,7 +39,7 @@ public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification> speci
IAggregationService aggregationService, IAggregationService aggregationService,
IDiskProvider diskProvider, IDiskProvider diskProvider,
IDetectSample detectSample, IDetectSample detectSample,
IParsingService parsingService, ITrackedDownloadService trackedDownloadService,
ICustomFormatCalculationService formatCalculator, ICustomFormatCalculationService formatCalculator,
Logger logger) Logger logger)
{ {
@ -48,7 +48,7 @@ public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification> speci
_aggregationService = aggregationService; _aggregationService = aggregationService;
_diskProvider = diskProvider; _diskProvider = diskProvider;
_detectSample = detectSample; _detectSample = detectSample;
_parsingService = parsingService; _trackedDownloadService = trackedDownloadService;
_formatCalculator = formatCalculator; _formatCalculator = formatCalculator;
_logger = logger; _logger = logger;
} }
@ -132,6 +132,16 @@ private ImportDecision GetDecision(LocalMovie localMovie, DownloadClientItem dow
} }
else else
{ {
if (downloadClientItem?.DownloadId.IsNotNullOrWhiteSpace() == true)
{
var trackedDownload = _trackedDownloadService.Find(downloadClientItem.DownloadId);
if (trackedDownload?.RemoteMovie?.Release?.IndexerFlags != null)
{
localMovie.IndexerFlags = trackedDownload.RemoteMovie.Release.IndexerFlags;
}
}
localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie); localMovie.CustomFormats = _formatCalculator.ParseCustomFormat(localMovie);
localMovie.CustomFormatScore = localMovie.Movie.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0; localMovie.CustomFormatScore = localMovie.Movie.QualityProfile?.CalculateCustomFormatScore(localMovie.CustomFormats) ?? 0;