Fixed: Use file name when importing batch release when renaming is disabled

Closes #3056
This commit is contained in:
Mark McDowall 2021-02-01 17:59:42 -08:00
parent 8876c9194d
commit cbc4295f28
19 changed files with 58 additions and 54 deletions

View File

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
Series = _series Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
Mocker.GetMock<IParsingService>() Mocker.GetMock<IParsingService>()
.Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); .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, FileEpisodeInfo = fileEpisodeInfo,
FolderEpisodeInfo = folderEpisodeInfo, FolderEpisodeInfo = folderEpisodeInfo,
Path = @"C:\Test\Unsorted TV\Series.Title.S01\Series.Title.S01E01.mkv".AsOsAgnostic(), 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<IParsingService>() Mocker.GetMock<IParsingService>()
.Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); .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 Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
Mocker.GetMock<IParsingService>() Mocker.GetMock<IParsingService>()
.Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); .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 Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
Mocker.GetMock<IParsingService>() Mocker.GetMock<IParsingService>()
.Verify(v => v.GetEpisodes(folderEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); .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 Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
Mocker.GetMock<IParsingService>() Mocker.GetMock<IParsingService>()
.Verify(v => v.GetEpisodes(fileEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); .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<string>(), _series)) .Setup(s => s.ParseSpecialEpisodeTitle(fileEpisodeInfo, It.IsAny<string>(), _series))
.Returns(specialEpisodeInfo); .Returns(specialEpisodeInfo);
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
Mocker.GetMock<IParsingService>() Mocker.GetMock<IParsingService>()
.Verify(v => v.GetEpisodes(specialEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once()); .Verify(v => v.GetEpisodes(specialEpisodeInfo, _series, localEpisode.SceneSource, null), Times.Once());

View File

@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
{ {
_localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); _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] [Test]
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
_localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); _localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle);
_localEpisode.FileEpisodeInfo = 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] [Test]
@ -63,7 +63,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
_localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle); _localEpisode.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle);
_localEpisode.FileEpisodeInfo = 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.FolderEpisodeInfo = GetParsedEpisodeInfo(Language.English, _simpleReleaseTitle);
_localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.French, _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] [Test]
@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
_localEpisode.Episodes.First().Title = "The Swedish Job"; _localEpisode.Episodes.First().Title = "The Swedish Job";
_localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.Swedish, "Series.Title.S01E01.The.Swedish.Job.720p.WEB-DL-RlsGrp"); _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.Episodes.First().Title = "The Swedish Job";
_localEpisode.FileEpisodeInfo = GetParsedEpisodeInfo(Language.French, "Series.Title.S01E01.The.Swedish.Job.720p.WEB-DL-RlsGrp"); _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);
} }
} }

View File

@ -60,7 +60,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
GivenAugmenters(_fileExtensionAugmenter, nullMock); 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.SourceDetectionSource.Should().Be(QualityDetectionSource.Extension);
result.Quality.ResolutionDetectionSource.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); 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.SourceDetectionSource.Should().Be(QualityDetectionSource.Name);
result.Quality.ResolutionDetectionSource.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); 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.SourceDetectionSource.Should().Be(QualityDetectionSource.Extension);
result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo);
@ -96,7 +96,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
{ {
GivenAugmenters(_nameAugmenter, _mediaInfoAugmenter); 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.SourceDetectionSource.Should().Be(QualityDetectionSource.Name);
result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo); result.Quality.ResolutionDetectionSource.Should().Be(QualityDetectionSource.MediaInfo);
@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
{ {
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); 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.SourceDetectionSource.Should().Be(QualityDetectionSource.Name);
result.Quality.ResolutionDetectionSource.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); 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.Revision.Version.Should().Be(1);
result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Unknown); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Unknown);
@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); 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.Revision.Version.Should().Be(2);
result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name);
@ -148,7 +148,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); 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.Revision.Version.Should().Be(0);
result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name);
@ -165,7 +165,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
GivenAugmenters(_nameAugmenter, _releaseNameAugmenter); 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.Revision.Version.Should().Be(2);
result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name); result.Quality.RevisionDetectionSource.Should().Be(QualityDetectionSource.Name);

View File

@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
Series = _series Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
localEpisode.ReleaseGroup.Should().Be("Wizzy"); localEpisode.ReleaseGroup.Should().Be("Wizzy");
} }
@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
Series = _series Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
localEpisode.ReleaseGroup.Should().Be("Wizzy"); localEpisode.ReleaseGroup.Should().Be("Wizzy");
} }
@ -72,7 +72,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
Series = _series Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
localEpisode.ReleaseGroup.Should().Be("Viva"); localEpisode.ReleaseGroup.Should().Be("Viva");
} }
@ -92,7 +92,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
Series = _series Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
localEpisode.ReleaseGroup.Should().Be("Drone"); localEpisode.ReleaseGroup.Should().Be("Drone");
} }
@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Aggregation.Aggregators
Series = _series Series = _series
}; };
Subject.Aggregate(localEpisode, null, false); Subject.Aggregate(localEpisode, null);
localEpisode.ReleaseGroup.Should().Be("Wizzy"); localEpisode.ReleaseGroup.Should().Be("Wizzy");
} }

