diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs index 416311940..719682080 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs @@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport private void GivenAugmentationSuccess() { - Mocker.GetMock() + Mocker.GetMock() .Setup(s => s.Augment(It.IsAny(), It.IsAny())) .Callback((localEpisode, otherFiles) => { @@ -158,7 +158,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport { GivenSpecifications(_pass1); - Mocker.GetMock() + Mocker.GetMock() .Setup(c => c.Augment(It.IsAny(), It.IsAny())) .Throws(); @@ -173,7 +173,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport Subject.GetImportDecisions(_videoFiles, _series); - Mocker.GetMock() + Mocker.GetMock() .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_videoFiles.Count)); ExceptionVerification.ExpectedErrors(3); @@ -195,7 +195,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport var decisions = Subject.GetImportDecisions(_videoFiles, _series); - Mocker.GetMock() + Mocker.GetMock() .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_videoFiles.Count)); decisions.Should().HaveCount(3); @@ -205,7 +205,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport [Test] public void should_return_a_decision_when_exception_is_caught() { - Mocker.GetMock() + Mocker.GetMock() .Setup(c => c.Augment(It.IsAny(), It.IsAny())) .Throws(); diff --git a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs index b5250f6e6..e43949142 100644 --- a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs +++ b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs @@ -16,18 +16,18 @@ namespace NzbDrone.Core.Extras.Metadata public class ExistingMetadataImporter : ImportExistingExtraFilesBase { private readonly IExtraFileService _metadataFileService; - private readonly IAugmentingService _augmentingService; + private readonly IAggregationService _aggregationService; private readonly Logger _logger; private readonly List _consumers; public ExistingMetadataImporter(IExtraFileService metadataFileService, IEnumerable consumers, - IAugmentingService augmentingService, + IAggregationService aggregationService, Logger logger) : base(metadataFileService) { _metadataFileService = metadataFileService; - _augmentingService = augmentingService; + _aggregationService = aggregationService; _logger = logger; _consumers = consumers.ToList(); } @@ -71,7 +71,7 @@ namespace NzbDrone.Core.Extras.Metadata try { - _augmentingService.Augment(localEpisode, false); + _aggregationService.Augment(localEpisode, false); } catch (AugmentingFailedException ex) { diff --git a/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs b/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs index 724f4968c..23e422eda 100644 --- a/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs +++ b/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs @@ -15,16 +15,16 @@ namespace NzbDrone.Core.Extras.Others public class ExistingOtherExtraImporter : ImportExistingExtraFilesBase { private readonly IExtraFileService _otherExtraFileService; - private readonly IAugmentingService _augmentingService; + private readonly IAggregationService _aggregationService; private readonly Logger _logger; public ExistingOtherExtraImporter(IExtraFileService otherExtraFileService, - IAugmentingService augmentingService, + IAggregationService aggregationService, Logger logger) : base(otherExtraFileService) { _otherExtraFileService = otherExtraFileService; - _augmentingService = augmentingService; + _aggregationService = aggregationService; _logger = logger; } @@ -56,7 +56,7 @@ namespace NzbDrone.Core.Extras.Others try { - _augmentingService.Augment(localEpisode, false); + _aggregationService.Augment(localEpisode, false); } catch (AugmentingFailedException ex) { diff --git a/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs b/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs index c15732351..79c4544b1 100644 --- a/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs +++ b/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs @@ -14,16 +14,16 @@ namespace NzbDrone.Core.Extras.Subtitles public class ExistingSubtitleImporter : ImportExistingExtraFilesBase { private readonly IExtraFileService _subtitleFileService; - private readonly IAugmentingService _augmentingService; + private readonly IAggregationService _aggregationService; private readonly Logger _logger; public ExistingSubtitleImporter(IExtraFileService subtitleFileService, - IAugmentingService augmentingService, + IAggregationService aggregationService, Logger logger) : base (subtitleFileService) { _subtitleFileService = subtitleFileService; - _augmentingService = augmentingService; + _aggregationService = aggregationService; _logger = logger; } @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Extras.Subtitles try { - _augmentingService.Augment(localEpisode, false); + _aggregationService.Augment(localEpisode, false); } catch (AugmentingFailedException ex) { diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs index b66078ce6..14ff63a98 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs @@ -10,12 +10,12 @@ using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation { - public interface IAugmentingService + public interface IAggregationService { LocalEpisode Augment(LocalEpisode localEpisode, bool otherFiles); } - public class AugmentingService : IAugmentingService + public class AggregationService : IAggregationService { private readonly IEnumerable _augmenters; private readonly IDiskProvider _diskProvider; @@ -23,7 +23,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation private readonly IConfigService _configService; private readonly Logger _logger; - public AugmentingService(IEnumerable augmenters, + public AggregationService(IEnumerable augmenters, IDiskProvider diskProvider, IVideoFileInfoReader videoFileInfoReader, IConfigService configService, @@ -38,11 +38,13 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation public LocalEpisode Augment(LocalEpisode localEpisode, bool otherFiles) { + var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path)); + if (localEpisode.DownloadClientEpisodeInfo == null && localEpisode.FolderEpisodeInfo == null && localEpisode.FileEpisodeInfo == null) { - if (MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path))) + if (isMediaFile) { throw new AugmentingFailedException("Unable to parse episode info from path: {0}", localEpisode.Path); } @@ -50,7 +52,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation localEpisode.Size = _diskProvider.GetFileSize(localEpisode.Path); - if (!localEpisode.ExistingFile || _configService.EnableMediaInfo) + if (isMediaFile && (!localEpisode.ExistingFile || _configService.EnableMediaInfo)) { localEpisode.MediaInfo = _videoFileInfoReader.GetMediaInfo(localEpisode.Path); } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs index 28180f404..8507bd3c4 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs @@ -23,21 +23,21 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport { private readonly IEnumerable _specifications; private readonly IMediaFileService _mediaFileService; - private readonly IAugmentingService _augmentingService; + private readonly IAggregationService _aggregationService; private readonly IDiskProvider _diskProvider; private readonly IDetectSample _detectSample; private readonly Logger _logger; public ImportDecisionMaker(IEnumerable specifications, IMediaFileService mediaFileService, - IAugmentingService augmentingService, + IAggregationService aggregationService, IDiskProvider diskProvider, IDetectSample detectSample, Logger logger) { _specifications = specifications; _mediaFileService = mediaFileService; - _augmentingService = augmentingService; + _aggregationService = aggregationService; _diskProvider = diskProvider; _detectSample = detectSample; _logger = logger; @@ -96,7 +96,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport try { - _augmentingService.Augment(localEpisode, otherFiles); + _aggregationService.Augment(localEpisode, otherFiles); if (localEpisode.Episodes.Empty()) { diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs index 40ae716fe..b3110a540 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -34,7 +34,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual private readonly IEpisodeService _episodeService; private readonly IVideoFileInfoReader _videoFileInfoReader; private readonly IImportApprovedEpisodes _importApprovedEpisodes; - private readonly IAugmentingService _augmentingService; + private readonly IAggregationService _aggregationService; private readonly ITrackedDownloadService _trackedDownloadService; private readonly IDownloadedEpisodesImportService _downloadedEpisodesImportService; private readonly IEventAggregator _eventAggregator; @@ -47,7 +47,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual ISeriesService seriesService, IEpisodeService episodeService, IVideoFileInfoReader videoFileInfoReader, - IAugmentingService augmentingService, + IAggregationService aggregationService, IImportApprovedEpisodes importApprovedEpisodes, ITrackedDownloadService trackedDownloadService, IDownloadedEpisodesImportService downloadedEpisodesImportService, @@ -61,7 +61,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual _seriesService = seriesService; _episodeService = episodeService; _videoFileInfoReader = videoFileInfoReader; - _augmentingService = augmentingService; + _aggregationService = aggregationService; _importApprovedEpisodes = importApprovedEpisodes; _trackedDownloadService = trackedDownloadService; _downloadedEpisodesImportService = downloadedEpisodesImportService; @@ -281,7 +281,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual localEpisode.FolderEpisodeInfo = Parser.Parser.ParseTitle(file.FolderName); } - localEpisode = _augmentingService.Augment(localEpisode, false); + localEpisode = _aggregationService.Augment(localEpisode, false); // Apply the user-chosen values. localEpisode.Series = series; diff --git a/src/NzbDrone.sln.DotSettings b/src/NzbDrone.sln.DotSettings index 1d351d0ce..275ac5005 100644 --- a/src/NzbDrone.sln.DotSettings +++ b/src/NzbDrone.sln.DotSettings @@ -30,9 +30,13 @@ ALWAYS_ADD True True + NEVER + NEVER False + NEVER False False + ALWAYS ON_SINGLE_LINE False False @@ -71,7 +75,12 @@ True 2 False + True + True + True + True True + True True True True