From cbc4295f28d49a98927299f06047e87dca77fe25 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 1 Feb 2021 17:59:42 -0800 Subject: [PATCH] Fixed: Use file name when importing batch release when renaming is disabled Closes #3056 --- .../Aggregators/AggregateEpisodesFixture.cs | 15 ++++++++------- .../Aggregators/AggregateLanguageFixture.cs | 12 ++++++------ .../Aggregators/AggregateQualityFixture.cs | 18 +++++++++--------- .../AggregateReleaseGroupFixture.cs | 10 +++++----- .../ImportDecisionMakerFixture.cs | 12 ++++++------ .../Metadata/ExistingMetadataImporter.cs | 2 +- .../Others/ExistingOtherExtraImporter.cs | 2 +- .../Subtitles/ExistingSubtitleImporter.cs | 2 +- .../Aggregation/AggregationService.cs | 6 +++--- .../Aggregators/AggregateEpisodes.cs | 12 ++++++------ .../Aggregators/AggregateLanguage.cs | 2 +- .../Aggregators/AggregatePreferredWordScore.cs | 2 +- .../Aggregators/AggregateQuality.cs | 2 +- .../Aggregators/AggregateReleaseGroup.cs | 2 +- .../Aggregators/IAggregateLocalEpisode.cs | 2 +- .../EpisodeImport/ImportDecisionMaker.cs | 5 +++-- .../Manual/ManualImportService.cs | 2 +- .../EpisodeImport/SceneNameCalculator.cs | 3 ++- src/NzbDrone.Core/Parser/Model/LocalEpisode.cs | 1 + 19 files changed, 58 insertions(+), 54 deletions(-) diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodesFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodesFixture.cs index 969720f15..fcef3de8a 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodesFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodesFixture.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); Mocker.GetMock() .Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); @@ -60,10 +60,11 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators FileEpisodeInfo = fileEpisodeInfo, FolderEpisodeInfo = folderEpisodeInfo, Path = @"C:\Test\Unsorted TV\Series.Title.S01\Series.Title.S01E01.mkv".AsOsAgnostic(), - Series = _series + Series = _series, + OtherVideoFiles = true }; - Subject.Aggregate(localEpisode, null, true); + Subject.Aggregate(localEpisode, null); Mocker.GetMock() .Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); @@ -82,7 +83,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); Mocker.GetMock() .Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); @@ -101,7 +102,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); Mocker.GetMock() .Verify(v => v.GetEpisodes(folderEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); @@ -120,7 +121,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); Mocker.GetMock() .Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); @@ -143,7 +144,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators .Setup(s => s.ParseSpecialEpisodeTitle(fileEpisodeInfo, It.IsAny(), _series)) .Returns(specialEpisodeInfo); - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); Mocker.GetMock() .Verify(v => v.GetEpisodes(specialEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguageFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguageFixture.cs index c43178f07..8f65460cc 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguageFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguageFixture.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators { _localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); - Subject.Aggregate(_localEpisode, null, false).Language.Should().Be(_localEpisode.FileEpisodeInfo.Language); + Subject.Aggregate(_localEpisode, null).Language.Should().Be(_localEpisode.FileEpisodeInfo.Language); } [Test] @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators _localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); _localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); - Subject.Aggregate(_localEpisode, null, false).Language.Should().Be(_localEpisode.FolderEpisodeInfo.Language); + Subject.Aggregate(_localEpisode, null).Language.Should().Be(_localEpisode.FolderEpisodeInfo.Language); } [Test] @@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators _localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); _localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); - Subject.Aggregate(_localEpisode, null, false).Language.Should().Be(_localEpisode.DownloadClientEpisodeInfo.Language); + Subject.Aggregate(_localEpisode, null).Language.Should().Be(_localEpisode.DownloadClientEpisodeInfo.Language); } @@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators _localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); _localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.French, _simpleReleaseTitle); - Subject.Aggregate(_localEpisode, null, false).Language.Should().Be(_localEpisode.FileEpisodeInfo.Language); + Subject.Aggregate(_localEpisode, null).Language.Should().Be(_localEpisode.FileEpisodeInfo.Language); } [Test] @@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators _localEpisode.Episodes.First().Title = "The Swedish Job"; _localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.Swedish, "Series.Title.S01E01.The.Swedish.Job.720p.WEB-DL-RlsGrp"); - Subject.Aggregate(_localEpisode, null, false).Language.Should().Be(Language.English); + Subject.Aggregate(_localEpisode, null).Language.Should().Be(Language.English); } @@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators _localEpisode.Episodes.First().Title = "The Swedish Job"; _localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.French, "Series.Title.S01E01.The.Swedish.Job.720p.WEB-DL-RlsGrp"); - Subject.Aggregate(_localEpisode, null, false).Language.Should().Be(_localEpisode.FileEpisodeInfo.Language); + Subject.Aggregate(_localEpisode, null).Language.Should().Be(_localEpisode.FileEpisodeInfo.Language); } } diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQualityFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQualityFixture.cs index ea6477df3..3f5084407 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQualityFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQualityFixture.cs @@ -60,7 +60,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators GivenAugmenters(_fileExtensionAugmenter, nullMock); - var result = Subject.Aggregate(new LocalEpisode(), null, false); + var result = Subject.Aggregate(new LocalEpisode(), null); result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Extension); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.Extension); @@ -72,7 +72,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators { GivenAugmenters(_fileExtensionAugmenter, _nameAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), null, false); + var result = Subject.Aggregate(new LocalEpisode(), null); result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Name); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.Name); @@ -84,7 +84,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators { GivenAugmenters(_fileExtensionAugmenter, _mediaInfoAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), null, false); + var result = Subject.Aggregate(new LocalEpisode(), null); result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Extension); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo); @@ -96,7 +96,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators { GivenAugmenters(_nameAugmenter, _mediaInfoAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), null, false); + var result = Subject.Aggregate(new LocalEpisode(), null); result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Name); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo); @@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators { GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem(), false); + var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem()); result.Quality.SourceDetectionSource.Should().Be(QualityDetectionSource.Name); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.Name); @@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators { GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem(), false); + var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem()); result.Quality.Revision.Version.Should().Be(1); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Unknown); @@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem(), false); + var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem()); result.Quality.Revision.Version.Should().Be(2); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name); @@ -148,7 +148,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem(), false); + var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem()); result.Quality.Revision.Version.Should().Be(0); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name); @@ -165,7 +165,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); - var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem(), false); + var result = Subject.Aggregate(new LocalEpisode(), new DownloadClientItem()); result.Quality.Revision.Version.Should().Be(2); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name); diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs index 3f234e2f2..60f29a01c 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs @@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); localEpisode.ReleaseGroup.Should().Be("Wizzy"); } @@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); localEpisode.ReleaseGroup.Should().Be("Wizzy"); } @@ -72,7 +72,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); localEpisode.ReleaseGroup.Should().Be("Viva"); } @@ -92,7 +92,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); localEpisode.ReleaseGroup.Should().Be("Drone"); } @@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators Series = _series }; - Subject.Aggregate(localEpisode, null, false); + Subject.Aggregate(localEpisode, null); localEpisode.ReleaseGroup.Should().Be("Wizzy"); } diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs index fc1088b63..21feb0a09 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/ImportDecisionMakerFixture.cs @@ -93,8 +93,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport private void GivenAugmentationSuccess() { Mocker.GetMock() - .Setup(s => s.Augment(It.IsAny(), It.IsAny(), It.IsAny())) - .Callback((localEpisode, downloadClientItem, otherFiles) => + .Setup(s => s.Augment(It.IsAny(), It.IsAny())) + .Callback((localEpisode, downloadClientItem) => { localEpisode.Episodes = _localEpisode.Episodes; }); @@ -164,7 +164,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport GivenSpecifications(_pass1); Mocker.GetMock() - .Setup(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(c => c.Augment(It.IsAny(), It.IsAny())) .Throws(); _videoFiles = new List @@ -179,7 +179,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport Subject.GetImportDecisions(_videoFiles, _series); Mocker.GetMock() - .Verify(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(_videoFiles.Count)); + .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_videoFiles.Count)); ExceptionVerification.ExpectedErrors(3); } @@ -200,7 +200,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport var decisions = Subject.GetImportDecisions(_videoFiles, _series); Mocker.GetMock() - .Verify(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(_videoFiles.Count)); + .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_videoFiles.Count)); decisions.Should().HaveCount(3); decisions.First().Rejections.Should().NotBeEmpty(); @@ -210,7 +210,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport public void should_return_a_decision_when_exception_is_caught() { Mocker.GetMock() - .Setup(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(c => c.Augment(It.IsAny(), It.IsAny())) .Throws(); _videoFiles = new List diff --git a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs index aabce72aa..0a0fb0b8b 100644 --- a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs +++ b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs @@ -71,7 +71,7 @@ namespace NzbDrone.Core.Extras.Metadata try { - _aggregationService.Augment(localEpisode, null, false); + _aggregationService.Augment(localEpisode, null); } catch (AugmentingFailedException) { diff --git a/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs b/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs index e9093f2d0..16fb4e9c8 100644 --- a/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs +++ b/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs @@ -56,7 +56,7 @@ namespace NzbDrone.Core.Extras.Others try { - _aggregationService.Augment(localEpisode, null, false); + _aggregationService.Augment(localEpisode, null); } catch (AugmentingFailedException) { diff --git a/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs b/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs index 068e0bba7..9325eef90 100644 --- a/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs +++ b/src/NzbDrone.Core/Extras/Subtitles/ExistingSubtitleImporter.cs @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Extras.Subtitles try { - _aggregationService.Augment(localEpisode, null, false); + _aggregationService.Augment(localEpisode, null); } catch (AugmentingFailedException) { diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs index 32ab5ffcf..faa3aaea8 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/AggregationService.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation { public interface IAggregationService { - LocalEpisode Augment(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles); + LocalEpisode Augment(LocalEpisode localEpisode, DownloadClientItem downloadClientItem); } public class AggregationService : IAggregationService @@ -39,7 +39,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation _logger = logger; } - public LocalEpisode Augment(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) + public LocalEpisode Augment(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path)); @@ -65,7 +65,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation { try { - augmenter.Aggregate(localEpisode, downloadClientItem, otherFiles); + augmenter.Aggregate(localEpisode, downloadClientItem); } catch (Exception ex) { diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodes.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodes.cs index a446d3356..c9f3c39e5 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodes.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateEpisodes.cs @@ -16,20 +16,20 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators _parsingService = parsingService; } - public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) + public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { - localEpisode.Episodes = GetEpisodes(localEpisode, otherFiles); + localEpisode.Episodes = GetEpisodes(localEpisode); return localEpisode; } - private ParsedEpisodeInfo GetBestEpisodeInfo(LocalEpisode localEpisode, bool otherFiles) + private ParsedEpisodeInfo GetBestEpisodeInfo(LocalEpisode localEpisode) { var parsedEpisodeInfo = localEpisode.FileEpisodeInfo; var downloadClientEpisodeInfo = localEpisode.DownloadClientEpisodeInfo; var folderEpisodeInfo = localEpisode.FolderEpisodeInfo; - if (!otherFiles && !SceneChecker.IsSceneTitle(Path.GetFileNameWithoutExtension(localEpisode.Path))) + if (!localEpisode.OtherVideoFiles && !SceneChecker.IsSceneTitle(Path.GetFileNameWithoutExtension(localEpisode.Path))) { if (downloadClientEpisodeInfo != null && !downloadClientEpisodeInfo.FullSeason && @@ -59,9 +59,9 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators return parsedEpisodeInfo; } - private List GetEpisodes(LocalEpisode localEpisode, bool otherFiles) + private List GetEpisodes(LocalEpisode localEpisode) { - var bestEpisodeInfoForEpisodes = GetBestEpisodeInfo(localEpisode, otherFiles); + var bestEpisodeInfoForEpisodes = GetBestEpisodeInfo(localEpisode); var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path)); if (bestEpisodeInfoForEpisodes == null) diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguage.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguage.cs index a25e3e75e..d861574f4 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguage.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateLanguage.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators _logger = logger; } - public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) + public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { // Get languages in preferred order, download client item, folder and finally file. // Non-English languages will be preferred later, in the event there is a conflict diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregatePreferredWordScore.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregatePreferredWordScore.cs index 9c1b4d706..67c319498 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregatePreferredWordScore.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregatePreferredWordScore.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators _preferredWordService = preferredWordService; } - public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) + public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { var series = localEpisode.Series; var scores = new List(); diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQuality.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQuality.cs index e4c26a951..a53f7f4e0 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQuality.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateQuality.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators _logger = logger; } - public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) + public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { var source = QualitySource.Unknown; var sourceConfidence = Confidence.Default; diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroup.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroup.cs index 2126120a4..a9eb67bc3 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroup.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/AggregateReleaseGroup.cs @@ -6,7 +6,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators { public class AggregateReleaseGroup : IAggregateLocalEpisode { - public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) + public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem) { // Prefer ReleaseGroup from DownloadClient/Folder if they're not a season pack var releaseGroup = GetReleaseGroup(localEpisode.DownloadClientEpisodeInfo, true); diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/IAggregateLocalEpisode.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/IAggregateLocalEpisode.cs index c6374744e..e32cf7a02 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/IAggregateLocalEpisode.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Aggregation/Aggregators/IAggregateLocalEpisode.cs @@ -5,6 +5,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators { public interface IAggregateLocalEpisode { - LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles); + LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem); } } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs index 282fb5bd1..fd8cf8a06 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/ImportDecisionMaker.cs @@ -82,7 +82,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport FolderEpisodeInfo = folderInfo, Path = file, SceneSource = sceneSource, - ExistingFile = series.Path.IsParentPath(file) + ExistingFile = series.Path.IsParentPath(file), + OtherVideoFiles = nonSampleVideoFileCount > 1 }; decisions.AddIfNotNull(GetDecision(localEpisode, downloadClientItem, nonSampleVideoFileCount > 1)); @@ -110,7 +111,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport try { - _aggregationService.Augment(localEpisode, downloadClientItem, otherFiles); + _aggregationService.Augment(localEpisode, downloadClientItem); 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 8d17034f7..253fcbfcc 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Manual/ManualImportService.cs @@ -400,7 +400,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual localEpisode.SceneSource = !existingFile; } - localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem, false); + localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem); // Apply the user-chosen values. localEpisode.Series = series; diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/SceneNameCalculator.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/SceneNameCalculator.cs index e91e0b559..aac41e6f7 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/SceneNameCalculator.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/SceneNameCalculator.cs @@ -9,9 +9,10 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport { public static string GetSceneName(LocalEpisode localEpisode) { + var otherVideoFiles = localEpisode.OtherVideoFiles; var downloadClientInfo = localEpisode.DownloadClientEpisodeInfo; - if (downloadClientInfo != null && !downloadClientInfo.FullSeason) + if (!otherVideoFiles && downloadClientInfo != null && !downloadClientInfo.FullSeason) { return Parser.Parser.RemoveFileExtension(downloadClientInfo.ReleaseTitle); } diff --git a/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs b/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs index 8df57e3a6..86556bc65 100644 --- a/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs +++ b/src/NzbDrone.Core/Parser/Model/LocalEpisode.cs @@ -30,6 +30,7 @@ namespace NzbDrone.Core.Parser.Model public string ReleaseGroup { get; set; } public string SceneName { get; set; } public int PreferredWordScore { get; set; } + public bool OtherVideoFiles { get; set; } public int SeasonNumber {