diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs index c25d3c99f..3ff569e97 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/ImportDecisionMaker.cs @@ -3,18 +3,13 @@ using System.Collections.Generic; 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 @@ namespace NzbDrone.Core.MediaFiles.MovieImport { List GetImportDecisions(List videoFiles, Movie movie); List GetImportDecisions(List videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource); + List GetImportDecisions(List videoFiles, Movie movie, DownloadClientItem downloadClientItem, ParsedMovieInfo folderInfo, bool sceneSource, bool filterExistingFiles); } public class ImportDecisionMaker : IMakeImportDecision @@ -33,11 +29,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport 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 _warnedFiles; private readonly Logger _logger; public ImportDecisionMaker(IEnumerable specifications, @@ -45,11 +37,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport IAggregationService aggregationService, IDiskProvider diskProvider, IDetectSample detectSample, - IQualityDefinitionService qualitiesService, - IConfigService config, - IHistoryService historyService, IParsingService parsingService, - ICacheManager cacheManager, Logger logger) { _specifications = specifications; @@ -57,22 +45,23 @@ namespace NzbDrone.Core.MediaFiles.MovieImport _aggregationService = aggregationService; _diskProvider = diskProvider; _detectSample = detectSample; - _qualitiesService = qualitiesService; - _config = config; - _historyService = historyService; _parsingService = parsingService; - _warnedFiles = cacheManager.GetCache(this.GetType()); _logger = logger; } public List GetImportDecisions(List videoFiles, Movie movie) { - return GetImportDecisions(videoFiles, movie, null, null, true); + return GetImportDecisions(videoFiles, movie, null, null, false); } public List GetImportDecisions(List 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 GetImportDecisions(List 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 @@ namespace NzbDrone.Core.MediaFiles.MovieImport DownloadClientMovieInfo = downloadClientItemInfo, FolderMovieInfo = folderInfo, Path = file, - SceneSource = sceneSource + SceneSource = sceneSource, + ExistingFile = movie.Path.IsParentPath(file) }; decisions.AddIfNotNull(GetDecision(localMovie, downloadClientItem, nonSampleVideoFileCount > 1)); diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs index 34b4009fa..6ad533b93 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs @@ -132,7 +132,7 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual 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(); }