1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: All Files Filter on Manual Import in MovieDetails

This commit is contained in:
Qstick 2019-12-06 23:06:58 -05:00
parent aa7ebe4168
commit ca61ca5c40
2 changed files with 11 additions and 21 deletions

View File

@ -3,18 +3,13 @@
using System.IO;
using System.Linq;
using NLog;
using NzbDrone.Common.Cache;
using NzbDrone.Common.Disk;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.DecisionEngine;
using NzbDrone.Core.Download;
using NzbDrone.Core.History;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Movies;
using NzbDrone.Core.MediaFiles.MediaInfo;
using NzbDrone.Core.MediaFiles.MovieImport.Aggregation;
@ -24,6 +19,7 @@ public interface IMakeImportDecision
{
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie);
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource);
List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource, bool filterExistingFiles);
}
public class ImportDecisionMaker : IMakeImportDecision
@ -33,11 +29,7 @@ public class ImportDecisionMaker : IMakeImportDecision
private readonly IAggregationService _aggregationService;
private readonly IDiskProvider _diskProvider;
private readonly IDetectSample _detectSample;
private readonly IQualityDefinitionService _qualitiesService;
private readonly IConfigService _config;
private readonly IHistoryService _historyService;
private readonly IParsingService _parsingService;
private readonly ICached<string> _warnedFiles;
private readonly Logger _logger;
public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification> specifications,
@ -45,11 +37,7 @@ public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification> speci
IAggregationService aggregationService,
IDiskProvider diskProvider,
IDetectSample detectSample,
IQualityDefinitionService qualitiesService,
IConfigService config,
IHistoryService historyService,
IParsingService parsingService,
ICacheManager cacheManager,
Logger logger)
{
_specifications = specifications;
@ -57,22 +45,23 @@ public ImportDecisionMaker(IEnumerable<IImportDecisionEngineSpecification> speci
_aggregationService = aggregationService;
_diskProvider = diskProvider;
_detectSample = detectSample;
_qualitiesService = qualitiesService;
_config = config;
_historyService = historyService;
_parsingService = parsingService;
_warnedFiles = cacheManager.GetCache<string>(this.GetType());
_logger = logger;
}
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie)
{
return GetImportDecisions(videoFiles, movie, null, null, true);
return GetImportDecisions(videoFiles, movie, null, null, false);
}
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource)
{
var newFiles = _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie);
return GetImportDecisions(videoFiles, movie, downloadClientItem, folderInfo, sceneSource, true);
}
public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource, bool filterExistingFiles)
{
var newFiles = filterExistingFiles ? _mediaFileService.FilterExistingFiles(videoFiles.ToList(), movie) : videoFiles.ToList();
_logger.Debug("Analyzing {0}/{1} files.", newFiles.Count, videoFiles.Count());
@ -96,7 +85,8 @@ public List<ImportDecision> GetImportDecisions(List<string> videoFiles, Movie mo
DownloadClientMovieInfo = downloadClientItemInfo,
FolderMovieInfo = folderInfo,
Path = file,
SceneSource = sceneSource
SceneSource = sceneSource,
ExistingFile = movie.Path.IsParentPath(file)
};
decisions.AddIfNotNull(GetDecision(localMovie, downloadClientItem, nonSampleVideoFileCount > 1));

View File

@ -132,7 +132,7 @@ private List<ManualImportItem> ProcessFolder(string rootFolder, string baseFolde
var folderInfo = Parser.Parser.ParseMovieTitle(directoryInfo.Name, false);
var movieFiles = _diskScanService.GetVideoFiles(baseFolder).ToList();
var decisions = _importDecisionMaker.GetImportDecisions(movieFiles, movie, downloadClientItem, folderInfo, SceneSource(movie, baseFolder));
var decisions = _importDecisionMaker.GetImportDecisions(movieFiles, movie, downloadClientItem, folderInfo, SceneSource(movie, baseFolder), filterExistingFiles);
return decisions.Select(decision => MapItem(decision, rootFolder, downloadId, directoryInfo.Name)).ToList();
}