diff --git a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Aggregation/AggregateFilenameInfoFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Aggregation/AggregateFilenameInfoFixture.cs index 1160b474f..ca7762827 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Aggregation/AggregateFilenameInfoFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/Aggregation/AggregateFilenameInfoFixture.cs @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Aggregation.Aggregators "Adele - 19 - 203 - That's It, I Quit, I'm Moving On.mp3" }, @"C:\incoming".AsOsAgnostic()); - Subject.Aggregate(release, true); + Subject.Aggregate(release, null, true); VerifyData(release.LocalTracks[0], "Adele", "Daydreamer", 1, 1); VerifyData(release.LocalTracks[1], "Adele", "Best for Last", 2, 1); @@ -198,7 +198,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Aggregation.Aggregators var files = GivenFilenames(testcase.Item1, testcase.Item2, testcase.Item3); var release = GivenTracks(files, @"C:\incoming".AsOsAgnostic()); - Subject.Aggregate(release, true); + Subject.Aggregate(release, null, true); VerifyDataAuto(release.LocalTracks, testcase.Item1, testcase.Item3); } diff --git a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/ImportDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/ImportDecisionMakerFixture.cs index a2ece8263..668ae89d4 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/TrackImport/ImportDecisionMakerFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/TrackImport/ImportDecisionMakerFixture.cs @@ -151,8 +151,8 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport private void GivenAugmentationSuccess() { Mocker.GetMock() - .Setup(s => s.Augment(It.IsAny(), It.IsAny())) - .Callback((localTrack, otherFiles) => + .Setup(s => s.Augment(It.IsAny(), It.IsAny(), It.IsAny())) + .Callback((localTrack, downloadClientItem, otherFiles) => { localTrack.Tracks = _localTrack.Tracks; }); @@ -323,7 +323,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport GivenSpecifications(_pass1); Mocker.GetMock() - .Setup(c => c.Augment(It.IsAny(), It.IsAny())) + .Setup(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny())) .Throws(); GivenAudioFiles(new[] @@ -336,7 +336,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport var decisions = Subject.GetImportDecisions(_fileInfos, _idOverrides, null, _idConfig); Mocker.GetMock() - .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_fileInfos.Count)); + .Verify(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(_fileInfos.Count)); ExceptionVerification.ExpectedErrors(3); } @@ -363,7 +363,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport var decisions = Subject.GetImportDecisions(_fileInfos, _idOverrides, null, _idConfig); Mocker.GetMock() - .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_fileInfos.Count)); + .Verify(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(_fileInfos.Count)); decisions.Should().HaveCount(3); decisions.First().Rejections.Should().NotBeEmpty(); @@ -384,7 +384,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport var decisions = Subject.GetImportDecisions(_fileInfos, _idOverrides, null, _idConfig); Mocker.GetMock() - .Verify(c => c.Augment(It.IsAny(), It.IsAny()), Times.Exactly(_fileInfos.Count)); + .Verify(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny()), Times.Exactly(_fileInfos.Count)); decisions.Should().HaveCount(3); decisions.First().Rejections.Should().NotBeEmpty(); @@ -394,7 +394,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackImport public void should_return_a_decision_when_exception_is_caught() { Mocker.GetMock() - .Setup(c => c.Augment(It.IsAny(), It.IsAny())) + .Setup(c => c.Augment(It.IsAny(), It.IsAny(), It.IsAny())) .Throws(); GivenAudioFiles(new[] diff --git a/src/NzbDrone.Core/Extras/Lyrics/ExistingLyricImporter.cs b/src/NzbDrone.Core/Extras/Lyrics/ExistingLyricImporter.cs index fae0518b4..ac5d92cdb 100644 --- a/src/NzbDrone.Core/Extras/Lyrics/ExistingLyricImporter.cs +++ b/src/NzbDrone.Core/Extras/Lyrics/ExistingLyricImporter.cs @@ -50,7 +50,7 @@ namespace NzbDrone.Core.Extras.Lyrics try { - _augmentingService.Augment(localTrack, false); + _augmentingService.Augment(localTrack, null, false); } catch (AugmentingFailedException) { diff --git a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs index d0c70d597..8e2cfaa76 100644 --- a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs +++ b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs @@ -85,7 +85,7 @@ namespace NzbDrone.Core.Extras.Metadata try { - _augmentingService.Augment(localTrack, false); + _augmentingService.Augment(localTrack, null, false); } catch (AugmentingFailedException) { diff --git a/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs b/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs index 35d83e570..42ceb0dc4 100644 --- a/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs +++ b/src/NzbDrone.Core/Extras/Others/ExistingOtherExtraImporter.cs @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Extras.Others try { - _augmentingService.Augment(localTrack, false); + _augmentingService.Augment(localTrack, null, false); } catch (AugmentingFailedException) { diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/AggregationService.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/AggregationService.cs index 661db2c28..d70425cbc 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/AggregationService.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/AggregationService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using NLog; using NzbDrone.Common.Disk; +using NzbDrone.Core.Download; using NzbDrone.Core.MediaFiles.EpisodeImport; using NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators; using NzbDrone.Core.Parser.Model; @@ -11,7 +12,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation { public interface IAugmentingService { - LocalTrack Augment(LocalTrack localTrack, bool otherFiles); + LocalTrack Augment(LocalTrack localTrack, DownloadClientItem downloadClientItem, bool otherFiles); LocalAlbumRelease Augment(LocalAlbumRelease localAlbum); } @@ -33,7 +34,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation _logger = logger; } - public LocalTrack Augment(LocalTrack localTrack, bool otherFiles) + public LocalTrack Augment(LocalTrack localTrack, DownloadClientItem downloadClientItem, bool otherFiles) { if (localTrack.DownloadClientAlbumInfo == null && localTrack.FolderAlbumInfo == null && @@ -52,7 +53,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation { try { - augmenter.Aggregate(localTrack, otherFiles); + augmenter.Aggregate(localTrack, downloadClientItem, otherFiles); } catch (Exception ex) { @@ -71,7 +72,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation { try { - augmenter.Aggregate(localAlbum, false); + augmenter.Aggregate(localAlbum, null, false); } catch (Exception ex) { diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateFilenameInfo.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateFilenameInfo.cs index f40b6ec6e..8edccaf23 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateFilenameInfo.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateFilenameInfo.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using NLog; using NzbDrone.Common.Extensions; +using NzbDrone.Core.Download; using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators @@ -55,7 +56,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators _logger = logger; } - public LocalAlbumRelease Aggregate(LocalAlbumRelease release, bool others) + public LocalAlbumRelease Aggregate(LocalAlbumRelease release, DownloadClientItem downloadClientItem, bool others) { var tracks = release.LocalTracks; if (tracks.Any(x => x.FileTrackInfo.Title.IsNullOrWhiteSpace()) diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateQuality.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateQuality.cs index b2ecf8487..06d6e5761 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateQuality.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateQuality.cs @@ -1,10 +1,11 @@ +using NzbDrone.Core.Download; using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators { public class AggregateQuality : IAggregate { - public LocalTrack Aggregate(LocalTrack localTrack, bool otherFiles) + public LocalTrack Aggregate(LocalTrack localTrack, DownloadClientItem downloadClientItem, bool otherFiles) { var quality = localTrack.FileTrackInfo?.Quality; diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateReleaseGroup.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateReleaseGroup.cs index d62fad478..429268b48 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateReleaseGroup.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/AggregateReleaseGroup.cs @@ -1,11 +1,12 @@ using NzbDrone.Common.Extensions; +using NzbDrone.Core.Download; using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators { public class AggregateReleaseGroup : IAggregate { - public LocalTrack Aggregate(LocalTrack localTrack, bool otherFiles) + public LocalTrack Aggregate(LocalTrack localTrack, DownloadClientItem downloadClientItem, bool otherFiles) { var releaseGroup = localTrack.DownloadClientAlbumInfo?.ReleaseGroup; diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/IAggregateLocalTrack.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/IAggregateLocalTrack.cs index c9a219b5a..b1e491452 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/IAggregateLocalTrack.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Aggregation/Aggregators/IAggregateLocalTrack.cs @@ -1,7 +1,9 @@ +using NzbDrone.Core.Download; + namespace NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators { public interface IAggregate { - T Aggregate(T item, bool otherFiles); + T Aggregate(T item, DownloadClientItem downloadClientItem, bool otherFiles); } } diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/Identification/IdentificationService.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/Identification/IdentificationService.cs index 9db887793..bfc0ce4bb 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/Identification/IdentificationService.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/Identification/IdentificationService.cs @@ -185,7 +185,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport.Identification })) .ToList(); - localTracks.ForEach(x => _augmentingService.Augment(x, true)); + localTracks.ForEach(x => _augmentingService.Augment(x, null, true)); return localTracks; } diff --git a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs index 4ad968ea8..d883f7340 100644 --- a/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs +++ b/src/NzbDrone.Core/MediaFiles/TrackImport/ImportDecisionMaker.cs @@ -119,7 +119,7 @@ namespace NzbDrone.Core.MediaFiles.TrackImport try { // TODO fix otherfiles? - _augmentingService.Augment(localTrack, true); + _augmentingService.Augment(localTrack, downloadClientItem, true); localTracks.Add(localTrack); } catch (AugmentingFailedException)