diff --git a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs index 9bae5bbfb..df17bac5e 100644 --- a/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/MovieImport/Manual/ManualImportService.cs @@ -108,8 +108,8 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual SceneSource = SceneSource(movie, rootFolder), ExistingFile = movie.Path.IsParentPath(path), Size = _diskProvider.GetFileSize(path), - Languages = languages, - Quality = quality + Languages = (languages?.SingleOrDefault() ?? Language.Unknown) == Language.Unknown ? LanguageParser.ParseLanguages(path) : languages, + Quality = quality.Quality == Quality.Unknown ? QualityParser.ParseQuality(path) : quality }; return MapItem(_importDecisionMaker.GetDecision(localEpisode, downloadClientItem), rootFolder, downloadId, null); @@ -140,7 +140,14 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual // Filter paths based on the rootFolder, so files in subfolders that should be ignored are ignored. // It will lead to some extra directories being checked for files, but it saves the processing of them and is cleaner than // teaching FilterPaths to know whether it's processing a file or a folder and changing it's filtering based on that. + // If the movie is unknown for the directory and there are more than 100 files in the folder don't process the items before returning. var files = _diskScanService.FilterPaths(rootFolder, _diskScanService.GetVideoFiles(baseFolder, false)); + + if (files.Count() > 100) + { + return ProcessDownloadDirectory(rootFolder, files); + } + var subfolders = _diskScanService.FilterPaths(rootFolder, _diskProvider.GetDirectories(baseFolder)); var processedFiles = files.Select(file => ProcessFile(rootFolder, baseFolder, file, downloadId)); @@ -214,6 +221,24 @@ namespace NzbDrone.Core.MediaFiles.MovieImport.Manual }; } + private List ProcessDownloadDirectory(string rootFolder, List videoFiles) + { + var items = new List(); + + foreach (var file in videoFiles) + { + var localEpisode = new LocalMovie(); + localEpisode.Path = file; + localEpisode.Quality = new QualityModel(Quality.Unknown); + localEpisode.Languages = new List { Language.Unknown }; + localEpisode.Size = _diskProvider.GetFileSize(file); + + items.Add(MapItem(new ImportDecision(localEpisode), rootFolder, null, null)); + } + + return items; + } + private bool SceneSource(Movie movie, string folder) { return !(movie.Path.PathEquals(folder) || movie.Path.IsParentPath(folder)); diff --git a/src/Radarr.Api.V3/ManualImport/ManualImportModule.cs b/src/Radarr.Api.V3/ManualImport/ManualImportModule.cs index 21d06f0fb..f2abc9ac0 100644 --- a/src/Radarr.Api.V3/ManualImport/ManualImportModule.cs +++ b/src/Radarr.Api.V3/ManualImport/ManualImportModule.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using NzbDrone.Core.Languages; using NzbDrone.Core.MediaFiles.MovieImport.Manual; using NzbDrone.Core.Qualities; using Radarr.Api.V3.Movies; @@ -41,7 +42,15 @@ namespace Radarr.Api.V3.ManualImport item.Movie = processedItem.Movie.ToResource(0); item.Rejections = processedItem.Rejections; - item.Languages = processedItem.Languages; + if (item.Languages.Single() == Language.Unknown) + { + item.Languages = processedItem.Languages; + } + + if (item.Quality?.Quality == Quality.Unknown) + { + item.Quality = processedItem.Quality; + } } return items;