|
|
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.Extras
|
|
|
|
|
{
|
|
|
|
|
public interface IExistingExtraFiles
|
|
|
|
|
{
|
|
|
|
|
List<string> ImportExtraFiles(Movie movie, List<string> possibleExtraFiles);
|
|
|
|
|
List<string> ImportExtraFiles(Movie movie, List<string> possibleExtraFiles, bool keepExistingEntries);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ExistingExtraFileService : IExistingExtraFiles, IHandle<MovieScannedEvent>
|
|
|
|
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Extras
|
|
|
|
|
_logger = logger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> ImportExtraFiles(Movie movie, List<string> possibleExtraFiles)
|
|
|
|
|
public List<string> ImportExtraFiles(Movie movie, List<string> possibleExtraFiles, bool keepExistingEntries)
|
|
|
|
|
{
|
|
|
|
|
_logger.Debug("Looking for existing extra files in {0}", movie.Path);
|
|
|
|
|
|
|
|
|
@ -33,7 +33,7 @@ namespace NzbDrone.Core.Extras
|
|
|
|
|
|
|
|
|
|
foreach (var existingExtraFileImporter in _existingExtraFileImporters)
|
|
|
|
|
{
|
|
|
|
|
var imported = existingExtraFileImporter.ProcessFiles(movie, possibleExtraFiles, importedFiles);
|
|
|
|
|
var imported = existingExtraFileImporter.ProcessFiles(movie, possibleExtraFiles, importedFiles, keepExistingEntries);
|
|
|
|
|
|
|
|
|
|
importedFiles.AddRange(imported.Select(f => Path.Combine(movie.Path, f.RelativePath)));
|
|
|
|
|
}
|
|
|
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Extras
|
|
|
|
|
{
|
|
|
|
|
var movie = message.Movie;
|
|
|
|
|
var possibleExtraFiles = message.PossibleExtraFiles;
|
|
|
|
|
var importedFiles = ImportExtraFiles(movie, possibleExtraFiles);
|
|
|
|
|
var importedFiles = ImportExtraFiles(movie, possibleExtraFiles, false);
|
|
|
|
|
|
|
|
|
|
_logger.Info("Found {0} possible extra files, imported {1} files.", possibleExtraFiles.Count, importedFiles.Count);
|
|
|
|
|
}
|
|
|
|
|