View File

@ -93,8 +93,8 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
private void GivenAugmentationSuccess() private void GivenAugmentationSuccess()
{ {
Mocker.GetMock<IAggregationService>() Mocker.GetMock<IAggregationService>()
.Setup(s => s.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>(), It.IsAny<bool>())) .Setup(s => s.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Callback<LocalEpisode, DownloadClientItem, bool>((localEpisode, downloadClientItem, otherFiles) => .Callback<LocalEpisode, DownloadClientItem>((localEpisode, downloadClientItem) =>
{ {
localEpisode.Episodes = _localEpisode.Episodes; localEpisode.Episodes = _localEpisode.Episodes;
}); });
@ -164,7 +164,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
GivenSpecifications(_pass1); GivenSpecifications(_pass1);
Mocker.GetMock<IAggregationService>() Mocker.GetMock<IAggregationService>()
.Setup(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>(), It.IsAny<bool>())) .Setup(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Throws<TestException>(); .Throws<TestException>();
_videoFiles = new List<string> _videoFiles = new List<string>
@ -179,7 +179,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
Subject.GetImportDecisions(_videoFiles, _series); Subject.GetImportDecisions(_videoFiles, _series);
Mocker.GetMock<IAggregationService>() Mocker.GetMock<IAggregationService>()
.Verify(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>(), It.IsAny<bool>()), Times.Exactly(_videoFiles.Count)); .Verify(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()), Times.Exactly(_videoFiles.Count));
ExceptionVerification.ExpectedErrors(3); ExceptionVerification.ExpectedErrors(3);
} }
@ -200,7 +200,7 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport
var decisions = Subject.GetImportDecisions(_videoFiles, _series); var decisions = Subject.GetImportDecisions(_videoFiles, _series);
Mocker.GetMock<IAggregationService>() Mocker.GetMock<IAggregationService>()
.Verify(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>(), It.IsAny<bool>()), Times.Exactly(_videoFiles.Count)); .Verify(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()), Times.Exactly(_videoFiles.Count));
decisions.Should().HaveCount(3); decisions.Should().HaveCount(3);
decisions.First().Rejections.Should().NotBeEmpty(); 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() public void should_return_a_decision_when_exception_is_caught()
{ {
Mocker.GetMock<IAggregationService>() Mocker.GetMock<IAggregationService>()
.Setup(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>(), It.IsAny<bool>())) .Setup(c => c.Augment(It.IsAny<LocalEpisode>(), It.IsAny<DownloadClientItem>()))
.Throws<TestException>(); .Throws<TestException>();
_videoFiles = new List<string> _videoFiles = new List<string>

View File

@ -71,7 +71,7 @@ namespace NzbDrone.Core.Extras.Metadata
try try
{ {
_aggregationService.Augment(localEpisode, null, false); _aggregationService.Augment(localEpisode, null);
} }
catch (AugmentingFailedException) catch (AugmentingFailedException)
{ {

View File

@ -56,7 +56,7 @@ namespace NzbDrone.Core.Extras.Others
try try
{ {
_aggregationService.Augment(localEpisode, null, false); _aggregationService.Augment(localEpisode, null);
} }
catch (AugmentingFailedException) catch (AugmentingFailedException)
{ {

View File

@ -51,7 +51,7 @@ namespace NzbDrone.Core.Extras.Subtitles
try try
{ {
_aggregationService.Augment(localEpisode, null, false); _aggregationService.Augment(localEpisode, null);
} }
catch (AugmentingFailedException) catch (AugmentingFailedException)
{ {

View File

@ -15,7 +15,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation
{ {
public interface IAggregationService public interface IAggregationService
{ {
LocalEpisode Augment(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles); LocalEpisode Augment(LocalEpisode localEpisode, DownloadClientItem downloadClientItem);
} }
public class AggregationService : IAggregationService public class AggregationService : IAggregationService
@ -39,7 +39,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation
_logger = logger; _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)); var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path));
@ -65,7 +65,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation
{ {
try try
{ {
augmenter.Aggregate(localEpisode, downloadClientItem, otherFiles); augmenter.Aggregate(localEpisode, downloadClientItem);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -16,20 +16,20 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
_parsingService = parsingService; _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; return localEpisode;
} }
private ParsedEpisodeInfo GetBestEpisodeInfo(LocalEpisode localEpisode, bool otherFiles) private ParsedEpisodeInfo GetBestEpisodeInfo(LocalEpisode localEpisode)
{ {
var parsedEpisodeInfo = localEpisode.FileEpisodeInfo; var parsedEpisodeInfo = localEpisode.FileEpisodeInfo;
var downloadClientEpisodeInfo = localEpisode.DownloadClientEpisodeInfo; var downloadClientEpisodeInfo = localEpisode.DownloadClientEpisodeInfo;
var folderEpisodeInfo = localEpisode.FolderEpisodeInfo; var folderEpisodeInfo = localEpisode.FolderEpisodeInfo;
if (!otherFiles && !SceneChecker.IsSceneTitle(Path.GetFileNameWithoutExtension(localEpisode.Path))) if (!localEpisode.OtherVideoFiles && !SceneChecker.IsSceneTitle(Path.GetFileNameWithoutExtension(localEpisode.Path)))
{ {
if (downloadClientEpisodeInfo != null && if (downloadClientEpisodeInfo != null &&
!downloadClientEpisodeInfo.FullSeason && !downloadClientEpisodeInfo.FullSeason &&
@ -59,9 +59,9 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
return parsedEpisodeInfo; return parsedEpisodeInfo;
} }
private List<Episode> GetEpisodes(LocalEpisode localEpisode, bool otherFiles) private List<Episode> GetEpisodes(LocalEpisode localEpisode)
{ {
var bestEpisodeInfoForEpisodes = GetBestEpisodeInfo(localEpisode, otherFiles); var bestEpisodeInfoForEpisodes = GetBestEpisodeInfo(localEpisode);
var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path)); var isMediaFile = MediaFileExtensions.Extensions.Contains(Path.GetExtension(localEpisode.Path));
if (bestEpisodeInfoForEpisodes == null) if (bestEpisodeInfoForEpisodes == null)

View File

@ -19,7 +19,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
_logger = logger; _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. // 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 // Non-English languages will be preferred later, in the event there is a conflict

View File

@ -14,7 +14,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
_preferredWordService = preferredWordService; _preferredWordService = preferredWordService;
} }
public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
{ {
var series = localEpisode.Series; var series = localEpisode.Series;
var scores = new List<int>(); var scores = new List<int>();

View File

@ -20,7 +20,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
_logger = logger; _logger = logger;
} }
public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles) public LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem)
{ {
var source = QualitySource.Unknown; var source = QualitySource.Unknown;
var sourceConfidence = Confidence.Default; var sourceConfidence = Confidence.Default;

View File

@ -6,7 +6,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
{ {
public class AggregateReleaseGroup : IAggregateLocalEpisode 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 // Prefer ReleaseGroup from DownloadClient/Folder if they're not a season pack
var releaseGroup = GetReleaseGroup(localEpisode.DownloadClientEpisodeInfo, true); var releaseGroup = GetReleaseGroup(localEpisode.DownloadClientEpisodeInfo, true);

View File

@ -5,6 +5,6 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Aggregation.Aggregators
{ {
public interface IAggregateLocalEpisode public interface IAggregateLocalEpisode
{ {
LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem, bool otherFiles); LocalEpisode Aggregate(LocalEpisode localEpisode, DownloadClientItem downloadClientItem);
} }
} }

View File

@ -82,7 +82,8 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
FolderEpisodeInfo = folderInfo, FolderEpisodeInfo = folderInfo,
Path = file, Path = file,
SceneSource = sceneSource, SceneSource = sceneSource,
ExistingFile = series.Path.IsParentPath(file) ExistingFile = series.Path.IsParentPath(file),
OtherVideoFiles = nonSampleVideoFileCount > 1
}; };
decisions.AddIfNotNull(GetDecision(localEpisode, downloadClientItem, nonSampleVideoFileCount > 1)); decisions.AddIfNotNull(GetDecision(localEpisode, downloadClientItem, nonSampleVideoFileCount > 1));
@ -110,7 +111,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
try try
{ {
_aggregationService.Augment(localEpisode, downloadClientItem, otherFiles); _aggregationService.Augment(localEpisode, downloadClientItem);
if (localEpisode.Episodes.Empty()) if (localEpisode.Episodes.Empty())
{ {

View File

@ -400,7 +400,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Manual
localEpisode.SceneSource = !existingFile; localEpisode.SceneSource = !existingFile;
} }
localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem, false); localEpisode = _aggregationService.Augment(localEpisode, trackedDownload?.DownloadItem);
// Apply the user-chosen values. // Apply the user-chosen values.
localEpisode.Series = series; localEpisode.Series = series;

View File

@ -9,9 +9,10 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport
{ {
public static string GetSceneName(LocalEpisode localEpisode) public static string GetSceneName(LocalEpisode localEpisode)
{ {
var otherVideoFiles = localEpisode.OtherVideoFiles;
var downloadClientInfo = localEpisode.DownloadClientEpisodeInfo; var downloadClientInfo = localEpisode.DownloadClientEpisodeInfo;
if (downloadClientInfo != null && !downloadClientInfo.FullSeason) if (!otherVideoFiles && downloadClientInfo != null && !downloadClientInfo.FullSeason)
{ {
return Parser.Parser.RemoveFileExtension(downloadClientInfo.ReleaseTitle); return Parser.Parser.RemoveFileExtension(downloadClientInfo.ReleaseTitle);
} }

View File

@ -30,6 +30,7 @@ namespace NzbDrone.Core.Parser.Model
public string ReleaseGroup { get; set; } public string ReleaseGroup { get; set; }
public string SceneName { get; set; } public string SceneName { get; set; }
public int PreferredWordScore { get; set; } public int PreferredWordScore { get; set; }
public bool OtherVideoFiles { get; set; }
public int SeasonNumber public int SeasonNumber
{ {