diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/AlreadyImportedSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/AlreadyImportedSpecificationFixture.cs index 5677f785d..96745b7c9 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/AlreadyImportedSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/AlreadyImportedSpecificationFixture.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private Author _artist; private QualityModel _mp3; private QualityModel _flac; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; private List _history; private BookFile _firstFile; @@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _mp3 = new QualityModel(Quality.MP3_320, new Revision(version: 1)); _flac = new QualityModel(Quality.FLAC, new Revision(version: 1)); - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Author = _artist, ParsedBookInfo = new ParsedBookInfo { Quality = _mp3 }, @@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenCdhDisabled(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -107,13 +107,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(c => c.GetFilesByBook(It.IsAny())) .Returns(new List { }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_be_accepted_if_album_does_not_have_grabbed_event() { - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -121,7 +121,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenHistoryItem(Guid.NewGuid().ToString().ToUpper(), TITLE, _mp3, HistoryEventType.Grabbed); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -132,7 +132,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenHistoryItem(downloadId, TITLE, _mp3, HistoryEventType.Grabbed); GivenHistoryItem(downloadId, TITLE, _mp3, HistoryEventType.DownloadImported); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -143,12 +143,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenHistoryItem(downloadId, TITLE, _mp3, HistoryEventType.Grabbed); GivenHistoryItem(downloadId, TITLE, _flac, HistoryEventType.DownloadImported); - _remoteAlbum.Release = Builder.CreateNew() + _remoteBook.Release = Builder.CreateNew() .With(t => t.DownloadProtocol = DownloadProtocol.Torrent) .With(t => t.InfoHash = downloadId) .Build(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -159,12 +159,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenHistoryItem(downloadId, TITLE, _mp3, HistoryEventType.Grabbed); GivenHistoryItem(downloadId, TITLE, _flac, HistoryEventType.DownloadImported); - _remoteAlbum.Release = Builder.CreateNew() + _remoteBook.Release = Builder.CreateNew() .With(t => t.DownloadProtocol = DownloadProtocol.Torrent) .With(t => t.InfoHash = null) .Build(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -173,12 +173,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenHistoryItem(null, TITLE, _mp3, HistoryEventType.Grabbed); GivenHistoryItem(null, TITLE, _flac, HistoryEventType.DownloadImported); - _remoteAlbum.Release = Builder.CreateNew() + _remoteBook.Release = Builder.CreateNew() .With(t => t.DownloadProtocol = DownloadProtocol.Torrent) .With(t => t.InfoHash = null) .Build(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -189,12 +189,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenHistoryItem(downloadId, TITLE, _mp3, HistoryEventType.Grabbed); GivenHistoryItem(downloadId, TITLE, _flac, HistoryEventType.DownloadImported); - _remoteAlbum.Release = Builder.CreateNew() + _remoteBook.Release = Builder.CreateNew() .With(t => t.DownloadProtocol = DownloadProtocol.Torrent) .With(t => t.InfoHash = downloadId) .Build(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/BlockedIndexerSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/BlockedIndexerSpecificationFixture.cs index 15b9c6b05..b1c2d1e7b 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/BlockedIndexerSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/BlockedIndexerSpecificationFixture.cs @@ -14,12 +14,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class BlockedIndexerSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Release = new ReleaseInfo { IndexerId = 1 } }; @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_true_if_no_blocked_indexer() { - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { WithBlockedIndexer(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); Subject.Type.Should().Be(RejectionType.Temporary); } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/DiscographySpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/DiscographySpecificationFixture.cs index c2adf4eb5..8aece977d 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/DiscographySpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/DiscographySpecificationFixture.cs @@ -15,13 +15,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestFixture] public class DiscographySpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { var artist = Builder.CreateNew().With(s => s.Id = 1234).Build(); - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { ParsedBookInfo = new ParsedBookInfo { @@ -46,29 +46,29 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_true_if_is_not_a_discography() { - _remoteAlbum.ParsedBookInfo.Discography = false; - _remoteAlbum.Books.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + _remoteBook.ParsedBookInfo.Discography = false; + _remoteBook.Books.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_if_all_albums_have_released() { - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_false_if_one_album_has_not_released() { - _remoteAlbum.Books.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + _remoteBook.Books.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_return_false_if_an_album_does_not_have_an_release_date() { - _remoteAlbum.Books.Last().ReleaseDate = null; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + _remoteBook.Books.Last().ReleaseDate = null; + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs index b6821d732..85e8f66f2 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/DownloadDecisionMakerFixture.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class DownloadDecisionMakerFixture : CoreTest { private List _reports; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; private Mock _pass1; private Mock _pass2; @@ -57,7 +57,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _failDelayed1.SetupGet(c => c.Priority).Returns(SpecificationPriority.Disk); _reports = new List { new ReleaseInfo { Title = "Coldplay-A Head Full Of Dreams-CD-FLAC-2015-PERFECT" } }; - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Author = new Author(), Books = new List { new Book() } @@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests Mocker.GetMock() .Setup(c => c.Map(It.IsAny(), It.IsAny())) - .Returns(_remoteAlbum); + .Returns(_remoteBook); } private void GivenSpecifications(params Mock[] mocks) @@ -80,12 +80,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests Subject.GetRssDecision(_reports).ToList(); - _fail1.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); - _fail2.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); - _fail3.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); - _pass1.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); - _pass2.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); - _pass3.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); + _fail1.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); + _fail2.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); + _fail3.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); + _pass1.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); + _pass2.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); + _pass3.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); } [Test] @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenSpecifications(_pass1, _failDelayed1); Subject.GetRssDecision(_reports).ToList(); - _failDelayed1.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Once()); + _failDelayed1.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Once()); } [Test] @@ -104,7 +104,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests Subject.GetRssDecision(_reports).ToList(); - _failDelayed1.Verify(c => c.IsSatisfiedBy(_remoteAlbum, null), Times.Never()); + _failDelayed1.Verify(c => c.IsSatisfiedBy(_remoteBook, null), Times.Never()); } [Test] @@ -185,7 +185,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenSpecifications(_pass1, _pass2, _pass3); - _remoteAlbum.Author = null; + _remoteBook.Author = null; Subject.GetRssDecision(_reports); @@ -221,7 +221,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenSpecifications(_pass1, _pass2, _pass3); - _remoteAlbum.Author = null; + _remoteBook.Author = null; var result = Subject.GetRssDecision(_reports); @@ -260,7 +260,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests Mocker.SetConstant>(new List { - Mocker.Resolve() + Mocker.Resolve() }); var decisions = Subject.GetSearchDecision(reports, criteria); @@ -275,7 +275,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenSpecifications(_pass1, _pass2, _pass3); - _remoteAlbum.Author = null; + _remoteBook.Author = null; var result = Subject.GetRssDecision(_reports); @@ -289,7 +289,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenSpecifications(_pass1, _pass2, _pass3); - _remoteAlbum.Books = new List(); + _remoteBook.Books = new List(); var result = Subject.GetRssDecision(_reports); diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/EarlyReleaseSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/EarlyReleaseSpecificationFixture.cs index a76095fea..0fe0ec230 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/EarlyReleaseSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/EarlyReleaseSpecificationFixture.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private Author _artist; private Book _album1; private Book _album2; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; private IndexerDefinition _indexerDefinition; [SetUp] @@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _album1 = Builder.CreateNew().With(s => s.ReleaseDate = DateTime.Today).Build(); _album2 = Builder.CreateNew().With(s => s.ReleaseDate = DateTime.Today).Build(); - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Author = _artist, Books = new List { _album1 }, @@ -54,23 +54,23 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void GivenPublishDateFromToday(int days) { - _remoteAlbum.Release.PublishDate = DateTime.Today.AddDays(days); + _remoteBook.Release.PublishDate = DateTime.Today.AddDays(days); } [Test] public void should_return_true_if_indexer_not_specified() { - _remoteAlbum.Release.IndexerId = 0; + _remoteBook.Release.IndexerId = 0; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_if_release_contains_multiple_albums() { - _remoteAlbum.Books.Add(_album2); + _remoteBook.Books.Add(_album2); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(v => v.Get(It.IsAny())) .Callback(i => { throw new ModelNotFoundException(typeof(IndexerDefinition), i); }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [TestCase(-2)] @@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenPublishDateFromToday(days); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [TestCase(-10)] @@ -98,7 +98,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenPublishDateFromToday(days); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [TestCase(-10)] @@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _indexerDefinition.Settings = new TorrentRssIndexerSettings { EarlyReleaseLimit = null }; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/MaximumSizeSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/MaximumSizeSpecificationFixture.cs index ac0822d21..f2d8bb3c1 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/MaximumSizeSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/MaximumSizeSpecificationFixture.cs @@ -9,12 +9,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { public class MaximumSizeSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook() { Release = new ReleaseInfo() }; + _remoteBook = new RemoteBook() { Release = new ReleaseInfo() }; } private void WithMaximumSize(int size) @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void WithSize(int size) { - _remoteAlbum.Release.Size = size * 1024 * 1024; + _remoteBook.Release.Size = size * 1024 * 1024; } [Test] @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMaximumSize(0); WithSize(1000); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMaximumSize(2000); WithSize(1999); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMaximumSize(2000); WithSize(2000); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -60,7 +60,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMaximumSize(2000); WithSize(2001); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMaximumSize(2000); WithSize(0); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/MinimumAgeSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/MinimumAgeSpecificationFixture.cs index 12c65f5f4..6995af22d 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/MinimumAgeSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/MinimumAgeSpecificationFixture.cs @@ -13,12 +13,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class MinimumAgeSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Release = new ReleaseInfo() { DownloadProtocol = DownloadProtocol.Usenet } }; @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void WithAge(int minutes) { - _remoteAlbum.Release.PublishDate = DateTime.UtcNow.AddMinutes(-minutes); + _remoteBook.Release.PublishDate = DateTime.UtcNow.AddMinutes(-minutes); } [Test] @@ -40,7 +40,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMinimumAge(0); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMinimumAge(30); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithMinimumAge(30); WithAge(10); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/MonitoredAlbumSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/MonitoredAlbumSpecificationFixture.cs index 1b1f443f0..9d75b505c 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/MonitoredAlbumSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/MonitoredAlbumSpecificationFixture.cs @@ -12,9 +12,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - public class MonitoredAlbumSpecificationFixture : CoreTest + public class MonitoredAlbumSpecificationFixture : CoreTest { - private MonitoredAlbumSpecification _monitoredAlbumSpecification; + private MonitoredBookSpecification _monitoredAlbumSpecification; private RemoteBook _parseResultMulti; private RemoteBook _parseResultSingle; @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [SetUp] public void Setup() { - _monitoredAlbumSpecification = Mocker.Resolve(); + _monitoredAlbumSpecification = Mocker.Resolve(); _fakeArtist = Builder.CreateNew() .With(c => c.Monitored = true) diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs index 2259506dd..f11bcd070 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/PrioritizeDownloadDecisionFixture.cs @@ -36,27 +36,27 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private RemoteBook GivenRemoteAlbum(List albums, QualityModel quality, int age = 0, long size = 0, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet) { - var remoteAlbum = new RemoteBook(); - remoteAlbum.ParsedBookInfo = new ParsedBookInfo(); - remoteAlbum.ParsedBookInfo.Quality = quality; + var remoteBook = new RemoteBook(); + remoteBook.ParsedBookInfo = new ParsedBookInfo(); + remoteBook.ParsedBookInfo.Quality = quality; - remoteAlbum.Books = new List(); - remoteAlbum.Books.AddRange(albums); + remoteBook.Books = new List(); + remoteBook.Books.AddRange(albums); - remoteAlbum.Release = new ReleaseInfo(); - remoteAlbum.Release.PublishDate = DateTime.Now.AddDays(-age); - remoteAlbum.Release.Size = size; - remoteAlbum.Release.DownloadProtocol = downloadProtocol; + remoteBook.Release = new ReleaseInfo(); + remoteBook.Release.PublishDate = DateTime.Now.AddDays(-age); + remoteBook.Release.Size = size; + remoteBook.Release.DownloadProtocol = downloadProtocol; - remoteAlbum.Author = Builder.CreateNew() + remoteBook.Author = Builder.CreateNew() .With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() }).Build(); - remoteAlbum.DownloadAllowed = true; + remoteBook.DownloadAllowed = true; - return remoteAlbum; + return remoteBook; } private void GivenPreferredDownloadProtocol(DownloadProtocol downloadProtocol) @@ -72,12 +72,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_put_propers_before_non_propers() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1))); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 2))); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1))); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 2))); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(2); @@ -86,12 +86,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_put_higher_quality_before_lower() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3_320); @@ -100,46 +100,46 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_order_by_age_then_largest_rounded_to_200mb() { - var remoteAlbumSd = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 100.Megabytes(), age: 1); - var remoteAlbumHdSmallOld = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 1200.Megabytes(), age: 1000); - var remoteAlbumSmallYoung = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 1250.Megabytes(), age: 10); - var remoteAlbumHdLargeYoung = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 3000.Megabytes(), age: 1); + var remoteBookSd = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 100.Megabytes(), age: 1); + var remoteBookHdSmallOld = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 1200.Megabytes(), age: 1000); + var remoteBookSmallYoung = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 1250.Megabytes(), age: 10); + var remoteBookHdLargeYoung = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 3000.Megabytes(), age: 1); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbumSd)); - decisions.Add(new DownloadDecision(remoteAlbumHdSmallOld)); - decisions.Add(new DownloadDecision(remoteAlbumSmallYoung)); - decisions.Add(new DownloadDecision(remoteAlbumHdLargeYoung)); + decisions.Add(new DownloadDecision(remoteBookSd)); + decisions.Add(new DownloadDecision(remoteBookHdSmallOld)); + decisions.Add(new DownloadDecision(remoteBookSmallYoung)); + decisions.Add(new DownloadDecision(remoteBookHdLargeYoung)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); - qualifiedReports.First().RemoteBook.Should().Be(remoteAlbumHdLargeYoung); + qualifiedReports.First().RemoteBook.Should().Be(remoteBookHdLargeYoung); } [Test] public void should_order_by_youngest() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), age: 10); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), age: 5); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), age: 10); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), age: 5); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); - qualifiedReports.First().RemoteBook.Should().Be(remoteAlbum2); + qualifiedReports.First().RemoteBook.Should().Be(remoteBook2); } [Test] public void should_not_throw_if_no_albums_are_found() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes()); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes()); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes()); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes()); - remoteAlbum1.Books = new List(); + remoteBook1.Books = new List(); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); Subject.PrioritizeDecisions(decisions); } @@ -149,12 +149,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenPreferredDownloadProtocol(DownloadProtocol.Usenet); - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Torrent); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Usenet); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Torrent); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Usenet); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.Release.DownloadProtocol.Should().Be(DownloadProtocol.Usenet); @@ -165,12 +165,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenPreferredDownloadProtocol(DownloadProtocol.Torrent); - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Torrent); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Usenet); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Torrent); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Usenet); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.Release.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); @@ -179,14 +179,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_discography_pack_above_single_album() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.FLAC)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.FLAC)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); - remoteAlbum1.ParsedBookInfo.Discography = true; + remoteBook1.ParsedBookInfo.Discography = true; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Discography.Should().BeTrue(); @@ -195,14 +195,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_quality_over_discography_pack() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); - remoteAlbum1.ParsedBookInfo.Discography = true; + remoteBook1.ParsedBookInfo.Discography = true; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Discography.Should().BeFalse(); @@ -211,22 +211,22 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_single_album_over_multi_album() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); - qualifiedReports.First().RemoteBook.Books.Count.Should().Be(remoteAlbum2.Books.Count); + qualifiedReports.First().RemoteBook.Books.Count.Should().Be(remoteBook2.Books.Count); } [Test] public void should_prefer_releases_with_more_seeders() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var torrentInfo1 = new TorrentInfo(); torrentInfo1.PublishDate = DateTime.Now; @@ -237,12 +237,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests var torrentInfo2 = torrentInfo1.JsonClone(); torrentInfo2.Seeders = 100; - remoteAlbum1.Release = torrentInfo1; - remoteAlbum2.Release = torrentInfo2; + remoteBook1.Release = torrentInfo1; + remoteBook2.Release = torrentInfo2; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); ((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Seeders.Should().Be(torrentInfo2.Seeders); @@ -251,8 +251,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var torrentInfo1 = new TorrentInfo(); torrentInfo1.PublishDate = DateTime.Now; @@ -264,12 +264,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests var torrentInfo2 = torrentInfo1.JsonClone(); torrentInfo2.Peers = 100; - remoteAlbum1.Release = torrentInfo1; - remoteAlbum2.Release = torrentInfo2; + remoteBook1.Release = torrentInfo1; + remoteBook2.Release = torrentInfo2; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); ((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Peers.Should().Be(torrentInfo2.Peers); @@ -278,8 +278,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_releases_with_more_peers_no_seeds() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var torrentInfo1 = new TorrentInfo(); torrentInfo1.PublishDate = DateTime.Now; @@ -292,12 +292,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests torrentInfo2.Seeders = 0; torrentInfo2.Peers = 100; - remoteAlbum1.Release = torrentInfo1; - remoteAlbum2.Release = torrentInfo2; + remoteBook1.Release = torrentInfo1; + remoteBook2.Release = torrentInfo2; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); ((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Peers.Should().Be(torrentInfo2.Peers); @@ -306,8 +306,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_first_release_if_peers_and_size_are_too_similar() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var torrentInfo1 = new TorrentInfo(); torrentInfo1.PublishDate = DateTime.Now; @@ -321,12 +321,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests torrentInfo2.Peers = 10; torrentInfo1.Size = 250.Megabytes(); - remoteAlbum1.Release = torrentInfo1; - remoteAlbum2.Release = torrentInfo2; + remoteBook1.Release = torrentInfo1; + remoteBook2.Release = torrentInfo2; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); ((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Should().Be(torrentInfo1); @@ -335,28 +335,28 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_first_release_if_age_and_size_are_too_similar() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - remoteAlbum1.Release.PublishDate = DateTime.UtcNow.AddDays(-100); - remoteAlbum1.Release.Size = 200.Megabytes(); + remoteBook1.Release.PublishDate = DateTime.UtcNow.AddDays(-100); + remoteBook1.Release.Size = 200.Megabytes(); - remoteAlbum2.Release.PublishDate = DateTime.UtcNow.AddDays(-150); - remoteAlbum2.Release.Size = 250.Megabytes(); + remoteBook2.Release.PublishDate = DateTime.UtcNow.AddDays(-150); + remoteBook2.Release.Size = 250.Megabytes(); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); - qualifiedReports.First().RemoteBook.Release.Should().Be(remoteAlbum1.Release); + qualifiedReports.First().RemoteBook.Release.Should().Be(remoteBook1.Release); } [Test] public void should_prefer_quality_over_the_number_of_peers() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.AZW3)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.AZW3)); var torrentInfo1 = new TorrentInfo(); torrentInfo1.PublishDate = DateTime.Now; @@ -370,12 +370,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests torrentInfo2.Peers = 10; torrentInfo1.Size = 250.Megabytes(); - remoteAlbum1.Release = torrentInfo1; - remoteAlbum2.Release = torrentInfo2; + remoteBook1.Release = torrentInfo1; + remoteBook2.Release = torrentInfo2; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); ((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Should().Be(torrentInfo1); @@ -384,12 +384,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_put_higher_quality_before_lower_always() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3_320); @@ -398,15 +398,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_prefer_higher_score_over_lower_score() { - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC)); - remoteAlbum1.PreferredWordScore = 10; - remoteAlbum2.PreferredWordScore = 0; + remoteBook1.PreferredWordScore = 10; + remoteBook2.PreferredWordScore = 0; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.PreferredWordScore.Should().Be(10); @@ -419,15 +419,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(s => s.DownloadPropersAndRepacks) .Returns(ProperDownloadTypes.PreferAndUpgrade); - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1))); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2))); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1))); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2))); - remoteAlbum1.PreferredWordScore = 10; - remoteAlbum2.PreferredWordScore = 0; + remoteBook1.PreferredWordScore = 10; + remoteBook2.PreferredWordScore = 0; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(2); @@ -440,15 +440,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(s => s.DownloadPropersAndRepacks) .Returns(ProperDownloadTypes.DoNotUpgrade); - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1))); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2))); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1))); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2))); - remoteAlbum1.PreferredWordScore = 10; - remoteAlbum2.PreferredWordScore = 0; + remoteBook1.PreferredWordScore = 10; + remoteBook2.PreferredWordScore = 0; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(2); @@ -461,15 +461,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(s => s.DownloadPropersAndRepacks) .Returns(ProperDownloadTypes.DoNotPrefer); - var remoteAlbum1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1))); - var remoteAlbum2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2))); + var remoteBook1 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(1))); + var remoteBook2 = GivenRemoteAlbum(new List { GivenAlbum(1) }, new QualityModel(Quality.FLAC, new Revision(2))); - remoteAlbum1.PreferredWordScore = 10; - remoteAlbum2.PreferredWordScore = 0; + remoteBook1.PreferredWordScore = 10; + remoteBook2.PreferredWordScore = 0; var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); var qualifiedReports = Subject.PrioritizeDecisions(decisions); qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.FLAC); diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/ProtocolSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/ProtocolSpecificationFixture.cs index 02d678597..8239ee02d 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/ProtocolSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/ProtocolSpecificationFixture.cs @@ -14,15 +14,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestFixture] public class ProtocolSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; private DelayProfile _delayProfile; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook(); - _remoteAlbum.Release = new ReleaseInfo(); - _remoteAlbum.Author = new Author(); + _remoteBook = new RemoteBook(); + _remoteBook.Release = new ReleaseInfo(); + _remoteBook.Author = new Author(); _delayProfile = new DelayProfile(); @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void GivenProtocol(DownloadProtocol downloadProtocol) { - _remoteAlbum.Release.DownloadProtocol = downloadProtocol; + _remoteBook.Release.DownloadProtocol = downloadProtocol; } [Test] @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenProtocol(DownloadProtocol.Usenet); _delayProfile.EnableUsenet = true; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().Be(true); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().Be(true); } [Test] @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenProtocol(DownloadProtocol.Torrent); _delayProfile.EnableTorrent = true; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().Be(true); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().Be(true); } [Test] @@ -60,7 +60,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenProtocol(DownloadProtocol.Usenet); _delayProfile.EnableUsenet = false; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().Be(false); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().Be(false); } [Test] @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests GivenProtocol(DownloadProtocol.Torrent); _delayProfile.EnableTorrent = false; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().Be(false); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().Be(false); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs index 7a50652da..685afd196 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class QualityAllowedByProfileSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; public static object[] AllowedTestCases = { @@ -36,7 +36,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id }) .Build(); - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Author = fakeArtist, ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) }, @@ -47,20 +47,20 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestCaseSource(nameof(AllowedTestCases))] public void should_allow_if_quality_is_defined_in_profile(Quality qualityType) { - _remoteAlbum.ParsedBookInfo.Quality.Quality = qualityType; - _remoteAlbum.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320); + _remoteBook.ParsedBookInfo.Quality.Quality = qualityType; + _remoteBook.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] [TestCaseSource(nameof(DeniedTestCases))] public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType) { - _remoteAlbum.ParsedBookInfo.Quality.Quality = qualityType; - _remoteAlbum.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320); + _remoteBook.ParsedBookInfo.Quality.Quality = qualityType; + _remoteBook.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs index f0b970d8f..214b90778 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/QueueSpecificationFixture.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { private Author _artist; private Book _album; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; private Author _otherArtist; private Book _otherAlbum; @@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _releaseInfo = Builder.CreateNew() .Build(); - _remoteAlbum = Builder.CreateNew() + _remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320) }) @@ -70,11 +70,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Returns(new List()); } - private void GivenQueue(IEnumerable remoteAlbums, TrackedDownloadState trackedDownloadState = TrackedDownloadState.Downloading) + private void GivenQueue(IEnumerable remoteBooks, TrackedDownloadState trackedDownloadState = TrackedDownloadState.Downloading) { - var queue = remoteAlbums.Select(remoteAlbum => new Queue.Queue + var queue = remoteBooks.Select(remoteBook => new Queue.Queue { - RemoteBook = remoteAlbum, + RemoteBook = remoteBook, TrackedDownloadState = trackedDownloadState }); @@ -87,20 +87,20 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public void should_return_true_when_queue_is_empty() { GivenEmptyQueue(); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_when_artist_doesnt_match() { - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _otherArtist) .With(r => r.Books = new List { _album }) .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -108,7 +108,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { _artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id; - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -118,9 +118,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); + GivenQueue(new List { remoteBook }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { _artist.QualityProfile.Value.Cutoff = Quality.MP3_320.Id; - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -138,14 +138,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_when_album_doesnt_match() { - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _otherAlbum }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -155,16 +155,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_when_qualities_are_the_same_with_higher_preferred_word_score() { - _remoteAlbum.PreferredWordScore = 1; + _remoteBook.PreferredWordScore = 1; - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -174,14 +174,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_false_when_qualities_are_the_same() { - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -191,8 +191,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -200,7 +200,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { _artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id; - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -210,14 +210,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_return_false_if_matching_multi_album_is_in_queue() { - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album, _otherAlbum }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -227,14 +227,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_return_false_if_multi_album_has_one_album_in_queue() { - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -244,16 +244,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - _remoteAlbum.Books.Add(_otherAlbum); + _remoteBook.Books.Add(_otherAlbum); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_return_false_if_multi_part_album_is_already_in_queue() { - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album, _otherAlbum }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -263,16 +263,16 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - _remoteAlbum.Books.Add(_otherAlbum); + _remoteBook.Books.Add(_otherAlbum); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_return_false_if_multi_part_album_has_two_albums_in_queue() { - var remoteAlbums = Builder.CreateListOfSize(2) + var remoteBooks = Builder.CreateListOfSize(2) .All() .With(r => r.Author = _artist) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -286,9 +286,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Books = new List { _otherAlbum }) .Build(); - _remoteAlbum.Books.Add(_otherAlbum); - GivenQueue(remoteAlbums); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + _remoteBook.Books.Add(_otherAlbum); + GivenQueue(remoteBooks); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -297,7 +297,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id; _artist.QualityProfile.Value.UpgradeAllowed = false; - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -307,8 +307,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + GivenQueue(new List { remoteBook }); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -316,7 +316,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { _artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id; - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = _artist) .With(r => r.Books = new List { _album }) .With(r => r.ParsedBookInfo = new ParsedBookInfo @@ -326,9 +326,9 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .With(r => r.Release = _releaseInfo) .Build(); - GivenQueue(new List { remoteAlbum }, TrackedDownloadState.DownloadFailedPending); + GivenQueue(new List { remoteBook }, TrackedDownloadState.DownloadFailedPending); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs index 222c66c2a..7e58135ef 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RawDiskSpecificationFixture.cs @@ -11,12 +11,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class RawDiskSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Release = new ReleaseInfo() { DownloadProtocol = DownloadProtocol.Torrent } }; @@ -24,41 +24,41 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void WithContainer(string container) { - _remoteAlbum.Release.Container = container; + _remoteBook.Release.Container = container; } [Test] public void should_return_true_if_no_container_specified() { - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_if_flac() { WithContainer("FLAC"); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_false_if_vob() { WithContainer("VOB"); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_return_false_if_iso() { WithContainer("ISO"); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_compare_case_insensitive() { WithContainer("vob"); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/ReleaseRestrictionsSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/ReleaseRestrictionsSpecificationFixture.cs index 910c4ebcb..46795c533 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/ReleaseRestrictionsSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/ReleaseRestrictionsSpecificationFixture.cs @@ -13,12 +13,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestFixture] public class ReleaseRestrictionsSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Author = new Author { @@ -54,7 +54,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(s => s.AllForTags(It.IsAny>())) .Returns(new List()); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions("WEBRip", null); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions("doesnt,exist", null); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions(null, "ignored"); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions(null, "edited"); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [TestCase("EdiTED")] @@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions(required, null); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [TestCase("EdiTED")] @@ -108,13 +108,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions(null, ignored); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_be_false_when_release_contains_one_restricted_word_and_one_required_word() { - _remoteAlbum.Release.Title = "[ www.Speed.cd ] - Katy Perry - Witness (2017) MP3 [320 kbps] "; + _remoteBook.Release.Title = "[ www.Speed.cd ] - Katy Perry - Witness (2017) MP3 [320 kbps] "; Mocker.GetMock() .Setup(s => s.AllForTags(It.IsAny>())) @@ -123,7 +123,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests new ReleaseProfile { Required = "320", Ignored = "www.Speed.cd" } }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [TestCase("/WEB/", true)] @@ -134,7 +134,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { GivenRestictions(pattern, null); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().Be(expected); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().Be(expected); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs index a7af0a934..a584a4263 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RepackSpecificationFixture.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestFixture] public class RepackSpecificationFixture : CoreTest { - private ParsedBookInfo _parsedAlbumInfo; + private ParsedBookInfo _parsedBookInfo; private List _albums; private List _trackFiles; @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests { Mocker.Resolve(); - _parsedAlbumInfo = Builder.CreateNew() + _parsedBookInfo = Builder.CreateNew() .With(p => p.Quality = new QualityModel(Quality.FLAC, new Revision(2, 0, false))) .With(p => p.ReleaseGroup = "Readarr") @@ -48,12 +48,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_true_if_it_is_not_a_repack() { - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeTrue(); @@ -66,14 +66,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests .Setup(c => c.GetFilesByBook(It.IsAny())) .Returns(new List()); - _parsedAlbumInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.Quality.Revision.IsRepack = true; - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeTrue(); @@ -82,7 +82,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_true_if_is_a_repack_for_a_different_quality() { - _parsedAlbumInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.Quality.Revision.IsRepack = true; _trackFiles.Select(c => { @@ -95,12 +95,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests return c; }).ToList(); - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeTrue(); @@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_true_if_is_a_repack_for_all_existing_files() { - _parsedAlbumInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.Quality.Revision.IsRepack = true; _trackFiles.Select(c => { @@ -122,12 +122,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests return c; }).ToList(); - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeTrue(); @@ -136,7 +136,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_false_if_is_a_repack_for_some_but_not_all_trackfiles() { - _parsedAlbumInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.Quality.Revision.IsRepack = true; _trackFiles.Select(c => { @@ -151,12 +151,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests _trackFiles.First().ReleaseGroup = "NotReadarr"; - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeFalse(); @@ -165,7 +165,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_false_if_is_a_repack_for_different_group() { - _parsedAlbumInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.Quality.Revision.IsRepack = true; _trackFiles.Select(c => { @@ -178,12 +178,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests return c; }).ToList(); - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeFalse(); @@ -192,7 +192,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_false_if_release_group_for_existing_file_is_unknown() { - _parsedAlbumInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.Quality.Revision.IsRepack = true; _trackFiles.Select(c => { @@ -205,12 +205,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests return c; }).ToList(); - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeFalse(); @@ -219,8 +219,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [Test] public void should_return_false_if_release_group_for_release_is_unknown() { - _parsedAlbumInfo.Quality.Revision.IsRepack = true; - _parsedAlbumInfo.ReleaseGroup = null; + _parsedBookInfo.Quality.Revision.IsRepack = true; + _parsedBookInfo.ReleaseGroup = null; _trackFiles.Select(c => { @@ -234,12 +234,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests return c; }).ToList(); - var remoteAlbum = Builder.CreateNew() - .With(e => e.ParsedBookInfo = _parsedAlbumInfo) + var remoteBook = Builder.CreateNew() + .With(e => e.ParsedBookInfo = _parsedBookInfo) .With(e => e.Books = _albums) .Build(); - Subject.IsSatisfiedBy(remoteAlbum, null) + Subject.IsSatisfiedBy(remoteBook, null) .Accepted .Should() .BeFalse(); diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs index 4c577b79e..d1ae409d9 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs @@ -13,12 +13,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests public class RetentionSpecificationFixture : CoreTest { - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() { - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Release = new ReleaseInfo() { DownloadProtocol = DownloadProtocol.Usenet } }; @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests private void WithAge(int days) { - _remoteAlbum.Release.PublishDate = DateTime.UtcNow.AddDays(-days); + _remoteBook.Release.PublishDate = DateTime.UtcNow.AddDays(-days); } [Test] @@ -40,7 +40,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithRetention(0); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithRetention(1000); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -58,7 +58,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithRetention(100); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithRetention(10); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] @@ -76,18 +76,18 @@ namespace NzbDrone.Core.Test.DecisionEngineTests WithRetention(0); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_when_release_is_not_usenet() { - _remoteAlbum.Release.DownloadProtocol = DownloadProtocol.Torrent; + _remoteBook.Release.DownloadProtocol = DownloadProtocol.Torrent; WithRetention(10); WithAge(100); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs index 1f37fe3e9..5e7e9b8a4 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync { private QualityProfile _profile; private DelayProfile _delayProfile; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync .With(s => s.QualityProfile = _profile) .Build(); - _remoteAlbum = Builder.CreateNew() + _remoteBook = Builder.CreateNew() .With(r => r.Author = artist) .Build(); @@ -52,11 +52,11 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync _profile.Cutoff = Quality.AZW3.Id; - _remoteAlbum.ParsedBookInfo = new ParsedBookInfo(); - _remoteAlbum.Release = new ReleaseInfo(); - _remoteAlbum.Release.DownloadProtocol = DownloadProtocol.Usenet; + _remoteBook.ParsedBookInfo = new ParsedBookInfo(); + _remoteBook.Release = new ReleaseInfo(); + _remoteBook.Release.DownloadProtocol = DownloadProtocol.Usenet; - _remoteAlbum.Books = Builder.CreateListOfSize(1).Build().ToList(); + _remoteBook.Books = Builder.CreateListOfSize(1).Build().ToList(); Mocker.GetMock() .Setup(s => s.GetFilesByBook(It.IsAny())) @@ -100,12 +100,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync [Test] public void should_be_false_when_system_invoked_search_and_release_is_younger_than_delay() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI); - _remoteAlbum.Release.PublishDate = DateTime.UtcNow; + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI); + _remoteBook.Release.PublishDate = DateTime.UtcNow; _delayProfile.UsenetDelay = 720; - Subject.IsSatisfiedBy(_remoteAlbum, new BookSearchCriteria()).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, new BookSearchCriteria()).Accepted.Should().BeFalse(); } [Test] @@ -113,44 +113,44 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync { _delayProfile.UsenetDelay = 0; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_be_true_when_quality_is_last_allowed_in_profile() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320); + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_be_true_when_release_is_older_than_delay() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI); - _remoteAlbum.Release.PublishDate = DateTime.UtcNow.AddHours(-10); + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI); + _remoteBook.Release.PublishDate = DateTime.UtcNow.AddHours(-10); _delayProfile.UsenetDelay = 60; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_be_false_when_release_is_younger_than_delay() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI); - _remoteAlbum.Release.PublishDate = DateTime.UtcNow; + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI); + _remoteBook.Release.PublishDate = DateTime.UtcNow; _delayProfile.UsenetDelay = 720; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } [Test] public void should_be_true_when_release_is_a_proper_for_existing_album() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)); - _remoteAlbum.Release.PublishDate = DateTime.UtcNow; + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)); + _remoteBook.Release.PublishDate = DateTime.UtcNow; GivenExistingFile(new QualityModel(Quality.MP3_320)); GivenUpgradeForExistingFile(); @@ -161,14 +161,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync _delayProfile.UsenetDelay = 720; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_be_true_when_release_is_a_real_for_existing_album() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(real: 1)); - _remoteAlbum.Release.PublishDate = DateTime.UtcNow; + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(real: 1)); + _remoteBook.Release.PublishDate = DateTime.UtcNow; GivenExistingFile(new QualityModel(Quality.MP3_320)); GivenUpgradeForExistingFile(); @@ -179,20 +179,20 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync _delayProfile.UsenetDelay = 720; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_be_false_when_release_is_proper_for_existing_album_of_different_quality() { - _remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.AZW3, new Revision(version: 2)); - _remoteAlbum.Release.PublishDate = DateTime.UtcNow; + _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.AZW3, new Revision(version: 2)); + _remoteBook.Release.PublishDate = DateTime.UtcNow; GivenExistingFile(new QualityModel(Quality.PDF)); _delayProfile.UsenetDelay = 720; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/Search/ArtistSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/Search/ArtistSpecificationFixture.cs index 43daed76f..78fa1b687 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/Search/ArtistSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/Search/ArtistSpecificationFixture.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { private Author _artist1; private Author _artist2; - private RemoteBook _remoteAlbum = new RemoteBook(); + private RemoteBook _remoteBook = new RemoteBook(); private SearchCriteriaBase _searchCriteria = new BookSearchCriteria(); [SetUp] @@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search _artist1 = Builder.CreateNew().With(s => s.Id = 1).Build(); _artist2 = Builder.CreateNew().With(s => s.Id = 2).Build(); - _remoteAlbum.Author = _artist1; + _remoteBook.Author = _artist1; } [Test] @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { _searchCriteria.Author = _artist2; - Subject.IsSatisfiedBy(_remoteAlbum, _searchCriteria).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, _searchCriteria).Accepted.Should().BeFalse(); } [Test] @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { _searchCriteria.Author = _artist1; - Subject.IsSatisfiedBy(_remoteAlbum, _searchCriteria).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, _searchCriteria).Accepted.Should().BeTrue(); } } } diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/Search/TorrentSeedingSpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/Search/TorrentSeedingSpecificationFixture.cs index d8576d114..c40287572 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/Search/TorrentSeedingSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/Search/TorrentSeedingSpecificationFixture.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search public class TorrentSeedingSpecificationFixture : TestBase { private Author _artist; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; private IndexerDefinition _indexerDefinition; [SetUp] @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { _artist = Builder.CreateNew().With(s => s.Id = 1).Build(); - _remoteAlbum = new RemoteBook + _remoteBook = new RemoteBook { Author = _artist, Release = new TorrentInfo @@ -47,27 +47,27 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search private void GivenReleaseSeeders(int? seeders) { - (_remoteAlbum.Release as TorrentInfo).Seeders = seeders; + (_remoteBook.Release as TorrentInfo).Seeders = seeders; } [Test] public void should_return_true_if_not_torrent() { - _remoteAlbum.Release = new ReleaseInfo + _remoteBook.Release = new ReleaseInfo { IndexerId = 1, Title = "Artist - Album [FLAC-RlsGrp]" }; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] public void should_return_true_if_indexer_not_specified() { - _remoteAlbum.Release.IndexerId = 0; + _remoteBook.Release.IndexerId = 0; - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -77,7 +77,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search .Setup(v => v.Get(It.IsAny())) .Callback(i => { throw new ModelNotFoundException(typeof(IndexerDefinition), i); }); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [Test] @@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { GivenReleaseSeeders(null); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [TestCase(5)] @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { GivenReleaseSeeders(seeders); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue(); } [TestCase(0)] @@ -103,7 +103,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search { GivenReleaseSeeders(seeders); - Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse(); + Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs index fed07cd15..937482eb5 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ImportFixture.cs @@ -33,12 +33,12 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests .With(h => h.Title = "Drone.S01E01.HDTV") .Build(); - var remoteAlbum = BuildRemoteAlbum(); + var remoteBook = BuildRemoteAlbum(); _trackedDownload = Builder.CreateNew() .With(c => c.State = TrackedDownloadState.Downloading) .With(c => c.DownloadItem = completed) - .With(c => c.RemoteBook = remoteAlbum) + .With(c => c.RemoteBook = remoteBook) .Build(); Mocker.GetMock() @@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests Mocker.GetMock() .Setup(s => s.GetArtist("Drone.S01E01.HDTV")) - .Returns(remoteAlbum.Author); + .Returns(remoteBook.Author); } private Book CreateAlbum(int id) diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs index e0b539f42..807ae27c7 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceTests/ProcessFixture.cs @@ -29,12 +29,12 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests .With(h => h.Title = "Drone.S01E01.HDTV") .Build(); - var remoteAlbum = BuildRemoteAlbum(); + var remoteBook = BuildRemoteAlbum(); _trackedDownload = Builder.CreateNew() .With(c => c.State = TrackedDownloadState.Downloading) .With(c => c.DownloadItem = completed) - .With(c => c.RemoteBook = remoteAlbum) + .With(c => c.RemoteBook = remoteBook) .Build(); Mocker.GetMock() @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests Mocker.GetMock() .Setup(s => s.GetArtist("Drone.S01E01.HDTV")) - .Returns(remoteAlbum.Author); + .Returns(remoteBook.Author); } private RemoteBook BuildRemoteAlbum() diff --git a/src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs index 31741484e..8f48682c9 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadApprovedReportsTests/DownloadApprovedFixture.cs @@ -39,32 +39,32 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests private RemoteBook GetRemoteAlbum(List albums, QualityModel quality, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet) { - var remoteAlbum = new RemoteBook(); - remoteAlbum.ParsedBookInfo = new ParsedBookInfo(); - remoteAlbum.ParsedBookInfo.Quality = quality; + var remoteBook = new RemoteBook(); + remoteBook.ParsedBookInfo = new ParsedBookInfo(); + remoteBook.ParsedBookInfo.Quality = quality; - remoteAlbum.Books = new List(); - remoteAlbum.Books.AddRange(albums); + remoteBook.Books = new List(); + remoteBook.Books.AddRange(albums); - remoteAlbum.Release = new ReleaseInfo(); - remoteAlbum.Release.DownloadProtocol = downloadProtocol; - remoteAlbum.Release.PublishDate = DateTime.UtcNow; + remoteBook.Release = new ReleaseInfo(); + remoteBook.Release.DownloadProtocol = downloadProtocol; + remoteBook.Release.PublishDate = DateTime.UtcNow; - remoteAlbum.Author = Builder.CreateNew() + remoteBook.Author = Builder.CreateNew() .With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() }) .Build(); - return remoteAlbum; + return remoteBook; } [Test] public void should_download_report_if_album_was_not_already_downloaded() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); + decisions.Add(new DownloadDecision(remoteBook)); Subject.ProcessDecisions(decisions); Mocker.GetMock().Verify(v => v.DownloadReport(It.IsAny()), Times.Once()); @@ -74,11 +74,11 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_only_download_album_once() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); - decisions.Add(new DownloadDecision(remoteAlbum)); + decisions.Add(new DownloadDecision(remoteBook)); + decisions.Add(new DownloadDecision(remoteBook)); Subject.ProcessDecisions(decisions); Mocker.GetMock().Verify(v => v.DownloadReport(It.IsAny()), Times.Once()); @@ -87,17 +87,17 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests [Test] public void should_not_download_if_any_album_was_already_downloaded() { - var remoteAlbum1 = GetRemoteAlbum( + var remoteBook1 = GetRemoteAlbum( new List { GetAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GetRemoteAlbum( + var remoteBook2 = GetRemoteAlbum( new List { GetAlbum(1), GetAlbum(2) }, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); Subject.ProcessDecisions(decisions); Mocker.GetMock().Verify(v => v.DownloadReport(It.IsAny()), Times.Once()); @@ -107,10 +107,10 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_return_downloaded_reports() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); + decisions.Add(new DownloadDecision(remoteBook)); Subject.ProcessDecisions(decisions).Grabbed.Should().HaveCount(1); } @@ -118,17 +118,17 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests [Test] public void should_return_all_downloaded_reports() { - var remoteAlbum1 = GetRemoteAlbum( + var remoteBook1 = GetRemoteAlbum( new List { GetAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GetRemoteAlbum( + var remoteBook2 = GetRemoteAlbum( new List { GetAlbum(2) }, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); Subject.ProcessDecisions(decisions).Grabbed.Should().HaveCount(2); } @@ -136,22 +136,22 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests [Test] public void should_only_return_downloaded_reports() { - var remoteAlbum1 = GetRemoteAlbum( + var remoteBook1 = GetRemoteAlbum( new List { GetAlbum(1) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum2 = GetRemoteAlbum( + var remoteBook2 = GetRemoteAlbum( new List { GetAlbum(2) }, new QualityModel(Quality.MP3_320)); - var remoteAlbum3 = GetRemoteAlbum( + var remoteBook3 = GetRemoteAlbum( new List { GetAlbum(2) }, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum1)); - decisions.Add(new DownloadDecision(remoteAlbum2)); - decisions.Add(new DownloadDecision(remoteAlbum3)); + decisions.Add(new DownloadDecision(remoteBook1)); + decisions.Add(new DownloadDecision(remoteBook2)); + decisions.Add(new DownloadDecision(remoteBook3)); Subject.ProcessDecisions(decisions).Grabbed.Should().HaveCount(2); } @@ -160,10 +160,10 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_not_add_to_downloaded_list_when_download_fails() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); + decisions.Add(new DownloadDecision(remoteBook)); Mocker.GetMock().Setup(s => s.DownloadReport(It.IsAny())).Throws(new Exception()); Subject.ProcessDecisions(decisions).Grabbed.Should().BeEmpty(); @@ -184,10 +184,10 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_not_grab_if_pending() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary))); + decisions.Add(new DownloadDecision(remoteBook, new Rejection("Failure!", RejectionType.Temporary))); Subject.ProcessDecisions(decisions); Mocker.GetMock().Verify(v => v.DownloadReport(It.IsAny()), Times.Never()); @@ -197,11 +197,11 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_not_add_to_pending_if_album_was_grabbed() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); - decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary))); + decisions.Add(new DownloadDecision(remoteBook)); + decisions.Add(new DownloadDecision(remoteBook, new Rejection("Failure!", RejectionType.Temporary))); Subject.ProcessDecisions(decisions); Mocker.GetMock().Verify(v => v.AddMany(It.IsAny>>()), Times.Never()); @@ -211,11 +211,11 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_add_to_pending_even_if_already_added_to_pending() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary))); - decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary))); + decisions.Add(new DownloadDecision(remoteBook, new Rejection("Failure!", RejectionType.Temporary))); + decisions.Add(new DownloadDecision(remoteBook, new Rejection("Failure!", RejectionType.Temporary))); Subject.ProcessDecisions(decisions); Mocker.GetMock().Verify(v => v.AddMany(It.IsAny>>()), Times.Once()); @@ -225,11 +225,11 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_add_to_failed_if_already_failed_for_that_protocol() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); - decisions.Add(new DownloadDecision(remoteAlbum)); + decisions.Add(new DownloadDecision(remoteBook)); + decisions.Add(new DownloadDecision(remoteBook)); Mocker.GetMock().Setup(s => s.DownloadReport(It.IsAny())) .Throws(new DownloadClientUnavailableException("Download client failed")); @@ -242,12 +242,12 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_not_add_to_failed_if_failed_for_a_different_protocol() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320), DownloadProtocol.Usenet); - var remoteAlbum2 = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320), DownloadProtocol.Torrent); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320), DownloadProtocol.Usenet); + var remoteBook2 = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320), DownloadProtocol.Torrent); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); - decisions.Add(new DownloadDecision(remoteAlbum2)); + decisions.Add(new DownloadDecision(remoteBook)); + decisions.Add(new DownloadDecision(remoteBook2)); Mocker.GetMock().Setup(s => s.DownloadReport(It.Is(r => r.Release.DownloadProtocol == DownloadProtocol.Usenet))) .Throws(new DownloadClientUnavailableException("Download client failed")); @@ -261,14 +261,14 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests public void should_add_to_rejected_if_release_unavailable_on_indexer() { var albums = new List { GetAlbum(1) }; - var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); + var remoteBook = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320)); var decisions = new List(); - decisions.Add(new DownloadDecision(remoteAlbum)); + decisions.Add(new DownloadDecision(remoteBook)); Mocker.GetMock() .Setup(s => s.DownloadReport(It.IsAny())) - .Throws(new ReleaseUnavailableException(remoteAlbum.Release, "That 404 Error is not just a Quirk")); + .Throws(new ReleaseUnavailableException(remoteBook.Release, "That 404 Error is not just a Quirk")); var result = Subject.ProcessDecisions(decisions); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs index a5e7bb63a..c075fab69 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/TorrentBlackholeFixture.cs @@ -89,17 +89,17 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole protected override RemoteBook CreateRemoteAlbum() { - var remoteAlbum = base.CreateRemoteAlbum(); + var remoteBook = base.CreateRemoteAlbum(); var torrentInfo = new TorrentInfo(); - torrentInfo.Title = remoteAlbum.Release.Title; - torrentInfo.DownloadUrl = remoteAlbum.Release.DownloadUrl; - torrentInfo.DownloadProtocol = remoteAlbum.Release.DownloadProtocol; + torrentInfo.Title = remoteBook.Release.Title; + torrentInfo.DownloadUrl = remoteBook.Release.DownloadUrl; + torrentInfo.DownloadProtocol = remoteBook.Release.DownloadProtocol; torrentInfo.MagnetUrl = "magnet:?xt=urn:btih:755248817d32b00cc853e633ecdc48e4c21bff15&dn=Artist.Album.FLAC.loseless-DEFiNE%5Brartv%5D&tr=http%3A%2F%2Ftracker.trackerfix.com%3A80%2Fannounce&tr=udp%3A%2F%2F9.rarbg.me%3A2710&tr=udp%3A%2F%2F9.rarbg.to%3A2710"; - remoteAlbum.Release = torrentInfo; + remoteBook.Release = torrentInfo; - return remoteAlbum; + return remoteBook; } [Test] @@ -141,9 +141,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole [Test] public void Download_should_download_file_if_it_doesnt_exist() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Once()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_filePath), Times.Once()); @@ -155,9 +155,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole { GivenMagnetFilePath(); Subject.Definition.Settings.As().SaveMagnetFiles = true; - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = null; - Subject.Download(remoteAlbum); + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = null; + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Never()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_filePath), Times.Never()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_magnetFilePath), Times.Once()); @@ -173,10 +173,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole Subject.Definition.Settings.As().SaveMagnetFiles = true; Subject.Definition.Settings.As().MagnetFileExtension = magnetFileExtension; - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = null; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = null; - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Never()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_filePath), Times.Never()); @@ -188,10 +188,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole public void Download_should_not_save_magnet_if_disabled() { GivenMagnetFilePath(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = null; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = null; - Assert.Throws(() => Subject.Download(remoteAlbum)); + Assert.Throws(() => Subject.Download(remoteBook)); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Never()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_filePath), Times.Never()); @@ -204,9 +204,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole { Subject.Definition.Settings.As().SaveMagnetFiles = true; - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Once()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_filePath), Times.Once()); @@ -220,10 +220,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole var illegalTitle = "Radiohead - Scotch Mist [2008/FLAC/Lossless]"; var expectedFilename = Path.Combine(_blackholeFolder, "Radiohead - Scotch Mist [2008+FLAC+Lossless]" + Path.GetExtension(_filePath)); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.Title = illegalTitle; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.Title = illegalTitle; - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Once()); Mocker.GetMock().Verify(c => c.OpenWriteStream(expectedFilename), Times.Once()); @@ -233,10 +233,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole [Test] public void Download_should_throw_if_magnet_and_torrent_url_does_not_exist() { - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = null; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = null; - Assert.Throws(() => Subject.Download(remoteAlbum)); + Assert.Throws(() => Subject.Download(remoteBook)); } [Test] @@ -308,9 +308,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole [Test] public void should_return_null_hash() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - Subject.Download(remoteAlbum).Should().BeNull(); + Subject.Download(remoteBook).Should().BeNull(); } } } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/UsenetBlackholeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/UsenetBlackholeFixture.cs index 4b50f04ad..8f10eae5e 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/UsenetBlackholeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/Blackhole/UsenetBlackholeFixture.cs @@ -113,9 +113,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole [Test] public void Download_should_download_file_if_it_doesnt_exist() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Once()); Mocker.GetMock().Verify(c => c.OpenWriteStream(_filePath), Times.Once()); @@ -128,10 +128,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole var illegalTitle = "Radiohead - Scotch Mist [2008/FLAC/Lossless]"; var expectedFilename = Path.Combine(_blackholeFolder, "Radiohead - Scotch Mist [2008+FLAC+Lossless]" + Path.GetExtension(_filePath)); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.Title = illegalTitle; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.Title = illegalTitle; - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock().Verify(c => c.Get(It.Is(v => v.Url.FullUri == _downloadUrl)), Times.Once()); Mocker.GetMock().Verify(c => c.OpenWriteStream(expectedFilename), Times.Once()); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs index e7c14527b..b0fe24e3b 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs @@ -204,9 +204,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -216,10 +216,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = magnetUrl; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = magnetUrl; - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().Be(expectedHash); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs index c9c6f76ab..fd2ff3e67 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadClientFixtureBase.cs @@ -44,19 +44,19 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests protected virtual RemoteBook CreateRemoteAlbum() { - var remoteAlbum = new RemoteBook(); - remoteAlbum.Release = new ReleaseInfo(); - remoteAlbum.Release.Title = _title; - remoteAlbum.Release.DownloadUrl = _downloadUrl; - remoteAlbum.Release.DownloadProtocol = Subject.Protocol; + var remoteBook = new RemoteBook(); + remoteBook.Release = new ReleaseInfo(); + remoteBook.Release.Title = _title; + remoteBook.Release.DownloadUrl = _downloadUrl; + remoteBook.Release.DownloadProtocol = Subject.Protocol; - remoteAlbum.ParsedBookInfo = new ParsedBookInfo(); + remoteBook.ParsedBookInfo = new ParsedBookInfo(); - remoteAlbum.Books = new List(); + remoteBook.Books = new List(); - remoteAlbum.Author = new Author(); + remoteBook.Author = new Author(); - return remoteAlbum; + return remoteBook; } protected void VerifyIdentifiable(DownloadClientItem downloadClientItem) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs index 96452673b..fab7e9123 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/TorrentDownloadStationFixture.cs @@ -387,9 +387,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests GivenTvDirectory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -404,9 +404,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests GivenMusicCategory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -420,9 +420,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests GivenSerialNumber(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -495,13 +495,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests [Test] public void Download_should_throw_and_not_add_task_if_cannot_get_serial_number() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); Mocker.GetMock() .Setup(s => s.GetSerialNumber(_settings)) .Throws(new ApplicationException("Some unknown exception, HttpException or DownloadClientException")); - Assert.Throws(Is.InstanceOf(), () => Subject.Download(remoteAlbum)); + Assert.Throws(Is.InstanceOf(), () => Subject.Download(remoteBook)); Mocker.GetMock() .Verify(v => v.AddTaskFromUrl(It.IsAny(), null, _settings), Times.Never()); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs index 8a0ff0c79..8eb1076a0 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DownloadStationTests/UsenetDownloadStationFixture.cs @@ -33,14 +33,14 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests protected string _defaultDestination = "somepath"; protected OsPath _physicalPath = new OsPath("/mnt/sdb1/mydata"); - protected RemoteBook _remoteAlbum; + protected RemoteBook _remoteBook; protected Dictionary _downloadStationConfigItems; [SetUp] public void Setup() { - _remoteAlbum = CreateRemoteAlbum(); + _remoteBook = CreateRemoteAlbum(); _settings = new DownloadStationSettings() { @@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Detail = new Dictionary { { "destination", "shared/folder" }, - { "uri", FileNameBuilder.CleanFileName(_remoteAlbum.Release.Title) + ".nzb" } + { "uri", FileNameBuilder.CleanFileName(_remoteBook.Release.Title) + ".nzb" } }, Transfer = new Dictionary { @@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Detail = new Dictionary { { "destination", "shared/folder" }, - { "uri", FileNameBuilder.CleanFileName(_remoteAlbum.Release.Title) + ".nzb" } + { "uri", FileNameBuilder.CleanFileName(_remoteBook.Release.Title) + ".nzb" } }, Transfer = new Dictionary { @@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Detail = new Dictionary { { "destination", "shared/folder" }, - { "uri", FileNameBuilder.CleanFileName(_remoteAlbum.Release.Title) + ".nzb" } + { "uri", FileNameBuilder.CleanFileName(_remoteBook.Release.Title) + ".nzb" } }, Transfer = new Dictionary { @@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Detail = new Dictionary { { "destination", "shared/folder" }, - { "uri", FileNameBuilder.CleanFileName(_remoteAlbum.Release.Title) + ".nzb" } + { "uri", FileNameBuilder.CleanFileName(_remoteBook.Release.Title) + ".nzb" } }, Transfer = new Dictionary { @@ -158,7 +158,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests Detail = new Dictionary { { "destination", "shared/folder" }, - { "uri", FileNameBuilder.CleanFileName(_remoteAlbum.Release.Title) + ".nzb" } + { "uri", FileNameBuilder.CleanFileName(_remoteBook.Release.Title) + ".nzb" } }, Transfer = new Dictionary { @@ -264,9 +264,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests GivenTvDirectory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -281,9 +281,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests GivenMusicCategory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -297,9 +297,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests GivenSerialNumber(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -372,13 +372,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DownloadStationTests [Test] public void Download_should_throw_and_not_add_task_if_cannot_get_serial_number() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); Mocker.GetMock() .Setup(s => s.GetSerialNumber(_settings)) .Throws(new ApplicationException("Some unknown exception, HttpException or DownloadClientException")); - Assert.Throws(Is.InstanceOf(), () => Subject.Download(remoteAlbum)); + Assert.Throws(Is.InstanceOf(), () => Subject.Download(remoteBook)); Mocker.GetMock() .Verify(v => v.AddTaskFromUrl(It.IsAny(), null, _settings), Times.Never()); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs index d3725ba43..1699d3698 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/HadoukenTests/HadoukenFixture.cs @@ -200,9 +200,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -279,14 +279,14 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests [Test] public void Download_from_magnet_link_should_return_hash_uppercase() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = "magnet:?xt=urn:btih:a45129e59d8750f9da982f53552b1e4f0457ee9f"; + remoteBook.Release.DownloadUrl = "magnet:?xt=urn:btih:a45129e59d8750f9da982f53552b1e4f0457ee9f"; Mocker.GetMock() .Setup(v => v.AddTorrentUri(It.IsAny(), It.IsAny())); - var result = Subject.Download(remoteAlbum); + var result = Subject.Download(remoteBook); Assert.IsFalse(result.Any(c => char.IsLower(c))); } @@ -294,13 +294,13 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.HadoukenTests [Test] public void Download_from_torrent_file_should_return_hash_uppercase() { - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); Mocker.GetMock() .Setup(v => v.AddTorrentFile(It.IsAny(), It.IsAny())) .Returns("hash"); - var result = Subject.Download(remoteAlbum); + var result = Subject.Download(remoteBook); Assert.IsFalse(result.Any(c => char.IsLower(c))); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbVortexTests/NzbVortexFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbVortexTests/NzbVortexFixture.cs index 7203f163d..e74409ee6 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbVortexTests/NzbVortexFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbVortexTests/NzbVortexFixture.cs @@ -204,9 +204,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -216,9 +216,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbVortexTests { GivenFailedDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - Assert.Throws(() => Subject.Download(remoteAlbum)); + Assert.Throws(() => Subject.Download(remoteBook)); } [Test] diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs index 0d37a3767..7c07bc3b0 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs @@ -335,9 +335,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -347,9 +347,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests { GivenFailedDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - Assert.Throws(() => Subject.Download(remoteAlbum)); + Assert.Throws(() => Subject.Download(remoteBook)); } [Test] diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs index 0e75bd7a6..2565a01b4 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/PneumaticProviderFixture.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests private string _pneumaticFolder; private string _strmFolder; private string _nzbPath; - private RemoteBook _remoteAlbum; + private RemoteBook _remoteBook; [SetUp] public void Setup() @@ -30,12 +30,12 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests _nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic(); _strmFolder = @"d:\unsorted tv\".AsOsAgnostic(); - _remoteAlbum = new RemoteBook(); - _remoteAlbum.Release = new ReleaseInfo(); - _remoteAlbum.Release.Title = _title; - _remoteAlbum.Release.DownloadUrl = _nzbUrl; + _remoteBook = new RemoteBook(); + _remoteBook.Release = new ReleaseInfo(); + _remoteBook.Release.Title = _title; + _remoteBook.Release.DownloadUrl = _nzbUrl; - _remoteAlbum.ParsedBookInfo = new ParsedBookInfo(); + _remoteBook.ParsedBookInfo = new ParsedBookInfo(); Subject.Definition = new DownloadClientDefinition(); Subject.Definition.Settings = new PneumaticSettings @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests [Test] public void should_download_file_if_it_doesnt_exist() { - Subject.Download(_remoteAlbum); + Subject.Download(_remoteBook); Mocker.GetMock().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath, null), Times.Once()); } @@ -63,16 +63,16 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests { WithFailedDownload(); - Assert.Throws(() => Subject.Download(_remoteAlbum)); + Assert.Throws(() => Subject.Download(_remoteBook)); } [Test] public void should_throw_if_discography_download() { - _remoteAlbum.Release.Title = "Alien Ant Farm - Discography"; - _remoteAlbum.ParsedBookInfo.Discography = true; + _remoteBook.Release.Title = "Alien Ant Farm - Discography"; + _remoteBook.ParsedBookInfo.Discography = true; - Assert.Throws(() => Subject.Download(_remoteAlbum)); + Assert.Throws(() => Subject.Download(_remoteBook)); } [Test] @@ -86,9 +86,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests { var illegalTitle = "Saturday Night Live - S38E08 - Jeremy Renner/Maroon 5 [SDTV]"; var expectedFilename = Path.Combine(_pneumaticFolder, "Saturday Night Live - S38E08 - Jeremy Renner+Maroon 5 [SDTV].nzb"); - _remoteAlbum.Release.Title = illegalTitle; + _remoteBook.Release.Title = illegalTitle; - Subject.Download(_remoteAlbum); + Subject.Download(_remoteBook); Mocker.GetMock().Verify(c => c.DownloadFile(It.IsAny(), expectedFilename, null), Times.Once()); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs index 39e5574f6..c2f8dc150 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/QBittorrentTests/QBittorrentFixture.cs @@ -263,9 +263,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -275,10 +275,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = magnetUrl; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = magnetUrl; - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().Be(expectedHash); } @@ -290,10 +290,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests .Setup(s => s.GetConfig(It.IsAny())) .Returns(new QBittorrentPreferences() { DhtEnabled = false }); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = "magnet:?xt=urn:btih:ZPBPA2P6ROZPKRHK44D5OW6NHXU5Z6KR"; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = "magnet:?xt=urn:btih:ZPBPA2P6ROZPKRHK44D5OW6NHXU5Z6KR"; - Assert.Throws(() => Subject.Download(remoteAlbum)); + Assert.Throws(() => Subject.Download(remoteBook)); } [Test] @@ -303,10 +303,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests .Setup(s => s.GetConfig(It.IsAny())) .Returns(new QBittorrentPreferences { DhtEnabled = false }); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = "magnet:?xt=urn:btih:ZPBPA2P6ROZPKRHK44D5OW6NHXU5Z6KR&tr=udp://abc"; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = "magnet:?xt=urn:btih:ZPBPA2P6ROZPKRHK44D5OW6NHXU5Z6KR&tr=udp://abc"; - Assert.DoesNotThrow(() => Subject.Download(remoteAlbum)); + Assert.DoesNotThrow(() => Subject.Download(remoteBook)); Mocker.GetMock() .Verify(s => s.AddTorrentFromUrl(It.IsAny(), It.IsAny()), Times.Once()); @@ -318,9 +318,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests GivenHighPriority(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); Mocker.GetMock() .Verify(v => v.MoveTorrentToTopInQueue(It.IsAny(), It.IsAny()), Times.Once()); @@ -336,9 +336,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests .Setup(v => v.MoveTorrentToTopInQueue(It.IsAny(), It.IsAny())) .Throws(new HttpException(new HttpResponse(new HttpRequest("http://me.local/"), new HttpHeader(), new byte[0], System.Net.HttpStatusCode.Forbidden))); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -370,9 +370,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests GivenRedirectToMagnet(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -383,9 +383,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests GivenRedirectToTorrent(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/RTorrentTests/RTorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/RTorrentTests/RTorrentFixture.cs index f1a8a920e..a736e8d4f 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/RTorrentTests/RTorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/RTorrentTests/RTorrentFixture.cs @@ -115,9 +115,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.RTorrentTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs index bc9e02cdb..4bd407623 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/SabnzbdTests/SabnzbdFixture.cs @@ -298,10 +298,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.Title = title; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.Title = title; - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); Mocker.GetMock() .Verify(v => v.DownloadNzb(It.IsAny(), filename, It.IsAny(), It.IsAny(), It.IsAny()), Times.Once()); @@ -312,9 +312,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -353,14 +353,14 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests .Setup(s => s.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny(), (int)SabnzbdPriority.High, It.IsAny())) .Returns(new SabnzbdAddResponse { Ids = new List { "readarrtest" } }); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Books = Builder.CreateListOfSize(1) + var remoteBook = CreateRemoteAlbum(); + remoteBook.Books = Builder.CreateListOfSize(1) .All() .With(e => e.ReleaseDate = DateTime.Today) .Build() .ToList(); - Subject.Download(remoteAlbum); + Subject.Download(remoteBook); Mocker.GetMock() .Verify(v => v.DownloadNzb(It.IsAny(), It.IsAny(), It.IsAny(), (int)SabnzbdPriority.High, It.IsAny()), Times.Once()); diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs index 9a404dd62..f392b9d3e 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/TransmissionTests/TransmissionFixture.cs @@ -58,9 +58,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -71,9 +71,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests GivenTvDirectory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -87,9 +87,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests GivenMusicCategory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -105,9 +105,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests _transmissionConfigItems["download-dir"] += "/"; - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -120,9 +120,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -135,10 +135,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.TransmissionTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = magnetUrl; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = magnetUrl; - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().Be(expectedHash); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs index fb0d91b73..8a147723d 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/UTorrentTests/UTorrentFixture.cs @@ -232,9 +232,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -256,10 +256,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = magnetUrl; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = magnetUrl; - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().Be(expectedHash); } @@ -355,9 +355,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests GivenRedirectToMagnet(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -368,9 +368,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests GivenRedirectToTorrent(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs index dc85cd900..7bbc79755 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/VuzeTests/VuzeFixture.cs @@ -67,9 +67,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); } @@ -80,9 +80,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests GivenTvDirectory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -96,9 +96,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests GivenMusicCategory(); GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -114,9 +114,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests _transmissionConfigItems["download-dir"] += "/"; - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -129,9 +129,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); + var remoteBook = CreateRemoteAlbum(); - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().NotBeNullOrEmpty(); @@ -144,10 +144,10 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.VuzeTests { GivenSuccessfulDownload(); - var remoteAlbum = CreateRemoteAlbum(); - remoteAlbum.Release.DownloadUrl = magnetUrl; + var remoteBook = CreateRemoteAlbum(); + remoteBook.Release.DownloadUrl = magnetUrl; - var id = Subject.Download(remoteAlbum); + var id = Subject.Download(remoteBook); id.Should().Be(expectedHash); } diff --git a/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFailedFixture.cs b/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFailedFixture.cs index 8f66f49bf..5736f9abb 100644 --- a/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFailedFixture.cs +++ b/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFailedFixture.cs @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.Download.FailedDownloadServiceTests _grabHistory = Builder.CreateListOfSize(2).BuildList(); - var remoteAlbum = new RemoteBook + var remoteBook = new RemoteBook { Author = new Author(), Books = new List { new Book { Id = 1 } } @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.Download.FailedDownloadServiceTests _trackedDownload = Builder.CreateNew() .With(c => c.State = TrackedDownloadState.DownloadFailedPending) .With(c => c.DownloadItem = completed) - .With(c => c.RemoteBook = remoteAlbum) + .With(c => c.RemoteBook = remoteBook) .Build(); Mocker.GetMock() diff --git a/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFixture.cs b/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFixture.cs index 6735e1c96..f49742ab8 100644 --- a/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFixture.cs +++ b/src/NzbDrone.Core.Test/Download/FailedDownloadServiceTests/ProcessFixture.cs @@ -32,7 +32,7 @@ namespace NzbDrone.Core.Test.Download.FailedDownloadServiceTests _grabHistory = Builder.CreateListOfSize(2).BuildList(); - var remoteAlbum = new RemoteBook + var remoteBook = new RemoteBook { Author = new Author(), Books = new List { new Book { Id = 1 } } @@ -41,7 +41,7 @@ namespace NzbDrone.Core.Test.Download.FailedDownloadServiceTests _trackedDownload = Builder.CreateNew() .With(c => c.State = TrackedDownloadState.Downloading) .With(c => c.DownloadItem = completed) - .With(c => c.RemoteBook = remoteAlbum) + .With(c => c.RemoteBook = remoteBook) .Build(); Mocker.GetMock() diff --git a/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/AddFixture.cs b/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/AddFixture.cs index 1615c811e..e9f697a22 100644 --- a/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/AddFixture.cs +++ b/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/AddFixture.cs @@ -25,8 +25,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests private Book _album; private QualityProfile _profile; private ReleaseInfo _release; - private ParsedBookInfo _parsedAlbumInfo; - private RemoteBook _remoteAlbum; + private ParsedBookInfo _parsedBookInfo; + private RemoteBook _remoteBook; private List _heldReleases; [SetUp] @@ -54,16 +54,16 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests _release = Builder.CreateNew().Build(); - _parsedAlbumInfo = Builder.CreateNew().Build(); - _parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320); + _parsedBookInfo = Builder.CreateNew().Build(); + _parsedBookInfo.Quality = new QualityModel(Quality.MP3_320); - _remoteAlbum = new RemoteBook(); - _remoteAlbum.Books = new List { _album }; - _remoteAlbum.Author = _artist; - _remoteAlbum.ParsedBookInfo = _parsedAlbumInfo; - _remoteAlbum.Release = _release; + _remoteBook = new RemoteBook(); + _remoteBook.Books = new List { _album }; + _remoteBook.Author = _artist; + _remoteBook.ParsedBookInfo = _parsedBookInfo; + _remoteBook.Release = _release; - _temporarilyRejected = new DownloadDecision(_remoteAlbum, new Rejection("Temp Rejected", RejectionType.Temporary)); + _temporarilyRejected = new DownloadDecision(_remoteBook, new Rejection("Temp Rejected", RejectionType.Temporary)); _heldReleases = new List(); diff --git a/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveGrabbedFixture.cs b/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveGrabbedFixture.cs index c34d20618..1de729116 100644 --- a/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveGrabbedFixture.cs +++ b/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveGrabbedFixture.cs @@ -25,8 +25,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests private Book _album; private QualityProfile _profile; private ReleaseInfo _release; - private ParsedBookInfo _parsedAlbumInfo; - private RemoteBook _remoteAlbum; + private ParsedBookInfo _parsedBookInfo; + private RemoteBook _remoteBook; private List _heldReleases; [SetUp] @@ -54,16 +54,16 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests _release = Builder.CreateNew().Build(); - _parsedAlbumInfo = Builder.CreateNew().Build(); - _parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320); + _parsedBookInfo = Builder.CreateNew().Build(); + _parsedBookInfo.Quality = new QualityModel(Quality.MP3_320); - _remoteAlbum = new RemoteBook(); - _remoteAlbum.Books = new List { _album }; - _remoteAlbum.Author = _artist; - _remoteAlbum.ParsedBookInfo = _parsedAlbumInfo; - _remoteAlbum.Release = _release; + _remoteBook = new RemoteBook(); + _remoteBook.Books = new List { _album }; + _remoteBook.Author = _artist; + _remoteBook.ParsedBookInfo = _parsedBookInfo; + _remoteBook.Release = _release; - _temporarilyRejected = new DownloadDecision(_remoteAlbum, new Rejection("Temp Rejected", RejectionType.Temporary)); + _temporarilyRejected = new DownloadDecision(_remoteBook, new Rejection("Temp Rejected", RejectionType.Temporary)); _heldReleases = new List(); @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests private void GivenHeldRelease(QualityModel quality) { - var parsedEpisodeInfo = _parsedAlbumInfo.JsonClone(); + var parsedEpisodeInfo = _parsedBookInfo.JsonClone(); parsedEpisodeInfo.Quality = quality; var heldReleases = Builder.CreateListOfSize(1) @@ -110,9 +110,9 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests [Test] public void should_delete_if_the_grabbed_quality_is_the_same() { - GivenHeldRelease(_parsedAlbumInfo.Quality); + GivenHeldRelease(_parsedBookInfo.Quality); - Subject.Handle(new BookGrabbedEvent(_remoteAlbum)); + Subject.Handle(new BookGrabbedEvent(_remoteBook)); VerifyDelete(); } @@ -122,7 +122,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests { GivenHeldRelease(new QualityModel(Quality.MP3_320)); - Subject.Handle(new BookGrabbedEvent(_remoteAlbum)); + Subject.Handle(new BookGrabbedEvent(_remoteBook)); VerifyDelete(); } @@ -132,7 +132,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests { GivenHeldRelease(new QualityModel(Quality.FLAC)); - Subject.Handle(new BookGrabbedEvent(_remoteAlbum)); + Subject.Handle(new BookGrabbedEvent(_remoteBook)); VerifyNoDelete(); } diff --git a/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveRejectedFixture.cs b/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveRejectedFixture.cs index adc475a9f..3562b6344 100644 --- a/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveRejectedFixture.cs +++ b/src/NzbDrone.Core.Test/Download/Pending/PendingReleaseServiceTests/RemoveRejectedFixture.cs @@ -26,8 +26,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests private Book _album; private QualityProfile _profile; private ReleaseInfo _release; - private ParsedBookInfo _parsedAlbumInfo; - private RemoteBook _remoteAlbum; + private ParsedBookInfo _parsedBookInfo; + private RemoteBook _remoteBook; [SetUp] public void Setup() @@ -54,16 +54,16 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests _release = Builder.CreateNew().Build(); - _parsedAlbumInfo = Builder.CreateNew().Build(); - _parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320); + _parsedBookInfo = Builder.CreateNew().Build(); + _parsedBookInfo.Quality = new QualityModel(Quality.MP3_320); - _remoteAlbum = new RemoteBook(); - _remoteAlbum.Books = new List { _album }; - _remoteAlbum.Author = _artist; - _remoteAlbum.ParsedBookInfo = _parsedAlbumInfo; - _remoteAlbum.Release = _release; + _remoteBook = new RemoteBook(); + _remoteBook.Books = new List { _album }; + _remoteBook.Author = _artist; + _remoteBook.ParsedBookInfo = _parsedBookInfo; + _remoteBook.Release = _release; - _temporarilyRejected = new DownloadDecision(_remoteAlbum, new Rejection("Temp Rejected", RejectionType.Temporary)); + _temporarilyRejected = new DownloadDecision(_remoteBook, new Rejection("Temp Rejected", RejectionType.Temporary)); Mocker.GetMock() .Setup(s => s.All()) diff --git a/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadAlreadyImportedFixture.cs b/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadAlreadyImportedFixture.cs index 2f9bb3fce..15a3df3c0 100644 --- a/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadAlreadyImportedFixture.cs +++ b/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadAlreadyImportedFixture.cs @@ -22,12 +22,12 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads { _albums = new List(); - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Books = _albums) .Build(); _trackedDownload = Builder.CreateNew() - .With(t => t.RemoteBook = remoteAlbum) + .With(t => t.RemoteBook = remoteBook) .Build(); _historyItems = new List(); diff --git a/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs index dc3f0e52e..1b3572b2c 100644 --- a/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/TrackedDownloads/TrackedDownloadServiceFixture.cs @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads { GivenDownloadHistory(); - var remoteAlbum = new RemoteBook + var remoteBook = new RemoteBook { Author = new Author() { Id = 5 }, Books = new List { new Book { Id = 4 } }, @@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads Mocker.GetMock() .Setup(s => s.Map(It.Is(i => i.BookTitle == "Audio Album" && i.AuthorName == "Audio Artist"), It.IsAny(), It.IsAny>())) - .Returns(remoteAlbum); + .Returns(remoteBook); var client = new DownloadClientDefinition() { @@ -80,7 +80,7 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads { GivenDownloadHistory(); - var remoteAlbum = new RemoteBook + var remoteBook = new RemoteBook { Author = new Author() { Id = 5 }, Books = new List { new Book { Id = 4 } }, @@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads Mocker.GetMock() .Setup(s => s.Map(It.Is(i => i.BookTitle == "Audio Album" && i.AuthorName == "Audio Artist"), It.IsAny(), It.IsAny>())) - .Returns(remoteAlbum); + .Returns(remoteBook); var client = new DownloadClientDefinition() { @@ -117,7 +117,7 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads .Returns(default(RemoteBook)); // handle deletion event - Subject.Handle(new BookDeletedEvent(remoteAlbum.Books.First(), false, false)); + Subject.Handle(new BookDeletedEvent(remoteBook.Books.First(), false, false)); // verify download has null remote album var trackedDownloads = Subject.GetTrackedDownloads(); diff --git a/src/NzbDrone.Core.Test/HealthCheck/Checks/DeleteBadMediaCovers.cs b/src/NzbDrone.Core.Test/HealthCheck/Checks/DeleteBadMediaCovers.cs index 3f0b233c2..6a03484b4 100644 --- a/src/NzbDrone.Core.Test/HealthCheck/Checks/DeleteBadMediaCovers.cs +++ b/src/NzbDrone.Core.Test/HealthCheck/Checks/DeleteBadMediaCovers.cs @@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks .Returns(_artist); Mocker.GetMock() - .Setup(c => c.GetFilesByArtist(_artist.First().Id)) + .Setup(c => c.GetFilesByAuthor(_artist.First().Id)) .Returns(_metadata); Mocker.GetMock().SetupGet(c => c.CleanupMetadataImages).Returns(true); @@ -48,7 +48,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks public void should_not_process_non_image_files() { _metadata.First().RelativePath = "album\\file.xml".AsOsAgnostic(); - _metadata.First().Type = MetadataType.TrackMetadata; + _metadata.First().Type = MetadataType.BookMetadata; Subject.Clean(); @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks var imagePath = "C:\\Music\\Album\\image.jpg".AsOsAgnostic(); _metadata.First().LastUpdated = new DateTime(2014, 12, 29); _metadata.First().RelativePath = "Album\\image.jpg".AsOsAgnostic(); - _metadata.First().Type = MetadataType.ArtistImage; + _metadata.First().Type = MetadataType.AuthorImage; Mocker.GetMock() .Setup(c => c.OpenReadStream(imagePath)) @@ -111,7 +111,7 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks { var imagePath = "C:\\Music\\Album\\image.jpg".AsOsAgnostic(); _metadata.First().LastUpdated = new DateTime(2014, 12, 29); - _metadata.First().Type = MetadataType.AlbumImage; + _metadata.First().Type = MetadataType.BookImage; _metadata.First().RelativePath = "Album\\image.jpg".AsOsAgnostic(); Mocker.GetMock() diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupDuplicateMetadataFilesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupDuplicateMetadataFilesFixture.cs index 2ce3bf8e6..df84e3ba2 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupDuplicateMetadataFilesFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupDuplicateMetadataFilesFixture.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.ArtistMetadata) + .With(m => m.Type = MetadataType.AuthorMetadata) .With(m => m.AuthorId = 1) .BuildListOfNew(); @@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.ArtistMetadata) + .With(m => m.Type = MetadataType.AuthorMetadata) .With(m => m.Consumer = "XbmcMetadata") .BuildListOfNew(); @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.ArtistMetadata) + .With(m => m.Type = MetadataType.AuthorMetadata) .With(m => m.AuthorId = 1) .With(m => m.Consumer = "XbmcMetadata") .BuildListOfNew(); @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.AlbumMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.AuthorId = 1) .With(m => m.BookId = 1) .BuildListOfNew(); @@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.AlbumMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.Consumer = "XbmcMetadata") .With(m => m.AuthorId = 1) .BuildListOfNew(); @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.AlbumMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.AuthorId = 1) .With(m => m.BookId = 1) .With(m => m.Consumer = "XbmcMetadata") @@ -127,7 +127,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.TrackMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.BookFileId = 1) .BuildListOfNew(); @@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.TrackMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.Consumer = "XbmcMetadata") .BuildListOfNew(); @@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers { var files = Builder.CreateListOfSize(2) .All() - .With(m => m.Type = MetadataType.TrackMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.BookFileId = 1) .With(m => m.Consumer = "XbmcMetadata") .BuildListOfNew(); diff --git a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs index d47959895..f00f230dc 100644 --- a/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs +++ b/src/NzbDrone.Core.Test/Housekeeping/Housekeepers/CleanupOrphanedMetadataFilesFixture.cs @@ -148,7 +148,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers var metadataFile = Builder.CreateNew() .With(m => m.AuthorId = artist.Id) - .With(m => m.Type = MetadataType.AlbumMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.BookId = 0) .With(m => m.BookFileId = null) .BuildNew(); @@ -168,7 +168,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers var metadataFile = Builder.CreateNew() .With(m => m.AuthorId = artist.Id) - .With(m => m.Type = MetadataType.AlbumImage) + .With(m => m.Type = MetadataType.BookImage) .With(m => m.BookId = 0) .With(m => m.BookFileId = null) .BuildNew(); @@ -188,7 +188,7 @@ namespace NzbDrone.Core.Test.Housekeeping.Housekeepers var metadataFile = Builder.CreateNew() .With(m => m.AuthorId = artist.Id) - .With(m => m.Type = MetadataType.TrackMetadata) + .With(m => m.Type = MetadataType.BookMetadata) .With(m => m.BookFileId = 0) .BuildNew(); diff --git a/src/NzbDrone.Core.Test/MediaFiles/DownloadedAlbumsCommandServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedAlbumsCommandServiceFixture.cs index a8cd6c6b7..b5d453769 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedAlbumsCommandServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedAlbumsCommandServiceFixture.cs @@ -41,14 +41,14 @@ namespace NzbDrone.Core.Test.MediaFiles .With(v => v.Status = DownloadItemStatus.Downloading) .Build(); - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(v => v.Author = new Author()) .Build(); _trackedDownload = new TrackedDownload { DownloadItem = downloadItem, - RemoteBook = remoteAlbum, + RemoteBook = remoteBook, State = TrackedDownloadState.Downloading }; } diff --git a/src/NzbDrone.Core.Test/MediaFiles/DownloadedTracksImportServiceFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/DownloadedTracksImportServiceFixture.cs index 86ccd2176..773b7d888 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/DownloadedTracksImportServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/DownloadedTracksImportServiceFixture.cs @@ -49,14 +49,14 @@ namespace NzbDrone.Core.Test.MediaFiles .With(v => v.Status = DownloadItemStatus.Downloading) .Build(); - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(v => v.Author = new Author()) .Build(); _trackedDownload = new TrackedDownload { DownloadItem = downloadItem, - RemoteBook = remoteAlbum, + RemoteBook = remoteBook, State = TrackedDownloadState.Downloading }; } diff --git a/src/NzbDrone.Core.Test/MusicTests/RefreshArtistServiceFixture.cs b/src/NzbDrone.Core.Test/MusicTests/RefreshArtistServiceFixture.cs index 33d59c3bc..5fd1486ae 100644 --- a/src/NzbDrone.Core.Test/MusicTests/RefreshArtistServiceFixture.cs +++ b/src/NzbDrone.Core.Test/MusicTests/RefreshArtistServiceFixture.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.MusicTests private Book _album1; private Book _album2; private List _albums; - private List _remoteAlbums; + private List _remoteBooks; [SetUp] public void Setup() @@ -40,8 +40,8 @@ namespace NzbDrone.Core.Test.MusicTests _albums = new List { _album1, _album2 }; - _remoteAlbums = _albums.JsonClone(); - _remoteAlbums.ForEach(x => x.Id = 0); + _remoteBooks = _albums.JsonClone(); + _remoteBooks.ForEach(x => x.Id = 0); var metadata = Builder.CreateNew().Build(); var series = Builder.CreateListOfSize(1).BuildList(); @@ -116,7 +116,7 @@ namespace NzbDrone.Core.Test.MusicTests { var newArtistInfo = _artist.JsonClone(); newArtistInfo.Metadata = _artist.Metadata.Value.JsonClone(); - newArtistInfo.Books = _remoteAlbums; + newArtistInfo.Books = _remoteBooks; GivenNewArtistInfo(newArtistInfo); GivenAlbumsForRefresh(_albums); @@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.MusicTests { new MediaCover.MediaCover(MediaCover.MediaCoverTypes.Logo, "dummy") }; - newArtistInfo.Books = _remoteAlbums; + newArtistInfo.Books = _remoteBooks; GivenNewArtistInfo(newArtistInfo); GivenAlbumsForRefresh(new List()); @@ -189,7 +189,7 @@ namespace NzbDrone.Core.Test.MusicTests { var newArtistInfo = _artist.JsonClone(); newArtistInfo.Metadata = _artist.Metadata.Value.JsonClone(); - newArtistInfo.Books = _remoteAlbums; + newArtistInfo.Books = _remoteBooks; newArtistInfo.ForeignAuthorId = _artist.ForeignAuthorId + 1; newArtistInfo.Metadata.Value.Id = 100; @@ -242,7 +242,7 @@ namespace NzbDrone.Core.Test.MusicTests var newArtistInfo = clash.JsonClone(); newArtistInfo.Metadata = clash.Metadata.Value.JsonClone(); - newArtistInfo.Books = _remoteAlbums; + newArtistInfo.Books = _remoteBooks; GivenNewArtistInfo(newArtistInfo); diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 2d4567475..6f108137a 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -192,7 +192,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_parse_artist_name_and_album_title_by_search_criteria(string releaseTitle) { GivenSearchCriteria("Black Sabbath", "Black Sabbath"); - var parseResult = Parser.Parser.ParseAlbumTitleWithSearchCriteria(releaseTitle, _artist, _albums); + var parseResult = Parser.Parser.ParseBookTitleWithSearchCriteria(releaseTitle, _artist, _albums); parseResult.AuthorName.ToLowerInvariant().Should().Be("black sabbath"); parseResult.BookTitle.ToLowerInvariant().Should().Be("black sabbath"); } @@ -214,7 +214,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_not_parse_artist_name_and_album_title_by_incorrect_search_criteria() { GivenSearchCriteria("Abba", "Abba"); - var parseResult = Parser.Parser.ParseAlbumTitleWithSearchCriteria("Black Sabbath Black Sabbath FLAC", _artist, _albums); + var parseResult = Parser.Parser.ParseBookTitleWithSearchCriteria("Black Sabbath Black Sabbath FLAC", _artist, _albums); parseResult.Should().BeNull(); } @@ -228,7 +228,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_escape_albums(string artist, string album, string releaseTitle) { GivenSearchCriteria(artist, album); - var parseResult = Parser.Parser.ParseAlbumTitleWithSearchCriteria(releaseTitle, _artist, _albums); + var parseResult = Parser.Parser.ParseBookTitleWithSearchCriteria(releaseTitle, _artist, _albums); parseResult.BookTitle.Should().Be(album); } @@ -239,7 +239,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_escape_artists(string artist, string album, string releaseTitle) { GivenSearchCriteria(artist, album); - var parseResult = Parser.Parser.ParseAlbumTitleWithSearchCriteria(releaseTitle, _artist, _albums); + var parseResult = Parser.Parser.ParseBookTitleWithSearchCriteria(releaseTitle, _artist, _albums); parseResult.AuthorName.Should().Be(artist); } @@ -247,7 +247,7 @@ namespace NzbDrone.Core.Test.ParserTests public void should_match_with_accent_in_artist_and_album(string artist, string album, string releaseTitle) { GivenSearchCriteria(artist, album); - var parseResult = Parser.Parser.ParseAlbumTitleWithSearchCriteria(releaseTitle, _artist, _albums); + var parseResult = Parser.Parser.ParseBookTitleWithSearchCriteria(releaseTitle, _artist, _albums); parseResult.AuthorName.Should().Be("Michael Buble"); parseResult.BookTitle.Should().Be("Michael Buble"); } @@ -260,7 +260,7 @@ namespace NzbDrone.Core.Test.ParserTests GivenSearchCriteria("Michael Bubl\u00E9", "love"); GivenSearchCriteria("Michael Bubl\u00E9", "Christmas"); GivenSearchCriteria("Michael Bubl\u00E9", "To Be Loved"); - var parseResult = Parser.Parser.ParseAlbumTitleWithSearchCriteria( + var parseResult = Parser.Parser.ParseBookTitleWithSearchCriteria( "Michael Buble Christmas (Deluxe Special Edition) CD FLAC 2012 UNDERTONE iNT", _artist, _albums); parseResult.AuthorName.Should().Be("Michael Buble"); parseResult.BookTitle.Should().Be("Christmas"); diff --git a/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs b/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs index dbb7e51ff..af1d0d386 100644 --- a/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs +++ b/src/NzbDrone.Core.Test/QueueTests/QueueServiceFixture.cs @@ -34,7 +34,7 @@ namespace NzbDrone.Core.Test.QueueTests .With(e => e.AuthorId = artist.Id) .Build(); - var remoteAlbum = Builder.CreateNew() + var remoteBook = Builder.CreateNew() .With(r => r.Author = artist) .With(r => r.Books = new List(albums)) .With(r => r.ParsedBookInfo = new ParsedBookInfo()) @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Test.QueueTests _trackedDownloads = Builder.CreateListOfSize(1) .All() .With(v => v.DownloadItem = downloadItem) - .With(v => v.RemoteBook = remoteAlbum) + .With(v => v.RemoteBook = remoteBook) .Build() .ToList(); diff --git a/src/NzbDrone.Core/Books/Events/BookEditedEvent.cs b/src/NzbDrone.Core/Books/Events/BookEditedEvent.cs index 174466535..c0cf8090f 100644 --- a/src/NzbDrone.Core/Books/Events/BookEditedEvent.cs +++ b/src/NzbDrone.Core/Books/Events/BookEditedEvent.cs @@ -1,16 +1,16 @@ -using NzbDrone.Common.Messaging; +using NzbDrone.Common.Messaging; namespace NzbDrone.Core.Books.Events { public class BookEditedEvent : IEvent { public Book Book { get; private set; } - public Book OldAlbum { get; private set; } + public Book OldBook { get; private set; } - public BookEditedEvent(Book book, Book oldAlbum) + public BookEditedEvent(Book book, Book oldBook) { Book = book; - OldAlbum = oldAlbum; + OldBook = oldBook; } } } diff --git a/src/NzbDrone.Core/Books/Handlers/AuthorScannedHandler.cs b/src/NzbDrone.Core/Books/Handlers/AuthorScannedHandler.cs index c441fb965..896bf5f45 100644 --- a/src/NzbDrone.Core/Books/Handlers/AuthorScannedHandler.cs +++ b/src/NzbDrone.Core/Books/Handlers/AuthorScannedHandler.cs @@ -35,7 +35,7 @@ namespace NzbDrone.Core.Books _logger.Info("[{0}] was recently added, performing post-add actions", author.Name); _bookMonitoredService.SetBookMonitoredStatus(author, author.AddOptions); - if (author.AddOptions.SearchForMissingAlbums) + if (author.AddOptions.SearchForMissingBooks) { _commandQueueManager.Push(new MissingBookSearchCommand(author.Id)); } diff --git a/src/NzbDrone.Core/Books/Model/AddAuthorOptions.cs b/src/NzbDrone.Core/Books/Model/AddAuthorOptions.cs index b16cd6aef..70d2e94b4 100644 --- a/src/NzbDrone.Core/Books/Model/AddAuthorOptions.cs +++ b/src/NzbDrone.Core/Books/Model/AddAuthorOptions.cs @@ -2,6 +2,6 @@ namespace NzbDrone.Core.Books { public class AddAuthorOptions : MonitoringOptions { - public bool SearchForMissingAlbums { get; set; } + public bool SearchForMissingBooks { get; set; } } } diff --git a/src/NzbDrone.Core/Books/Model/AddBookOptions.cs b/src/NzbDrone.Core/Books/Model/AddBookOptions.cs index 6b2b6f451..4d2a6f08b 100644 --- a/src/NzbDrone.Core/Books/Model/AddBookOptions.cs +++ b/src/NzbDrone.Core/Books/Model/AddBookOptions.cs @@ -7,14 +7,14 @@ namespace NzbDrone.Core.Books public AddBookOptions() { // default in case not set in db - AddType = AlbumAddType.Automatic; + AddType = BookAddType.Automatic; } - public AlbumAddType AddType { get; set; } - public bool SearchForNewAlbum { get; set; } + public BookAddType AddType { get; set; } + public bool SearchForNewBook { get; set; } } - public enum AlbumAddType + public enum BookAddType { Automatic, Manual diff --git a/src/NzbDrone.Core/Books/Repositories/BookRepository.cs b/src/NzbDrone.Core/Books/Repositories/BookRepository.cs index f5d0e04ca..bb76f1149 100644 --- a/src/NzbDrone.Core/Books/Repositories/BookRepository.cs +++ b/src/NzbDrone.Core/Books/Repositories/BookRepository.cs @@ -26,7 +26,7 @@ namespace NzbDrone.Core.Books List AuthorBooksBetweenDates(Author author, DateTime startDate, DateTime endDate, bool includeUnmonitored); void SetMonitoredFlat(Book book, bool monitored); void SetMonitored(IEnumerable ids, bool monitored); - List GetArtistAlbumsWithFiles(Author author); + List GetAuthorBooksWithFiles(Author author); } public class BookRepository : BasicRepository, IBookRepository @@ -190,7 +190,7 @@ namespace NzbDrone.Core.Books .ExclusiveOrDefault(); } - public List GetArtistAlbumsWithFiles(Author author) + public List GetAuthorBooksWithFiles(Author author) { return Query(Builder() .Join((t, f) => t.Id == f.BookId) diff --git a/src/NzbDrone.Core/Books/Services/AddBookService.cs b/src/NzbDrone.Core/Books/Services/AddBookService.cs index 35ee14110..fd94a1429 100644 --- a/src/NzbDrone.Core/Books/Services/AddBookService.cs +++ b/src/NzbDrone.Core/Books/Services/AddBookService.cs @@ -51,7 +51,7 @@ namespace NzbDrone.Core.Books _importListExclusionService.Delete(book.AuthorMetadata.Value.ForeignAuthorId); // Note it's a manual addition so it's not deleted on next refresh - book.AddOptions.AddType = AlbumAddType.Manual; + book.AddOptions.AddType = BookAddType.Manual; // Add the author if necessary var dbAuthor = _authorService.FindById(book.AuthorMetadata.Value.ForeignAuthorId); diff --git a/src/NzbDrone.Core/Books/Services/BookAddedService.cs b/src/NzbDrone.Core/Books/Services/BookAddedService.cs index 79a5082b4..605a57c78 100644 --- a/src/NzbDrone.Core/Books/Services/BookAddedService.cs +++ b/src/NzbDrone.Core/Books/Services/BookAddedService.cs @@ -37,11 +37,11 @@ namespace NzbDrone.Core.Books public void SearchForRecentlyAdded(int authorId) { var allBooks = _bookService.GetBooksByAuthor(authorId); - var toSearch = allBooks.Where(x => x.AddOptions.SearchForNewAlbum).ToList(); + var toSearch = allBooks.Where(x => x.AddOptions.SearchForNewBook).ToList(); if (toSearch.Any()) { - toSearch.ForEach(x => x.AddOptions.SearchForNewAlbum = false); + toSearch.ForEach(x => x.AddOptions.SearchForNewBook = false); _bookService.SetAddOptions(toSearch); } diff --git a/src/NzbDrone.Core/Books/Services/BookService.cs b/src/NzbDrone.Core/Books/Services/BookService.cs index 2bb58cb24..566e30227 100644 --- a/src/NzbDrone.Core/Books/Services/BookService.cs +++ b/src/NzbDrone.Core/Books/Services/BookService.cs @@ -228,7 +228,7 @@ namespace NzbDrone.Core.Books public List GetAuthorBooksWithFiles(Author author) { - return _bookRepository.GetArtistAlbumsWithFiles(author); + return _bookRepository.GetAuthorBooksWithFiles(author); } public void InsertMany(List books) diff --git a/src/NzbDrone.Core/Books/Services/RefreshBookService.cs b/src/NzbDrone.Core/Books/Services/RefreshBookService.cs index eb1874012..17ce92fea 100644 --- a/src/NzbDrone.Core/Books/Services/RefreshBookService.cs +++ b/src/NzbDrone.Core/Books/Services/RefreshBookService.cs @@ -112,7 +112,7 @@ namespace NzbDrone.Core.Books protected override bool ShouldDelete(Book local) { // not manually added and has no files - return local.AddOptions.AddType != AlbumAddType.Manual && + return local.AddOptions.AddType != BookAddType.Manual && !_mediaFileService.GetFilesByBook(local.Id).Any(); } diff --git a/src/NzbDrone.Core/Books/Services/RefreshSeriesService.cs b/src/NzbDrone.Core/Books/Services/RefreshSeriesService.cs index d1150c071..bfcaee389 100644 --- a/src/NzbDrone.Core/Books/Services/RefreshSeriesService.cs +++ b/src/NzbDrone.Core/Books/Services/RefreshSeriesService.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Core.Books { public interface IRefreshSeriesService { - bool RefreshSeriesInfo(int authorMetadataId, List remoteAlbums, Author remoteData, bool forceAlbumRefresh, bool forceUpdateFileTags, DateTime? lastUpdate); + bool RefreshSeriesInfo(int authorMetadataId, List remoteBooks, Author remoteData, bool forceAlbumRefresh, bool forceUpdateFileTags, DateTime? lastUpdate); } public class RefreshSeriesService : RefreshEntityServiceBase, IRefreshSeriesService diff --git a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionComparer.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionComparer.cs index fc4faa90b..41d95bc6a 100644 --- a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionComparer.cs +++ b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionComparer.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Core.DecisionEngine ComparePreferredWordScore, CompareProtocol, ComparePeersIfTorrent, - CompareAlbumCount, + CompareBookCount, CompareAgeIfUsenet, CompareSize }; @@ -63,44 +63,44 @@ namespace NzbDrone.Core.DecisionEngine { if (_configService.DownloadPropersAndRepacks == ProperDownloadTypes.DoNotPrefer) { - return CompareAll(CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.Author.QualityProfile.Value.GetIndex(remoteAlbum.ParsedBookInfo.Quality.Quality)), - CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.ParsedBookInfo.Quality.Revision.Real)); + return CompareAll(CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.Author.QualityProfile.Value.GetIndex(remoteBook.ParsedBookInfo.Quality.Quality)), + CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.ParsedBookInfo.Quality.Revision.Real)); } - return CompareAll(CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.Author.QualityProfile.Value.GetIndex(remoteAlbum.ParsedBookInfo.Quality.Quality)), - CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.ParsedBookInfo.Quality.Revision.Real), - CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.ParsedBookInfo.Quality.Revision.Version)); + return CompareAll(CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.Author.QualityProfile.Value.GetIndex(remoteBook.ParsedBookInfo.Quality.Quality)), + CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.ParsedBookInfo.Quality.Revision.Real), + CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.ParsedBookInfo.Quality.Revision.Version)); } private int ComparePreferredWordScore(DownloadDecision x, DownloadDecision y) { - return CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.PreferredWordScore); + return CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.PreferredWordScore); } private int CompareProtocol(DownloadDecision x, DownloadDecision y) { - var result = CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => + var result = CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => { - var delayProfile = _delayProfileService.BestForTags(remoteAlbum.Author.Tags); - var downloadProtocol = remoteAlbum.Release.DownloadProtocol; + var delayProfile = _delayProfileService.BestForTags(remoteBook.Author.Tags); + var downloadProtocol = remoteBook.Release.DownloadProtocol; return downloadProtocol == delayProfile.PreferredProtocol; }); return result; } - private int CompareAlbumCount(DownloadDecision x, DownloadDecision y) + private int CompareBookCount(DownloadDecision x, DownloadDecision y) { var discographyCompare = CompareBy(x.RemoteBook, y.RemoteBook, - remoteAlbum => remoteAlbum.ParsedBookInfo.Discography); + remoteBook => remoteBook.ParsedBookInfo.Discography); if (discographyCompare != 0) { return discographyCompare; } - return CompareByReverse(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.Books.Count); + return CompareByReverse(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.Books.Count); } private int ComparePeersIfTorrent(DownloadDecision x, DownloadDecision y) @@ -114,15 +114,15 @@ namespace NzbDrone.Core.DecisionEngine } return CompareAll( - CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => + CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => { - var seeders = TorrentInfo.GetSeeders(remoteAlbum.Release); + var seeders = TorrentInfo.GetSeeders(remoteBook.Release); return seeders.HasValue && seeders.Value > 0 ? Math.Round(Math.Log10(seeders.Value)) : 0; }), - CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => + CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => { - var peers = TorrentInfo.GetPeers(remoteAlbum.Release); + var peers = TorrentInfo.GetPeers(remoteBook.Release); return peers.HasValue && peers.Value > 0 ? Math.Round(Math.Log10(peers.Value)) : 0; })); @@ -136,10 +136,10 @@ namespace NzbDrone.Core.DecisionEngine return 0; } - return CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => + return CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => { - var ageHours = remoteAlbum.Release.AgeHours; - var age = remoteAlbum.Release.Age; + var ageHours = remoteBook.Release.AgeHours; + var age = remoteBook.Release.Age; if (ageHours < 1) { @@ -163,7 +163,7 @@ namespace NzbDrone.Core.DecisionEngine private int CompareSize(DownloadDecision x, DownloadDecision y) { // TODO: Is smaller better? Smaller for usenet could mean no par2 files. - return CompareBy(x.RemoteBook, y.RemoteBook, remoteAlbum => remoteAlbum.Release.Size.Round(200.Megabytes())); + return CompareBy(x.RemoteBook, y.RemoteBook, remoteBook => remoteBook.Release.Size.Round(200.Megabytes())); } } } diff --git a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs index b6b758a27..480669754 100644 --- a/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs +++ b/src/NzbDrone.Core/DecisionEngine/DownloadDecisionMaker.cs @@ -23,12 +23,12 @@ namespace NzbDrone.Core.DecisionEngine { private readonly IEnumerable _specifications; private readonly IParsingService _parsingService; - private readonly IRemoteAlbumAggregationService _aggregationService; + private readonly IRemoteBookAggregationService _aggregationService; private readonly Logger _logger; public DownloadDecisionMaker(IEnumerable specifications, IParsingService parsingService, - IRemoteAlbumAggregationService aggregationService, + IRemoteBookAggregationService aggregationService, Logger logger) { _specifications = specifications; @@ -39,15 +39,15 @@ namespace NzbDrone.Core.DecisionEngine public List GetRssDecision(List reports) { - return GetAlbumDecisions(reports).ToList(); + return GetBookDecisions(reports).ToList(); } public List GetSearchDecision(List reports, SearchCriteriaBase searchCriteriaBase) { - return GetAlbumDecisions(reports, searchCriteriaBase).ToList(); + return GetBookDecisions(reports, searchCriteriaBase).ToList(); } - private IEnumerable GetAlbumDecisions(List reports, SearchCriteriaBase searchCriteria = null) + private IEnumerable GetBookDecisions(List reports, SearchCriteriaBase searchCriteria = null) { if (reports.Any()) { @@ -74,7 +74,7 @@ namespace NzbDrone.Core.DecisionEngine { if (searchCriteria != null) { - parsedBookInfo = Parser.Parser.ParseAlbumTitleWithSearchCriteria(report.Title, + parsedBookInfo = Parser.Parser.ParseBookTitleWithSearchCriteria(report.Title, searchCriteria.Author, searchCriteria.Books); } @@ -95,13 +95,13 @@ namespace NzbDrone.Core.DecisionEngine if ((remoteBook.Author == null || remoteBook.Books.Empty()) && searchCriteria != null) { _logger.Debug("Author/Book null for {0}, reparsing with search criteria", report.Title); - var parsedAlbumInfoWithCriteria = Parser.Parser.ParseAlbumTitleWithSearchCriteria(report.Title, + var parsedBookInfoWithCriteria = Parser.Parser.ParseBookTitleWithSearchCriteria(report.Title, searchCriteria.Author, searchCriteria.Books); - if (parsedAlbumInfoWithCriteria != null && parsedAlbumInfoWithCriteria.AuthorName.IsNotNullOrWhiteSpace()) + if (parsedBookInfoWithCriteria != null && parsedBookInfoWithCriteria.AuthorName.IsNotNullOrWhiteSpace()) { - remoteBook = _parsingService.Map(parsedAlbumInfoWithCriteria, searchCriteria); + remoteBook = _parsingService.Map(parsedBookInfoWithCriteria, searchCriteria); } } diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs index 5f8f7a6ce..a36490403 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/QueueSpecification.cs @@ -41,7 +41,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications foreach (var queueItem in matchingAlbum) { - var remoteAlbum = queueItem.RemoteBook; + var remoteBook = queueItem.RemoteBook; var qualityProfile = subject.Author.QualityProfile.Value; // To avoid a race make sure it's not FailedPending (failed awaiting removal/search). @@ -52,34 +52,34 @@ namespace NzbDrone.Core.DecisionEngine.Specifications continue; } - _logger.Debug("Checking if existing release in queue meets cutoff. Queued quality is: {0}", remoteAlbum.ParsedBookInfo.Quality); + _logger.Debug("Checking if existing release in queue meets cutoff. Queued quality is: {0}", remoteBook.ParsedBookInfo.Quality); var queuedItemPreferredWordScore = _preferredWordServiceCalculator.Calculate(subject.Author, queueItem.Title); if (!_upgradableSpecification.CutoffNotMet(qualityProfile, - new List { remoteAlbum.ParsedBookInfo.Quality }, + new List { remoteBook.ParsedBookInfo.Quality }, queuedItemPreferredWordScore, subject.ParsedBookInfo.Quality, subject.PreferredWordScore)) { - return Decision.Reject("Release in queue already meets cutoff: {0}", remoteAlbum.ParsedBookInfo.Quality); + return Decision.Reject("Release in queue already meets cutoff: {0}", remoteBook.ParsedBookInfo.Quality); } - _logger.Debug("Checking if release is higher quality than queued release. Queued: {0}", remoteAlbum.ParsedBookInfo.Quality); + _logger.Debug("Checking if release is higher quality than queued release. Queued: {0}", remoteBook.ParsedBookInfo.Quality); if (!_upgradableSpecification.IsUpgradable(qualityProfile, - new List { remoteAlbum.ParsedBookInfo.Quality }, + new List { remoteBook.ParsedBookInfo.Quality }, queuedItemPreferredWordScore, subject.ParsedBookInfo.Quality, subject.PreferredWordScore)) { - return Decision.Reject("Release in queue is of equal or higher preference: {0}", remoteAlbum.ParsedBookInfo.Quality); + return Decision.Reject("Release in queue is of equal or higher preference: {0}", remoteBook.ParsedBookInfo.Quality); } - _logger.Debug("Checking if profiles allow upgrading. Queued: {0}", remoteAlbum.ParsedBookInfo.Quality); + _logger.Debug("Checking if profiles allow upgrading. Queued: {0}", remoteBook.ParsedBookInfo.Quality); if (!_upgradableSpecification.IsUpgradeAllowed(qualityProfile, - new List { remoteAlbum.ParsedBookInfo.Quality }, + new List { remoteBook.ParsedBookInfo.Quality }, subject.ParsedBookInfo.Quality)) { return Decision.Reject("Another release is queued and the Quality profile does not allow upgrades"); diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredAlbumSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredBookSpecification.cs similarity index 70% rename from src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredAlbumSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredBookSpecification.cs index 4caf91b37..f88178d5b 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredAlbumSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/MonitoredBookSpecification.cs @@ -5,11 +5,11 @@ using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync { - public class MonitoredAlbumSpecification : IDecisionEngineSpecification + public class MonitoredBookSpecification : IDecisionEngineSpecification { private readonly Logger _logger; - public MonitoredAlbumSpecification(Logger logger) + public MonitoredBookSpecification(Logger logger) { _logger = logger; } @@ -42,20 +42,20 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync if (subject.Books.Count == 1) { - _logger.Debug("Album is not monitored. Rejecting", monitoredCount, subject.Books.Count); - return Decision.Reject("Album is not monitored"); + _logger.Debug("Book is not monitored. Rejecting", monitoredCount, subject.Books.Count); + return Decision.Reject("Book is not monitored"); } if (monitoredCount == 0) { - _logger.Debug("No albums in the release are monitored. Rejecting", monitoredCount, subject.Books.Count); + _logger.Debug("No books in the release are monitored. Rejecting", monitoredCount, subject.Books.Count); } else { - _logger.Debug("Only {0}/{1} albums in the release are monitored. Rejecting", monitoredCount, subject.Books.Count); + _logger.Debug("Only {0}/{1} books in the release are monitored. Rejecting", monitoredCount, subject.Books.Count); } - return Decision.Reject("Album is not monitored"); + return Decision.Reject("Book is not monitored"); } } } diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/Search/AuthorSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/AuthorSpecification.cs index c7d661c83..94aa06322 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/Search/AuthorSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/AuthorSpecification.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search public SpecificationPriority Priority => SpecificationPriority.Default; public RejectionType Type => RejectionType.Permanent; - public Decision IsSatisfiedBy(RemoteBook remoteAlbum, SearchCriteriaBase searchCriteria) + public Decision IsSatisfiedBy(RemoteBook remoteBook, SearchCriteriaBase searchCriteria) { if (searchCriteria == null) { @@ -25,9 +25,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search _logger.Debug("Checking if author matches searched author"); - if (remoteAlbum.Author.Id != searchCriteria.Author.Id) + if (remoteBook.Author.Id != searchCriteria.Author.Id) { - _logger.Debug("Author {0} does not match {1}", remoteAlbum.Author, searchCriteria.Author); + _logger.Debug("Author {0} does not match {1}", remoteBook.Author, searchCriteria.Author); return Decision.Reject("Wrong author"); } diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/Search/AlbumRequestedSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/BookRequestedSpecification.cs similarity index 54% rename from src/NzbDrone.Core/DecisionEngine/Specifications/Search/AlbumRequestedSpecification.cs rename to src/NzbDrone.Core/DecisionEngine/Specifications/Search/BookRequestedSpecification.cs index b19ca8440..0351c8e6a 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/Search/AlbumRequestedSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/Search/BookRequestedSpecification.cs @@ -5,11 +5,11 @@ using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.DecisionEngine.Specifications.Search { - public class AlbumRequestedSpecification : IDecisionEngineSpecification + public class BookRequestedSpecification : IDecisionEngineSpecification { private readonly Logger _logger; - public AlbumRequestedSpecification(Logger logger) + public BookRequestedSpecification(Logger logger) { _logger = logger; } @@ -17,20 +17,20 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.Search public SpecificationPriority Priority => SpecificationPriority.Default; public RejectionType Type => RejectionType.Permanent; - public Decision IsSatisfiedBy(RemoteBook remoteAlbum, SearchCriteriaBase searchCriteria) + public Decision IsSatisfiedBy(RemoteBook remoteBook, SearchCriteriaBase searchCriteria) { if (searchCriteria == null) { return Decision.Accept(); } - var criteriaAlbum = searchCriteria.Books.Select(v => v.Id).ToList(); - var remoteAlbums = remoteAlbum.Books.Select(v => v.Id).ToList(); + var criteriaBook = searchCriteria.Books.Select(v => v.Id).ToList(); + var remoteBooks = remoteBook.Books.Select(v => v.Id).ToList(); - if (!criteriaAlbum.Intersect(remoteAlbums).Any()) + if (!criteriaBook.Intersect(remoteBooks).Any()) { - _logger.Debug("Release rejected since the book wasn't requested: {0}", remoteAlbum.ParsedBookInfo); - return Decision.Reject("Album wasn't requested"); + _logger.Debug("Release rejected since the book wasn't requested: {0}", remoteBook.ParsedBookInfo); + return Decision.Reject("Book wasn't requested"); } return Decision.Accept(); diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/TorrentSeedingSpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/TorrentSeedingSpecification.cs index de157c92c..53313042e 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/TorrentSeedingSpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/TorrentSeedingSpecification.cs @@ -20,9 +20,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications public SpecificationPriority Priority => SpecificationPriority.Default; public RejectionType Type => RejectionType.Permanent; - public Decision IsSatisfiedBy(RemoteBook remoteAlbum, SearchCriteriaBase searchCriteria) + public Decision IsSatisfiedBy(RemoteBook remoteBook, SearchCriteriaBase searchCriteria) { - var torrentInfo = remoteAlbum.Release as TorrentInfo; + var torrentInfo = remoteBook.Release as TorrentInfo; if (torrentInfo == null || torrentInfo.IndexerId == 0) { diff --git a/src/NzbDrone.Core/Download/Aggregation/Aggregators/AggregatePreferredWordScore.cs b/src/NzbDrone.Core/Download/Aggregation/Aggregators/AggregatePreferredWordScore.cs index 9f93b78b0..1055d981b 100644 --- a/src/NzbDrone.Core/Download/Aggregation/Aggregators/AggregatePreferredWordScore.cs +++ b/src/NzbDrone.Core/Download/Aggregation/Aggregators/AggregatePreferredWordScore.cs @@ -3,7 +3,7 @@ using NzbDrone.Core.Profiles.Releases; namespace NzbDrone.Core.Download.Aggregation.Aggregators { - public class AggregatePreferredWordScore : IAggregateRemoteAlbum + public class AggregatePreferredWordScore : IAggregateRemoteBook { private readonly IPreferredWordService _preferredWordServiceCalculator; @@ -12,11 +12,11 @@ namespace NzbDrone.Core.Download.Aggregation.Aggregators _preferredWordServiceCalculator = preferredWordServiceCalculator; } - public RemoteBook Aggregate(RemoteBook remoteAlbum) + public RemoteBook Aggregate(RemoteBook remoteBook) { - remoteAlbum.PreferredWordScore = _preferredWordServiceCalculator.Calculate(remoteAlbum.Author, remoteAlbum.Release.Title); + remoteBook.PreferredWordScore = _preferredWordServiceCalculator.Calculate(remoteBook.Author, remoteBook.Release.Title); - return remoteAlbum; + return remoteBook; } } } diff --git a/src/NzbDrone.Core/Download/Aggregation/Aggregators/IAggregateRemoteAlbum.cs b/src/NzbDrone.Core/Download/Aggregation/Aggregators/IAggregateRemoteBook.cs similarity index 52% rename from src/NzbDrone.Core/Download/Aggregation/Aggregators/IAggregateRemoteAlbum.cs rename to src/NzbDrone.Core/Download/Aggregation/Aggregators/IAggregateRemoteBook.cs index 1d4cce43e..0ab57a139 100644 --- a/src/NzbDrone.Core/Download/Aggregation/Aggregators/IAggregateRemoteAlbum.cs +++ b/src/NzbDrone.Core/Download/Aggregation/Aggregators/IAggregateRemoteBook.cs @@ -2,8 +2,8 @@ using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Download.Aggregation.Aggregators { - public interface IAggregateRemoteAlbum + public interface IAggregateRemoteBook { - RemoteBook Aggregate(RemoteBook remoteAlbum); + RemoteBook Aggregate(RemoteBook remoteBook); } } diff --git a/src/NzbDrone.Core/Download/Aggregation/RemoteAlbumAggregationService.cs b/src/NzbDrone.Core/Download/Aggregation/RemoteBookAggregationService.cs similarity index 58% rename from src/NzbDrone.Core/Download/Aggregation/RemoteAlbumAggregationService.cs rename to src/NzbDrone.Core/Download/Aggregation/RemoteBookAggregationService.cs index e9860eb29..e8c7ac085 100644 --- a/src/NzbDrone.Core/Download/Aggregation/RemoteAlbumAggregationService.cs +++ b/src/NzbDrone.Core/Download/Aggregation/RemoteBookAggregationService.cs @@ -6,30 +6,30 @@ using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.Download.Aggregation { - public interface IRemoteAlbumAggregationService + public interface IRemoteBookAggregationService { - RemoteBook Augment(RemoteBook remoteAlbum); + RemoteBook Augment(RemoteBook remoteBook); } - public class RemoteAlbumAggregationService : IRemoteAlbumAggregationService + public class RemoteBookAggregationService : IRemoteBookAggregationService { - private readonly IEnumerable _augmenters; + private readonly IEnumerable _augmenters; private readonly Logger _logger; - public RemoteAlbumAggregationService(IEnumerable augmenters, + public RemoteBookAggregationService(IEnumerable augmenters, Logger logger) { _augmenters = augmenters; _logger = logger; } - public RemoteBook Augment(RemoteBook remoteAlbum) + public RemoteBook Augment(RemoteBook remoteBook) { foreach (var augmenter in _augmenters) { try { - augmenter.Aggregate(remoteAlbum); + augmenter.Aggregate(remoteBook); } catch (Exception ex) { @@ -37,7 +37,7 @@ namespace NzbDrone.Core.Download.Aggregation } } - return remoteAlbum; + return remoteBook; } } } diff --git a/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs b/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs index 0b8740ff7..18e06eaf7 100644 --- a/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs @@ -37,14 +37,14 @@ namespace NzbDrone.Core.Download.Clients.Blackhole ScanGracePeriod = TimeSpan.FromSeconds(30); } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { if (!Settings.SaveMagnetFiles) { throw new NotSupportedException("Blackhole does not support magnet links."); } - var title = remoteAlbum.Release.Title; + var title = remoteBook.Release.Title; title = FileNameBuilder.CleanFileName(title); @@ -61,9 +61,9 @@ namespace NzbDrone.Core.Download.Clients.Blackhole return null; } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { - var title = remoteAlbum.Release.Title; + var title = remoteBook.Release.Title; title = FileNameBuilder.CleanFileName(title); diff --git a/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs b/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs index f0e5b24e0..7e5ab3715 100644 --- a/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs @@ -33,9 +33,9 @@ namespace NzbDrone.Core.Download.Clients.Blackhole ScanGracePeriod = TimeSpan.FromSeconds(30); } - protected override string AddFromNzbFile(RemoteBook remoteAlbum, string filename, byte[] fileContent) + protected override string AddFromNzbFile(RemoteBook remoteBook, string filename, byte[] fileContent) { - var title = remoteAlbum.Release.Title; + var title = remoteBook.Release.Title; title = FileNameBuilder.CleanFileName(title); diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs index 411fa950e..ec4d93f6e 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs @@ -50,7 +50,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge } } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { var actualHash = _proxy.AddTorrentFromMagnet(magnetLink, Settings); @@ -59,17 +59,17 @@ namespace NzbDrone.Core.Download.Clients.Deluge throw new DownloadClientException("Deluge failed to add magnet " + magnetLink); } - _proxy.SetTorrentSeedingConfiguration(actualHash, remoteAlbum.SeedConfiguration, Settings); + _proxy.SetTorrentSeedingConfiguration(actualHash, remoteBook.SeedConfiguration, Settings); if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) { _proxy.SetTorrentLabel(actualHash, Settings.MusicCategory, Settings); } - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)DelugePriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)DelugePriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)DelugePriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)DelugePriority.First)) { _proxy.MoveTorrentToTopInQueue(actualHash, Settings); } @@ -77,7 +77,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge return actualHash.ToUpper(); } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { var actualHash = _proxy.AddTorrentFromFile(filename, fileContent, Settings); @@ -86,17 +86,17 @@ namespace NzbDrone.Core.Download.Clients.Deluge throw new DownloadClientException("Deluge failed to add torrent " + filename); } - _proxy.SetTorrentSeedingConfiguration(actualHash, remoteAlbum.SeedConfiguration, Settings); + _proxy.SetTorrentSeedingConfiguration(actualHash, remoteBook.SeedConfiguration, Settings); if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) { _proxy.SetTorrentLabel(actualHash, Settings.MusicCategory, Settings); } - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)DelugePriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)DelugePriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)DelugePriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)DelugePriority.First)) { _proxy.MoveTorrentToTopInQueue(actualHash, Settings); } diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs index b663469cc..ade7b0257 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -154,7 +154,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation return finalPath; } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings); @@ -164,7 +164,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation if (item != null) { - _logger.Debug("{0} added correctly", remoteAlbum); + _logger.Debug("{0} added correctly", remoteBook); return CreateDownloadId(item.Id, hashedSerialNumber); } @@ -173,7 +173,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation throw new DownloadClientException("Failed to add magnet task to Download Station"); } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings); @@ -185,7 +185,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation if (item != null) { - _logger.Debug("{0} added correctly", remoteAlbum); + _logger.Debug("{0} added correctly", remoteBook); return CreateDownloadId(item.Id, hashedSerialNumber); } diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index e3c078de6..be853f6d9 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -167,7 +167,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation _logger.Debug("{0} removed correctly", downloadId); } - protected override string AddFromNzbFile(RemoteBook remoteAlbum, string filename, byte[] fileContent) + protected override string AddFromNzbFile(RemoteBook remoteBook, string filename, byte[] fileContent) { var hashedSerialNumber = _serialNumberProvider.GetSerialNumber(Settings); @@ -179,7 +179,7 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation if (item != null) { - _logger.Debug("{0} added correctly", remoteAlbum); + _logger.Debug("{0} added correctly", remoteBook); return CreateDownloadId(item.Id, hashedSerialNumber); } diff --git a/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs b/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs index d2f400c08..912a4d451 100644 --- a/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs +++ b/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs @@ -137,14 +137,14 @@ namespace NzbDrone.Core.Download.Clients.Hadouken failures.AddIfNotNull(TestGetTorrents()); } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { _proxy.AddTorrentUri(Settings, magnetLink); return hash.ToUpper(); } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { return _proxy.AddTorrentFile(Settings, fileContent).ToUpper(); } diff --git a/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs b/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs index a4171a1ad..7b7c31c85 100644 --- a/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs +++ b/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs @@ -30,9 +30,9 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex _proxy = proxy; } - protected override string AddFromNzbFile(RemoteBook remoteAlbum, string filename, byte[] fileContent) + protected override string AddFromNzbFile(RemoteBook remoteBook, string filename, byte[] fileContent) { - var priority = remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority; + var priority = remoteBook.IsRecentBook() ? Settings.RecentTvPriority : Settings.OlderTvPriority; var response = _proxy.DownloadNzb(fileContent, filename, priority, Settings); diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index 997edd341..d2dc680c3 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -34,17 +34,17 @@ namespace NzbDrone.Core.Download.Clients.Nzbget _proxy = proxy; } - protected override string AddFromNzbFile(RemoteBook remoteAlbum, string filename, byte[] fileContent) + protected override string AddFromNzbFile(RemoteBook remoteBook, string filename, byte[] fileContent) { var category = Settings.MusicCategory; - var priority = remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority; + var priority = remoteBook.IsRecentBook() ? Settings.RecentTvPriority : Settings.OlderTvPriority; var addpaused = Settings.AddPaused; var response = _proxy.DownloadNzb(fileContent, filename, category, priority, addpaused, Settings); if (response == null) { - throw new DownloadClientRejectedReleaseException(remoteAlbum.Release, "NZBGet rejected the NZB for an unknown reason"); + throw new DownloadClientRejectedReleaseException(remoteBook.Release, "NZBGet rejected the NZB for an unknown reason"); } return response; diff --git a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs index e722dddc0..e9d9a9030 100644 --- a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs +++ b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs @@ -32,12 +32,12 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic public override DownloadProtocol Protocol => DownloadProtocol.Usenet; - public override string Download(RemoteBook remoteAlbum) + public override string Download(RemoteBook remoteBook) { - var url = remoteAlbum.Release.DownloadUrl; - var title = remoteAlbum.Release.Title; + var url = remoteBook.Release.DownloadUrl; + var title = remoteBook.Release.Title; - if (remoteAlbum.ParsedBookInfo.Discography) + if (remoteBook.ParsedBookInfo.Discography) { throw new NotSupportedException("Discography releases are not supported with Pneumatic."); } diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs index f500469f9..501931a35 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -62,7 +62,7 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent } } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { if (!Proxy.GetConfig(Settings).DhtEnabled && !magnetLink.Contains("&tr=")) { @@ -71,34 +71,34 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent Proxy.AddTorrentFromUrl(magnetLink, Settings); - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)QBittorrentPriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)QBittorrentPriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)QBittorrentPriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)QBittorrentPriority.First)) { Proxy.MoveTorrentToTopInQueue(hash.ToLower(), Settings); } SetInitialState(hash.ToLower()); - if (remoteAlbum.SeedConfiguration != null && (remoteAlbum.SeedConfiguration.Ratio.HasValue || remoteAlbum.SeedConfiguration.SeedTime.HasValue)) + if (remoteBook.SeedConfiguration != null && (remoteBook.SeedConfiguration.Ratio.HasValue || remoteBook.SeedConfiguration.SeedTime.HasValue)) { - Proxy.SetTorrentSeedingConfiguration(hash.ToLower(), remoteAlbum.SeedConfiguration, Settings); + Proxy.SetTorrentSeedingConfiguration(hash.ToLower(), remoteBook.SeedConfiguration, Settings); } return hash; } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { Proxy.AddTorrentFromFile(filename, fileContent, Settings); try { - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)QBittorrentPriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)QBittorrentPriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)QBittorrentPriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)QBittorrentPriority.First)) { Proxy.MoveTorrentToTopInQueue(hash.ToLower(), Settings); } @@ -110,9 +110,9 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent SetInitialState(hash.ToLower()); - if (remoteAlbum.SeedConfiguration != null && (remoteAlbum.SeedConfiguration.Ratio.HasValue || remoteAlbum.SeedConfiguration.SeedTime.HasValue)) + if (remoteBook.SeedConfiguration != null && (remoteBook.SeedConfiguration.Ratio.HasValue || remoteBook.SeedConfiguration.SeedTime.HasValue)) { - Proxy.SetTorrentSeedingConfiguration(hash.ToLower(), remoteAlbum.SeedConfiguration, Settings); + Proxy.SetTorrentSeedingConfiguration(hash.ToLower(), remoteBook.SeedConfiguration, Settings); } return hash; diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index b798e34aa..56cffd61e 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -34,16 +34,16 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd // patch can be a number (releases) or 'x' (git) private static readonly Regex VersionRegex = new Regex(@"(?\d+)\.(?\d+)\.(?\d+|x)", RegexOptions.Compiled); - protected override string AddFromNzbFile(RemoteBook remoteAlbum, string filename, byte[] fileContent) + protected override string AddFromNzbFile(RemoteBook remoteBook, string filename, byte[] fileContent) { var category = Settings.MusicCategory; - var priority = remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority; + var priority = remoteBook.IsRecentBook() ? Settings.RecentTvPriority : Settings.OlderTvPriority; var response = _proxy.DownloadNzb(fileContent, filename, category, priority, Settings); if (response == null || response.Ids.Empty()) { - throw new DownloadClientRejectedReleaseException(remoteAlbum.Release, "SABnzbd rejected the NZB for an unknown reason"); + throw new DownloadClientRejectedReleaseException(remoteBook.Release, "SABnzbd rejected the NZB for an unknown reason"); } return response.Ids.First(); diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs index 45f73cb59..07d35d810 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs @@ -179,15 +179,15 @@ namespace NzbDrone.Core.Download.Clients.Transmission }; } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { _proxy.AddTorrentFromUrl(magnetLink, GetDownloadDirectory(), Settings); - _proxy.SetTorrentSeedingConfiguration(hash, remoteAlbum.SeedConfiguration, Settings); + _proxy.SetTorrentSeedingConfiguration(hash, remoteBook.SeedConfiguration, Settings); - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)TransmissionPriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)TransmissionPriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)TransmissionPriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)TransmissionPriority.First)) { _proxy.MoveTorrentToTopInQueue(hash, Settings); } @@ -195,15 +195,15 @@ namespace NzbDrone.Core.Download.Clients.Transmission return hash; } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { _proxy.AddTorrentFromData(fileContent, GetDownloadDirectory(), Settings); - _proxy.SetTorrentSeedingConfiguration(hash, remoteAlbum.SeedConfiguration, Settings); + _proxy.SetTorrentSeedingConfiguration(hash, remoteBook.SeedConfiguration, Settings); - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)TransmissionPriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)TransmissionPriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)TransmissionPriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)TransmissionPriority.First)) { _proxy.MoveTorrentToTopInQueue(hash, Settings); } diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs index 5da8aee94..758e96612 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs @@ -57,9 +57,9 @@ namespace NzbDrone.Core.Download.Clients.RTorrent } } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { - var priority = (RTorrentPriority)(remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority); + var priority = (RTorrentPriority)(remoteBook.IsRecentBook() ? Settings.RecentTvPriority : Settings.OlderTvPriority); _proxy.AddTorrentFromUrl(magnetLink, Settings.MusicCategory, priority, Settings.MusicDirectory, Settings); @@ -77,9 +77,9 @@ namespace NzbDrone.Core.Download.Clients.RTorrent return hash; } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { - var priority = (RTorrentPriority)(remoteAlbum.IsRecentAlbum() ? Settings.RecentTvPriority : Settings.OlderTvPriority); + var priority = (RTorrentPriority)(remoteBook.IsRecentBook() ? Settings.RecentTvPriority : Settings.OlderTvPriority); _proxy.AddTorrentFromFile(filename, fileContent, Settings.MusicCategory, priority, Settings.MusicDirectory, Settings); @@ -89,7 +89,7 @@ namespace NzbDrone.Core.Download.Clients.RTorrent { _logger.Debug("rTorrent didn't add the torrent within {0} seconds: {1}.", tries * retryDelay / 1000, filename); - throw new ReleaseDownloadException(remoteAlbum.Release, "Downloading torrent failed"); + throw new ReleaseDownloadException(remoteBook.Release, "Downloading torrent failed"); } return hash; diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs index 41ec5fd71..c7c0911e5 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs @@ -52,20 +52,20 @@ namespace NzbDrone.Core.Download.Clients.UTorrent } } - protected override string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink) { _proxy.AddTorrentFromUrl(magnetLink, Settings); - _proxy.SetTorrentSeedingConfiguration(hash, remoteAlbum.SeedConfiguration, Settings); + _proxy.SetTorrentSeedingConfiguration(hash, remoteBook.SeedConfiguration, Settings); if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) { _proxy.SetTorrentLabel(hash, Settings.MusicCategory, Settings); } - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)UTorrentPriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)UTorrentPriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)UTorrentPriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)UTorrentPriority.First)) { _proxy.MoveTorrentToTopInQueue(hash, Settings); } @@ -75,20 +75,20 @@ namespace NzbDrone.Core.Download.Clients.UTorrent return hash; } - protected override string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent) + protected override string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent) { _proxy.AddTorrentFromFile(filename, fileContent, Settings); - _proxy.SetTorrentSeedingConfiguration(hash, remoteAlbum.SeedConfiguration, Settings); + _proxy.SetTorrentSeedingConfiguration(hash, remoteBook.SeedConfiguration, Settings); if (Settings.MusicCategory.IsNotNullOrWhiteSpace()) { _proxy.SetTorrentLabel(hash, Settings.MusicCategory, Settings); } - var isRecentAlbum = remoteAlbum.IsRecentAlbum(); + var isRecentBook = remoteBook.IsRecentBook(); - if ((isRecentAlbum && Settings.RecentTvPriority == (int)UTorrentPriority.First) || - (!isRecentAlbum && Settings.OlderTvPriority == (int)UTorrentPriority.First)) + if ((isRecentBook && Settings.RecentTvPriority == (int)UTorrentPriority.First) || + (!isRecentBook && Settings.OlderTvPriority == (int)UTorrentPriority.First)) { _proxy.MoveTorrentToTopInQueue(hash, Settings); } diff --git a/src/NzbDrone.Core/Download/DownloadClientBase.cs b/src/NzbDrone.Core/Download/DownloadClientBase.cs index 6ec983e39..fefd88d30 100644 --- a/src/NzbDrone.Core/Download/DownloadClientBase.cs +++ b/src/NzbDrone.Core/Download/DownloadClientBase.cs @@ -60,7 +60,7 @@ namespace NzbDrone.Core.Download get; } - public abstract string Download(RemoteBook remoteAlbum); + public abstract string Download(RemoteBook remoteBook); public abstract IEnumerable GetItems(); public abstract void RemoveItem(string downloadId, bool deleteData); public abstract DownloadClientInfo GetStatus(); diff --git a/src/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs index ab8d6de2c..0718dc484 100644 --- a/src/NzbDrone.Core/Download/DownloadService.cs +++ b/src/NzbDrone.Core/Download/DownloadService.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Download { public interface IDownloadService { - void DownloadReport(RemoteBook remoteAlbum); + void DownloadReport(RemoteBook remoteBook); } public class DownloadService : IDownloadService @@ -45,39 +45,39 @@ namespace NzbDrone.Core.Download _logger = logger; } - public void DownloadReport(RemoteBook remoteAlbum) + public void DownloadReport(RemoteBook remoteBook) { - Ensure.That(remoteAlbum.Author, () => remoteAlbum.Author).IsNotNull(); - Ensure.That(remoteAlbum.Books, () => remoteAlbum.Books).HasItems(); + Ensure.That(remoteBook.Author, () => remoteBook.Author).IsNotNull(); + Ensure.That(remoteBook.Books, () => remoteBook.Books).HasItems(); - var downloadTitle = remoteAlbum.Release.Title; - var downloadClient = _downloadClientProvider.GetDownloadClient(remoteAlbum.Release.DownloadProtocol); + var downloadTitle = remoteBook.Release.Title; + var downloadClient = _downloadClientProvider.GetDownloadClient(remoteBook.Release.DownloadProtocol); if (downloadClient == null) { - throw new DownloadClientUnavailableException($"{remoteAlbum.Release.DownloadProtocol} Download client isn't configured yet"); + throw new DownloadClientUnavailableException($"{remoteBook.Release.DownloadProtocol} Download client isn't configured yet"); } // Get the seed configuration for this release. - remoteAlbum.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteAlbum); + remoteBook.SeedConfiguration = _seedConfigProvider.GetSeedConfiguration(remoteBook); // Limit grabs to 2 per second. - if (remoteAlbum.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteAlbum.Release.DownloadUrl.StartsWith("magnet:")) + if (remoteBook.Release.DownloadUrl.IsNotNullOrWhiteSpace() && !remoteBook.Release.DownloadUrl.StartsWith("magnet:")) { - var url = new HttpUri(remoteAlbum.Release.DownloadUrl); + var url = new HttpUri(remoteBook.Release.DownloadUrl); _rateLimitService.WaitAndPulse(url.Host, TimeSpan.FromSeconds(2)); } string downloadClientId; try { - downloadClientId = downloadClient.Download(remoteAlbum); + downloadClientId = downloadClient.Download(remoteBook); _downloadClientStatusService.RecordSuccess(downloadClient.Definition.Id); - _indexerStatusService.RecordSuccess(remoteAlbum.Release.IndexerId); + _indexerStatusService.RecordSuccess(remoteBook.Release.IndexerId); } catch (ReleaseUnavailableException) { - _logger.Trace("Release {0} no longer available on indexer.", remoteAlbum); + _logger.Trace("Release {0} no longer available on indexer.", remoteBook); throw; } catch (ReleaseDownloadException ex) @@ -85,17 +85,17 @@ namespace NzbDrone.Core.Download var http429 = ex.InnerException as TooManyRequestsException; if (http429 != null) { - _indexerStatusService.RecordFailure(remoteAlbum.Release.IndexerId, http429.RetryAfter); + _indexerStatusService.RecordFailure(remoteBook.Release.IndexerId, http429.RetryAfter); } else { - _indexerStatusService.RecordFailure(remoteAlbum.Release.IndexerId); + _indexerStatusService.RecordFailure(remoteBook.Release.IndexerId); } throw; } - var albumGrabbedEvent = new BookGrabbedEvent(remoteAlbum); + var albumGrabbedEvent = new BookGrabbedEvent(remoteBook); albumGrabbedEvent.DownloadClient = downloadClient.Name; if (!string.IsNullOrWhiteSpace(downloadClientId)) diff --git a/src/NzbDrone.Core/Download/IDownloadClient.cs b/src/NzbDrone.Core/Download/IDownloadClient.cs index afee811bc..4ddaab6a1 100644 --- a/src/NzbDrone.Core/Download/IDownloadClient.cs +++ b/src/NzbDrone.Core/Download/IDownloadClient.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Core.Download { DownloadProtocol Protocol { get; } - string Download(RemoteBook remoteAlbum); + string Download(RemoteBook remoteBook); IEnumerable GetItems(); void RemoveItem(string downloadId, bool deleteData); DownloadClientInfo GetStatus(); diff --git a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs index 60fa59008..f0d3ac819 100644 --- a/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs +++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseService.cs @@ -345,10 +345,10 @@ namespace NzbDrone.Core.Download.Pending p.Release.Indexer == release.Indexer; } - private int GetDelay(RemoteBook remoteAlbum) + private int GetDelay(RemoteBook remoteBook) { - var delayProfile = _delayProfileService.AllForTags(remoteAlbum.Author.Tags).OrderBy(d => d.Order).First(); - var delay = delayProfile.GetProtocolDelay(remoteAlbum.Release.DownloadProtocol); + var delayProfile = _delayProfileService.AllForTags(remoteBook.Author.Tags).OrderBy(d => d.Order).First(); + var delay = delayProfile.GetProtocolDelay(remoteBook.Release.DownloadProtocol); var minimumAge = _configService.MinimumAge; return new[] { delay, minimumAge }.Max(); diff --git a/src/NzbDrone.Core/Download/ProcessDownloadDecisions.cs b/src/NzbDrone.Core/Download/ProcessDownloadDecisions.cs index b1322fe66..1cd1aea0c 100644 --- a/src/NzbDrone.Core/Download/ProcessDownloadDecisions.cs +++ b/src/NzbDrone.Core/Download/ProcessDownloadDecisions.cs @@ -50,7 +50,7 @@ namespace NzbDrone.Core.Download foreach (var report in prioritizedDecisions) { - var remoteAlbum = report.RemoteBook; + var remoteBook = report.RemoteBook; var downloadProtocol = report.RemoteBook.Release.DownloadProtocol; //Skip if already grabbed @@ -74,19 +74,19 @@ namespace NzbDrone.Core.Download try { - _downloadService.DownloadReport(remoteAlbum); + _downloadService.DownloadReport(remoteBook); grabbed.Add(report); } catch (ReleaseUnavailableException) { - _logger.Warn("Failed to download release from indexer, no longer available. " + remoteAlbum); + _logger.Warn("Failed to download release from indexer, no longer available. " + remoteBook); rejected.Add(report); } catch (Exception ex) { if (ex is DownloadClientUnavailableException || ex is DownloadClientAuthenticationException) { - _logger.Debug(ex, "Failed to send release to download client, storing until later. " + remoteAlbum); + _logger.Debug(ex, "Failed to send release to download client, storing until later. " + remoteBook); PreparePending(pendingAddQueue, grabbed, pending, report, PendingReleaseReason.DownloadClientUnavailable); if (downloadProtocol == DownloadProtocol.Usenet) @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Download } else { - _logger.Warn(ex, "Couldn't add report to download queue. " + remoteAlbum); + _logger.Warn(ex, "Couldn't add report to download queue. " + remoteBook); } } } diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index 9f9d5c5d1..54181bf00 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -38,23 +38,23 @@ namespace NzbDrone.Core.Download public virtual bool PreferTorrentFile => false; - protected abstract string AddFromMagnetLink(RemoteBook remoteAlbum, string hash, string magnetLink); - protected abstract string AddFromTorrentFile(RemoteBook remoteAlbum, string hash, string filename, byte[] fileContent); + protected abstract string AddFromMagnetLink(RemoteBook remoteBook, string hash, string magnetLink); + protected abstract string AddFromTorrentFile(RemoteBook remoteBook, string hash, string filename, byte[] fileContent); - public override string Download(RemoteBook remoteAlbum) + public override string Download(RemoteBook remoteBook) { - var torrentInfo = remoteAlbum.Release as TorrentInfo; + var torrentInfo = remoteBook.Release as TorrentInfo; string magnetUrl = null; string torrentUrl = null; - if (remoteAlbum.Release.DownloadUrl.IsNotNullOrWhiteSpace() && remoteAlbum.Release.DownloadUrl.StartsWith("magnet:")) + if (remoteBook.Release.DownloadUrl.IsNotNullOrWhiteSpace() && remoteBook.Release.DownloadUrl.StartsWith("magnet:")) { - magnetUrl = remoteAlbum.Release.DownloadUrl; + magnetUrl = remoteBook.Release.DownloadUrl; } else { - torrentUrl = remoteAlbum.Release.DownloadUrl; + torrentUrl = remoteBook.Release.DownloadUrl; } if (torrentInfo != null && !torrentInfo.MagnetUrl.IsNullOrWhiteSpace()) @@ -68,7 +68,7 @@ namespace NzbDrone.Core.Download { try { - return DownloadFromWebUrl(remoteAlbum, torrentUrl); + return DownloadFromWebUrl(remoteBook, torrentUrl); } catch (Exception ex) { @@ -85,11 +85,11 @@ namespace NzbDrone.Core.Download { try { - return DownloadFromMagnetUrl(remoteAlbum, magnetUrl); + return DownloadFromMagnetUrl(remoteBook, magnetUrl); } catch (NotSupportedException ex) { - throw new ReleaseDownloadException(remoteAlbum.Release, "Magnet not supported by download client. ({0})", ex.Message); + throw new ReleaseDownloadException(remoteBook.Release, "Magnet not supported by download client. ({0})", ex.Message); } } } @@ -99,13 +99,13 @@ namespace NzbDrone.Core.Download { try { - return DownloadFromMagnetUrl(remoteAlbum, magnetUrl); + return DownloadFromMagnetUrl(remoteBook, magnetUrl); } catch (NotSupportedException ex) { if (torrentUrl.IsNullOrWhiteSpace()) { - throw new ReleaseDownloadException(remoteAlbum.Release, "Magnet not supported by download client. ({0})", ex.Message); + throw new ReleaseDownloadException(remoteBook.Release, "Magnet not supported by download client. ({0})", ex.Message); } _logger.Debug("Magnet not supported by download client, trying torrent. ({0})", ex.Message); @@ -114,14 +114,14 @@ namespace NzbDrone.Core.Download if (torrentUrl.IsNotNullOrWhiteSpace()) { - return DownloadFromWebUrl(remoteAlbum, torrentUrl); + return DownloadFromWebUrl(remoteBook, torrentUrl); } } return null; } - private string DownloadFromWebUrl(RemoteBook remoteAlbum, string torrentUrl) + private string DownloadFromWebUrl(RemoteBook remoteBook, string torrentUrl) { byte[] torrentFile = null; @@ -145,10 +145,10 @@ namespace NzbDrone.Core.Download { if (locationHeader.StartsWith("magnet:")) { - return DownloadFromMagnetUrl(remoteAlbum, locationHeader); + return DownloadFromMagnetUrl(remoteBook, locationHeader); } - return DownloadFromWebUrl(remoteAlbum, locationHeader); + return DownloadFromWebUrl(remoteBook, locationHeader); } throw new WebException("Remote website tried to redirect without providing a location."); @@ -156,14 +156,14 @@ namespace NzbDrone.Core.Download torrentFile = response.ResponseData; - _logger.Debug("Downloading torrent for release '{0}' finished ({1} bytes from {2})", remoteAlbum.Release.Title, torrentFile.Length, torrentUrl); + _logger.Debug("Downloading torrent for release '{0}' finished ({1} bytes from {2})", remoteBook.Release.Title, torrentFile.Length, torrentUrl); } catch (HttpException ex) { if (ex.Response.StatusCode == HttpStatusCode.NotFound) { - _logger.Error(ex, "Downloading torrent file for book '{0}' failed since it no longer exists ({1})", remoteAlbum.Release.Title, torrentUrl); - throw new ReleaseUnavailableException(remoteAlbum.Release, "Downloading torrent failed", ex); + _logger.Error(ex, "Downloading torrent file for book '{0}' failed since it no longer exists ({1})", remoteBook.Release.Title, torrentUrl); + throw new ReleaseUnavailableException(remoteBook.Release, "Downloading torrent failed", ex); } if ((int)ex.Response.StatusCode == 429) @@ -172,34 +172,34 @@ namespace NzbDrone.Core.Download } else { - _logger.Error(ex, "Downloading torrent file for release '{0}' failed ({1})", remoteAlbum.Release.Title, torrentUrl); + _logger.Error(ex, "Downloading torrent file for release '{0}' failed ({1})", remoteBook.Release.Title, torrentUrl); } - throw new ReleaseDownloadException(remoteAlbum.Release, "Downloading torrent failed", ex); + throw new ReleaseDownloadException(remoteBook.Release, "Downloading torrent failed", ex); } catch (WebException ex) { - _logger.Error(ex, "Downloading torrent file for release '{0}' failed ({1})", remoteAlbum.Release.Title, torrentUrl); + _logger.Error(ex, "Downloading torrent file for release '{0}' failed ({1})", remoteBook.Release.Title, torrentUrl); - throw new ReleaseDownloadException(remoteAlbum.Release, "Downloading torrent failed", ex); + throw new ReleaseDownloadException(remoteBook.Release, "Downloading torrent failed", ex); } - var filename = string.Format("{0}.torrent", FileNameBuilder.CleanFileName(remoteAlbum.Release.Title)); + var filename = string.Format("{0}.torrent", FileNameBuilder.CleanFileName(remoteBook.Release.Title)); var hash = _torrentFileInfoReader.GetHashFromTorrentFile(torrentFile); - var actualHash = AddFromTorrentFile(remoteAlbum, hash, filename, torrentFile); + var actualHash = AddFromTorrentFile(remoteBook, hash, filename, torrentFile); if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash) { _logger.Debug( "{0} did not return the expected InfoHash for '{1}', Readarr could potentially lose track of the download in progress.", Definition.Implementation, - remoteAlbum.Release.DownloadUrl); + remoteBook.Release.DownloadUrl); } return actualHash; } - private string DownloadFromMagnetUrl(RemoteBook remoteAlbum, string magnetUrl) + private string DownloadFromMagnetUrl(RemoteBook remoteBook, string magnetUrl) { string hash = null; string actualHash = null; @@ -210,14 +210,14 @@ namespace NzbDrone.Core.Download } catch (FormatException ex) { - _logger.Error(ex, "Failed to parse magnetlink for release '{0}': '{1}'", remoteAlbum.Release.Title, magnetUrl); + _logger.Error(ex, "Failed to parse magnetlink for release '{0}': '{1}'", remoteBook.Release.Title, magnetUrl); return null; } if (hash != null) { - actualHash = AddFromMagnetLink(remoteAlbum, hash, magnetUrl); + actualHash = AddFromMagnetLink(remoteBook, hash, magnetUrl); } if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash) @@ -225,7 +225,7 @@ namespace NzbDrone.Core.Download _logger.Debug( "{0} did not return the expected InfoHash for '{1}', Readarr could potentially lose track of the download in progress.", Definition.Implementation, - remoteAlbum.Release.DownloadUrl); + remoteBook.Release.DownloadUrl); } return actualHash; diff --git a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs index 0c3ac9e75..5ed6ac903 100644 --- a/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs +++ b/src/NzbDrone.Core/Download/TrackedDownloads/TrackedDownloadService.cs @@ -58,12 +58,12 @@ namespace NzbDrone.Core.Download.TrackedDownloads foreach (var item in updateCacheItems) { - var parsedAlbumInfo = Parser.Parser.ParseBookTitle(item.DownloadItem.Title); + var parsedBookInfo = Parser.Parser.ParseBookTitle(item.DownloadItem.Title); item.RemoteBook = null; - if (parsedAlbumInfo != null) + if (parsedBookInfo != null) { - item.RemoteBook = _parsingService.Map(parsedAlbumInfo); + item.RemoteBook = _parsingService.Map(parsedBookInfo); } } @@ -175,7 +175,7 @@ namespace NzbDrone.Core.Download.TrackedDownloads else { parsedBookInfo = - Parser.Parser.ParseAlbumTitleWithSearchCriteria(firstHistoryItem.SourceTitle, + Parser.Parser.ParseBookTitleWithSearchCriteria(firstHistoryItem.SourceTitle, historyAuthor, historyBooks); diff --git a/src/NzbDrone.Core/Download/UsenetClientBase.cs b/src/NzbDrone.Core/Download/UsenetClientBase.cs index 75a32a3af..f9e8ecaa9 100644 --- a/src/NzbDrone.Core/Download/UsenetClientBase.cs +++ b/src/NzbDrone.Core/Download/UsenetClientBase.cs @@ -33,12 +33,12 @@ namespace NzbDrone.Core.Download public override DownloadProtocol Protocol => DownloadProtocol.Usenet; - protected abstract string AddFromNzbFile(RemoteBook remoteAlbum, string filename, byte[] fileContent); + protected abstract string AddFromNzbFile(RemoteBook remoteBook, string filename, byte[] fileContent); - public override string Download(RemoteBook remoteAlbum) + public override string Download(RemoteBook remoteBook) { - var url = remoteAlbum.Release.DownloadUrl; - var filename = FileNameBuilder.CleanFileName(remoteAlbum.Release.Title) + ".nzb"; + var url = remoteBook.Release.DownloadUrl; + var filename = FileNameBuilder.CleanFileName(remoteBook.Release.Title) + ".nzb"; byte[] nzbData; @@ -47,21 +47,21 @@ namespace NzbDrone.Core.Download var nzbDataRequest = new HttpRequest(url); // TODO: Look into moving download request handling to indexer - if (remoteAlbum.Release.BasicAuthString.IsNotNullOrWhiteSpace()) + if (remoteBook.Release.BasicAuthString.IsNotNullOrWhiteSpace()) { - nzbDataRequest.Headers.Set("Authorization", "Basic " + remoteAlbum.Release.BasicAuthString); + nzbDataRequest.Headers.Set("Authorization", "Basic " + remoteBook.Release.BasicAuthString); } nzbData = _httpClient.Get(nzbDataRequest).ResponseData; - _logger.Debug("Downloaded nzb for release '{0}' finished ({1} bytes from {2})", remoteAlbum.Release.Title, nzbData.Length, url); + _logger.Debug("Downloaded nzb for release '{0}' finished ({1} bytes from {2})", remoteBook.Release.Title, nzbData.Length, url); } catch (HttpException ex) { if (ex.Response.StatusCode == HttpStatusCode.NotFound) { - _logger.Error(ex, "Downloading nzb file for book '{0}' failed since it no longer exists ({1})", remoteAlbum.Release.Title, url); - throw new ReleaseUnavailableException(remoteAlbum.Release, "Downloading torrent failed", ex); + _logger.Error(ex, "Downloading nzb file for book '{0}' failed since it no longer exists ({1})", remoteBook.Release.Title, url); + throw new ReleaseUnavailableException(remoteBook.Release, "Downloading torrent failed", ex); } if ((int)ex.Response.StatusCode == 429) @@ -70,22 +70,22 @@ namespace NzbDrone.Core.Download } else { - _logger.Error(ex, "Downloading nzb for release '{0}' failed ({1})", remoteAlbum.Release.Title, url); + _logger.Error(ex, "Downloading nzb for release '{0}' failed ({1})", remoteBook.Release.Title, url); } - throw new ReleaseDownloadException(remoteAlbum.Release, "Downloading nzb failed", ex); + throw new ReleaseDownloadException(remoteBook.Release, "Downloading nzb failed", ex); } catch (WebException ex) { - _logger.Error(ex, "Downloading nzb for release '{0}' failed ({1})", remoteAlbum.Release.Title, url); + _logger.Error(ex, "Downloading nzb for release '{0}' failed ({1})", remoteBook.Release.Title, url); - throw new ReleaseDownloadException(remoteAlbum.Release, "Downloading nzb failed", ex); + throw new ReleaseDownloadException(remoteBook.Release, "Downloading nzb failed", ex); } _nzbValidationService.Validate(filename, nzbData); - _logger.Info("Adding report [{0}] to the queue.", remoteAlbum.Release.Title); - return AddFromNzbFile(remoteAlbum, filename, nzbData); + _logger.Info("Adding report [{0}] to the queue.", remoteBook.Release.Title); + return AddFromNzbFile(remoteBook, filename, nzbData); } } } diff --git a/src/NzbDrone.Core/Extras/ExtraService.cs b/src/NzbDrone.Core/Extras/ExtraService.cs index b2c293743..255f6ef67 100644 --- a/src/NzbDrone.Core/Extras/ExtraService.cs +++ b/src/NzbDrone.Core/Extras/ExtraService.cs @@ -124,7 +124,7 @@ namespace NzbDrone.Core.Extras { foreach (var extraFileManager in _extraFileManagers) { - extraFileManager.CreateAfterTrackImport(author, bookFile); + extraFileManager.CreateAfterBookImport(author, bookFile); } } diff --git a/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs b/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs index 31980f474..cbc74c54e 100644 --- a/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs +++ b/src/NzbDrone.Core/Extras/Files/ExtraFileManager.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Extras.Files { int Order { get; } IEnumerable CreateAfterAuthorScan(Author author, List bookFiles); - IEnumerable CreateAfterTrackImport(Author author, BookFile bookFile); + IEnumerable CreateAfterBookImport(Author author, BookFile bookFile); IEnumerable CreateAfterBookImport(Author author, Book book, string authorFolder, string bookFolder); IEnumerable MoveFilesAfterRename(Author author, List bookFiles); ExtraFile Import(Author author, BookFile bookFile, string path, string extension, bool readOnly); @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Extras.Files public abstract int Order { get; } public abstract IEnumerable CreateAfterAuthorScan(Author author, List bookFiles); - public abstract IEnumerable CreateAfterTrackImport(Author author, BookFile bookFile); + public abstract IEnumerable CreateAfterBookImport(Author author, BookFile bookFile); public abstract IEnumerable CreateAfterBookImport(Author author, Book book, string authorFolder, string albumFolder); public abstract IEnumerable MoveFilesAfterRename(Author author, List bookFiles); public abstract ExtraFile Import(Author author, BookFile bookFile, string path, string extension, bool readOnly); diff --git a/src/NzbDrone.Core/Extras/Files/ExtraFileService.cs b/src/NzbDrone.Core/Extras/Files/ExtraFileService.cs index aedf65945..4822f4040 100644 --- a/src/NzbDrone.Core/Extras/Files/ExtraFileService.cs +++ b/src/NzbDrone.Core/Extras/Files/ExtraFileService.cs @@ -16,8 +16,8 @@ namespace NzbDrone.Core.Extras.Files public interface IExtraFileService where TExtraFile : ExtraFile, new() { - List GetFilesByArtist(int authorId); - List GetFilesByTrackFile(int trackFileId); + List GetFilesByAuthor(int authorId); + List GetFilesByBookFile(int bookFileId); TExtraFile FindByPath(string path); void Upsert(TExtraFile extraFile); void Upsert(List extraFiles); @@ -49,14 +49,14 @@ namespace NzbDrone.Core.Extras.Files _logger = logger; } - public List GetFilesByArtist(int authorId) + public List GetFilesByAuthor(int authorId) { return _repository.GetFilesByAuthor(authorId); } - public List GetFilesByTrackFile(int trackFileId) + public List GetFilesByBookFile(int bookFileId) { - return _repository.GetFilesByBookFile(trackFileId); + return _repository.GetFilesByBookFile(bookFileId); } public TExtraFile FindByPath(string path) diff --git a/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs b/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs index 0c8f3688e..ae82b8a5d 100644 --- a/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs +++ b/src/NzbDrone.Core/Extras/ImportExistingExtraFilesBase.cs @@ -23,7 +23,7 @@ namespace NzbDrone.Core.Extras public virtual ImportExistingExtraFileFilterResult FilterAndClean(Author author, List filesOnDisk, List importedFiles) { - var authorFiles = _extraFileService.GetFilesByArtist(author.Id); + var authorFiles = _extraFileService.GetFilesByAuthor(author.Id); Clean(author, filesOnDisk, importedFiles, authorFiles); diff --git a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs index 3f0005053..4039b382f 100644 --- a/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs +++ b/src/NzbDrone.Core/Extras/Metadata/ExistingMetadataImporter.cs @@ -54,20 +54,20 @@ namespace NzbDrone.Core.Extras.Metadata continue; } - if (metadata.Type == MetadataType.AlbumImage || metadata.Type == MetadataType.AlbumMetadata) + if (metadata.Type == MetadataType.BookImage || metadata.Type == MetadataType.BookMetadata) { var localAlbum = _parsingService.GetLocalAlbum(possibleMetadataFile, author); if (localAlbum == null) { - _logger.Debug("Extra file folder has multiple Albums: {0}", possibleMetadataFile); + _logger.Debug("Extra file folder has multiple Books: {0}", possibleMetadataFile); continue; } metadata.BookId = localAlbum.Id; } - if (metadata.Type == MetadataType.TrackMetadata) + if (metadata.Type == MetadataType.BookMetadata) { var localTrack = new LocalBook { diff --git a/src/NzbDrone.Core/Extras/Metadata/Files/CleanMetadataFileService.cs b/src/NzbDrone.Core/Extras/Metadata/Files/CleanMetadataFileService.cs index 496d2ceeb..88fb35cf8 100644 --- a/src/NzbDrone.Core/Extras/Metadata/Files/CleanMetadataFileService.cs +++ b/src/NzbDrone.Core/Extras/Metadata/Files/CleanMetadataFileService.cs @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Extras.Metadata.Files { _logger.Debug("Cleaning missing metadata files for author: {0}", author.Name); - var metadataFiles = _metadataFileService.GetFilesByArtist(author.Id); + var metadataFiles = _metadataFileService.GetFilesByAuthor(author.Id); foreach (var metadataFile in metadataFiles) { diff --git a/src/NzbDrone.Core/Extras/Metadata/IMetadata.cs b/src/NzbDrone.Core/Extras/Metadata/IMetadata.cs index 93d074d3d..7d3f1033a 100644 --- a/src/NzbDrone.Core/Extras/Metadata/IMetadata.cs +++ b/src/NzbDrone.Core/Extras/Metadata/IMetadata.cs @@ -11,11 +11,9 @@ namespace NzbDrone.Core.Extras.Metadata string GetFilenameAfterMove(Author author, BookFile bookFile, MetadataFile metadataFile); string GetFilenameAfterMove(Author author, string albumPath, MetadataFile metadataFile); MetadataFile FindMetadataFile(Author author, string path); - MetadataFileResult ArtistMetadata(Author author); - MetadataFileResult AlbumMetadata(Author author, Book book, string albumPath); - MetadataFileResult TrackMetadata(Author author, BookFile bookFile); - List ArtistImages(Author author); - List AlbumImages(Author author, Book book, string albumPath); - List TrackImages(Author author, BookFile bookFile); + MetadataFileResult AuthorMetadata(Author author); + MetadataFileResult BookMetadata(Author author, BookFile bookFile); + List AuthorImages(Author author); + List BookImages(Author author, BookFile bookFile); } } diff --git a/src/NzbDrone.Core/Extras/Metadata/MetadataBase.cs b/src/NzbDrone.Core/Extras/Metadata/MetadataBase.cs index 4d84c9125..b415994ba 100644 --- a/src/NzbDrone.Core/Extras/Metadata/MetadataBase.cs +++ b/src/NzbDrone.Core/Extras/Metadata/MetadataBase.cs @@ -46,12 +46,10 @@ namespace NzbDrone.Core.Extras.Metadata public abstract MetadataFile FindMetadataFile(Author author, string path); - public abstract MetadataFileResult ArtistMetadata(Author author); - public abstract MetadataFileResult AlbumMetadata(Author author, Book book, string albumPath); - public abstract MetadataFileResult TrackMetadata(Author author, BookFile bookFile); - public abstract List ArtistImages(Author author); - public abstract List AlbumImages(Author author, Book book, string albumPath); - public abstract List TrackImages(Author author, BookFile bookFile); + public abstract MetadataFileResult AuthorMetadata(Author author); + public abstract MetadataFileResult BookMetadata(Author author, BookFile bookFile); + public abstract List AuthorImages(Author author); + public abstract List BookImages(Author author, BookFile bookFile); public virtual object RequestAction(string action, IDictionary query) { diff --git a/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs b/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs index e7bcfb590..90ba59969 100644 --- a/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs +++ b/src/NzbDrone.Core/Extras/Metadata/MetadataService.cs @@ -61,7 +61,7 @@ namespace NzbDrone.Core.Extras.Metadata public override IEnumerable CreateAfterAuthorScan(Author author, List bookFiles) { - var metadataFiles = _metadataFileService.GetFilesByArtist(author.Id); + var metadataFiles = _metadataFileService.GetFilesByAuthor(author.Id); _cleanMetadataService.Clean(author); if (!_diskProvider.FolderExists(author.Path)) @@ -76,22 +76,12 @@ namespace NzbDrone.Core.Extras.Metadata { var consumerFiles = GetMetadataFilesForConsumer(consumer, metadataFiles); - files.AddIfNotNull(ProcessArtistMetadata(consumer, author, consumerFiles)); - files.AddRange(ProcessArtistImages(consumer, author, consumerFiles)); + files.AddIfNotNull(ProcessAuthorMetadata(consumer, author, consumerFiles)); + files.AddRange(ProcessAuthorImages(consumer, author, consumerFiles)); - var albumGroups = bookFiles.GroupBy(s => Path.GetDirectoryName(s.Path)).ToList(); - - foreach (var group in albumGroups) + foreach (var bookFile in bookFiles) { - var book = _bookService.GetBook(group.First().BookId); - var albumFolder = group.Key; - files.AddIfNotNull(ProcessAlbumMetadata(consumer, author, book, albumFolder, consumerFiles)); - files.AddRange(ProcessAlbumImages(consumer, author, book, albumFolder, consumerFiles)); - - foreach (var bookFile in group) - { - files.AddIfNotNull(ProcessTrackMetadata(consumer, author, bookFile, consumerFiles)); - } + files.AddIfNotNull(ProcessBookMetadata(consumer, author, bookFile, consumerFiles)); } } @@ -100,13 +90,13 @@ namespace NzbDrone.Core.Extras.Metadata return files; } - public override IEnumerable CreateAfterTrackImport(Author author, BookFile bookFile) + public override IEnumerable CreateAfterBookImport(Author author, BookFile bookFile) { var files = new List(); foreach (var consumer in _metadataFactory.Enabled()) { - files.AddIfNotNull(ProcessTrackMetadata(consumer, author, bookFile, new List())); + files.AddIfNotNull(ProcessBookMetadata(consumer, author, bookFile, new List())); } _metadataFileService.Upsert(files); @@ -114,11 +104,11 @@ namespace NzbDrone.Core.Extras.Metadata return files; } - public override IEnumerable CreateAfterBookImport(Author author, Book book, string artistFolder, string albumFolder) + public override IEnumerable CreateAfterBookImport(Author author, Book book, string authorFolder, string albumFolder) { - var metadataFiles = _metadataFileService.GetFilesByArtist(author.Id); + var metadataFiles = _metadataFileService.GetFilesByAuthor(author.Id); - if (artistFolder.IsNullOrWhiteSpace() && albumFolder.IsNullOrWhiteSpace()) + if (authorFolder.IsNullOrWhiteSpace() && albumFolder.IsNullOrWhiteSpace()) { return new List(); } @@ -129,10 +119,10 @@ namespace NzbDrone.Core.Extras.Metadata { var consumerFiles = GetMetadataFilesForConsumer(consumer, metadataFiles); - if (artistFolder.IsNotNullOrWhiteSpace()) + if (authorFolder.IsNotNullOrWhiteSpace()) { - files.AddIfNotNull(ProcessArtistMetadata(consumer, author, consumerFiles)); - files.AddRange(ProcessArtistImages(consumer, author, consumerFiles)); + files.AddIfNotNull(ProcessAuthorMetadata(consumer, author, consumerFiles)); + files.AddRange(ProcessAuthorImages(consumer, author, consumerFiles)); } } @@ -143,7 +133,7 @@ namespace NzbDrone.Core.Extras.Metadata public override IEnumerable MoveFilesAfterRename(Author author, List bookFiles) { - var metadataFiles = _metadataFileService.GetFilesByArtist(author.Id); + var metadataFiles = _metadataFileService.GetFilesByAuthor(author.Id); var movedFiles = new List(); var distinctTrackFilePaths = bookFiles.DistinctBy(s => Path.GetDirectoryName(s.Path)).ToList(); @@ -155,7 +145,7 @@ namespace NzbDrone.Core.Extras.Metadata { var metadataFilesForConsumer = GetMetadataFilesForConsumer(consumer, metadataFiles) .Where(m => m.BookId == filePath.BookId) - .Where(m => m.Type == MetadataType.AlbumImage || m.Type == MetadataType.AlbumMetadata) + .Where(m => m.Type == MetadataType.BookImage || m.Type == MetadataType.BookMetadata) .ToList(); foreach (var metadataFile in metadataFilesForConsumer) @@ -220,9 +210,9 @@ namespace NzbDrone.Core.Extras.Metadata return artistMetadata.Where(c => c.Consumer == consumer.GetType().Name).ToList(); } - private MetadataFile ProcessArtistMetadata(IMetadata consumer, Author author, List existingMetadataFiles) + private MetadataFile ProcessAuthorMetadata(IMetadata consumer, Author author, List existingMetadataFiles) { - var artistMetadata = consumer.ArtistMetadata(author); + var artistMetadata = consumer.AuthorMetadata(author); if (artistMetadata == null) { @@ -231,12 +221,12 @@ namespace NzbDrone.Core.Extras.Metadata var hash = artistMetadata.Contents.SHA256Hash(); - var metadata = GetMetadataFile(author, existingMetadataFiles, e => e.Type == MetadataType.ArtistMetadata) ?? + var metadata = GetMetadataFile(author, existingMetadataFiles, e => e.Type == MetadataType.AuthorMetadata) ?? new MetadataFile { AuthorId = author.Id, Consumer = consumer.GetType().Name, - Type = MetadataType.ArtistMetadata + Type = MetadataType.AuthorMetadata }; if (hash == metadata.Hash) @@ -265,55 +255,9 @@ namespace NzbDrone.Core.Extras.Metadata return metadata; } - private MetadataFile ProcessAlbumMetadata(IMetadata consumer, Author author, Book book, string albumPath, List existingMetadataFiles) + private MetadataFile ProcessBookMetadata(IMetadata consumer, Author author, BookFile bookFile, List existingMetadataFiles) { - var albumMetadata = consumer.AlbumMetadata(author, book, albumPath); - - if (albumMetadata == null) - { - return null; - } - - var hash = albumMetadata.Contents.SHA256Hash(); - - var metadata = GetMetadataFile(author, existingMetadataFiles, e => e.Type == MetadataType.AlbumMetadata && e.BookId == book.Id) ?? - new MetadataFile - { - AuthorId = author.Id, - BookId = book.Id, - Consumer = consumer.GetType().Name, - Type = MetadataType.AlbumMetadata - }; - - if (hash == metadata.Hash) - { - if (albumMetadata.RelativePath != metadata.RelativePath) - { - metadata.RelativePath = albumMetadata.RelativePath; - - return metadata; - } - - return null; - } - - var fullPath = Path.Combine(author.Path, albumMetadata.RelativePath); - - _otherExtraFileRenamer.RenameOtherExtraFile(author, fullPath); - - _logger.Debug("Writing Album Metadata to: {0}", fullPath); - SaveMetadataFile(fullPath, albumMetadata.Contents); - - metadata.Hash = hash; - metadata.RelativePath = albumMetadata.RelativePath; - metadata.Extension = Path.GetExtension(fullPath); - - return metadata; - } - - private MetadataFile ProcessTrackMetadata(IMetadata consumer, Author author, BookFile bookFile, List existingMetadataFiles) - { - var trackMetadata = consumer.TrackMetadata(author, bookFile); + var trackMetadata = consumer.BookMetadata(author, bookFile); if (trackMetadata == null) { @@ -324,7 +268,7 @@ namespace NzbDrone.Core.Extras.Metadata _otherExtraFileRenamer.RenameOtherExtraFile(author, fullPath); - var existingMetadata = GetMetadataFile(author, existingMetadataFiles, c => c.Type == MetadataType.TrackMetadata && + var existingMetadata = GetMetadataFile(author, existingMetadataFiles, c => c.Type == MetadataType.BookMetadata && c.BookFileId == bookFile.Id); if (existingMetadata != null) @@ -346,7 +290,7 @@ namespace NzbDrone.Core.Extras.Metadata BookId = bookFile.BookId, BookFileId = bookFile.Id, Consumer = consumer.GetType().Name, - Type = MetadataType.TrackMetadata, + Type = MetadataType.BookMetadata, RelativePath = trackMetadata.RelativePath, Extension = Path.GetExtension(fullPath) }; @@ -364,11 +308,11 @@ namespace NzbDrone.Core.Extras.Metadata return metadata; } - private List ProcessArtistImages(IMetadata consumer, Author author, List existingMetadataFiles) + private List ProcessAuthorImages(IMetadata consumer, Author author, List existingMetadataFiles) { var result = new List(); - foreach (var image in consumer.ArtistImages(author)) + foreach (var image in consumer.AuthorImages(author)) { var fullPath = Path.Combine(author.Path, image.RelativePath); @@ -380,13 +324,13 @@ namespace NzbDrone.Core.Extras.Metadata _otherExtraFileRenamer.RenameOtherExtraFile(author, fullPath); - var metadata = GetMetadataFile(author, existingMetadataFiles, c => c.Type == MetadataType.ArtistImage && + var metadata = GetMetadataFile(author, existingMetadataFiles, c => c.Type == MetadataType.AuthorImage && c.RelativePath == image.RelativePath) ?? new MetadataFile { AuthorId = author.Id, Consumer = consumer.GetType().Name, - Type = MetadataType.ArtistImage, + Type = MetadataType.AuthorImage, RelativePath = image.RelativePath, Extension = Path.GetExtension(fullPath) }; @@ -399,43 +343,6 @@ namespace NzbDrone.Core.Extras.Metadata return result; } - private List ProcessAlbumImages(IMetadata consumer, Author author, Book book, string albumFolder, List existingMetadataFiles) - { - var result = new List(); - - foreach (var image in consumer.AlbumImages(author, book, albumFolder)) - { - var fullPath = Path.Combine(author.Path, image.RelativePath); - - if (_diskProvider.FileExists(fullPath)) - { - _logger.Debug("Album image already exists: {0}", fullPath); - continue; - } - - _otherExtraFileRenamer.RenameOtherExtraFile(author, fullPath); - - var metadata = GetMetadataFile(author, existingMetadataFiles, c => c.Type == MetadataType.AlbumImage && - c.BookId == book.Id && - c.RelativePath == image.RelativePath) ?? - new MetadataFile - { - AuthorId = author.Id, - BookId = book.Id, - Consumer = consumer.GetType().Name, - Type = MetadataType.AlbumImage, - RelativePath = image.RelativePath, - Extension = Path.GetExtension(fullPath) - }; - - DownloadImage(author, image); - - result.Add(metadata); - } - - return result; - } - private void DownloadImage(Author author, ImageFileResult image) { var fullPath = Path.Combine(author.Path, image.RelativePath); diff --git a/src/NzbDrone.Core/Extras/Metadata/MetadataType.cs b/src/NzbDrone.Core/Extras/Metadata/MetadataType.cs index 2a827b48e..33d45a92e 100644 --- a/src/NzbDrone.Core/Extras/Metadata/MetadataType.cs +++ b/src/NzbDrone.Core/Extras/Metadata/MetadataType.cs @@ -3,11 +3,9 @@ namespace NzbDrone.Core.Extras.Metadata public enum MetadataType { Unknown = 0, - ArtistMetadata = 1, - TrackMetadata = 2, - ArtistImage = 3, - AlbumImage = 4, - TrackImage = 5, - AlbumMetadata = 6 + AuthorMetadata = 1, + BookMetadata = 2, + AuthorImage = 3, + BookImage = 4 } } diff --git a/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs b/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs index b93c74348..1a54d37c4 100644 --- a/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs +++ b/src/NzbDrone.Core/Extras/Others/OtherExtraService.cs @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Extras.Others return Enumerable.Empty(); } - public override IEnumerable CreateAfterTrackImport(Author author, BookFile bookFile) + public override IEnumerable CreateAfterBookImport(Author author, BookFile bookFile) { return Enumerable.Empty(); } @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Extras.Others public override IEnumerable MoveFilesAfterRename(Author author, List bookFiles) { - var extraFiles = _otherExtraFileService.GetFilesByArtist(author.Id); + var extraFiles = _otherExtraFileService.GetFilesByAuthor(author.Id); var movedFiles = new List(); foreach (var bookFile in bookFiles) diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs index e436e4f93..57ae7e2cc 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs @@ -15,9 +15,8 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers public void Clean() { DeleteDuplicateArtistMetadata(); - DeleteDuplicateAlbumMetadata(); - DeleteDuplicateTrackMetadata(); - DeleteDuplicateTrackImages(); + DeleteDuplicateBookMetadata(); + DeleteDuplicateBookImages(); } private void DeleteDuplicateArtistMetadata() @@ -34,21 +33,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers } } - private void DeleteDuplicateAlbumMetadata() - { - using (var mapper = _database.OpenConnection()) - { - mapper.Execute(@"DELETE FROM MetadataFiles - WHERE Id IN ( - SELECT Id FROM MetadataFiles - WHERE Type = 6 - GROUP BY BookId, Consumer - HAVING COUNT(BookId) > 1 - )"); - } - } - - private void DeleteDuplicateTrackMetadata() + private void DeleteDuplicateBookMetadata() { using (var mapper = _database.OpenConnection()) { @@ -62,14 +47,14 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers } } - private void DeleteDuplicateTrackImages() + private void DeleteDuplicateBookImages() { using (var mapper = _database.OpenConnection()) { mapper.Execute(@"DELETE FROM MetadataFiles WHERE Id IN ( SELECT Id FROM MetadataFiles - WHERE Type = 5 + WHERE Type = 4 GROUP BY BookFileId, Consumer HAVING COUNT(BookFileId) > 1 )"); diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/DeleteBadMediaCovers.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/DeleteBadMediaCovers.cs index 2f20417f6..577210eec 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/DeleteBadMediaCovers.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/DeleteBadMediaCovers.cs @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers foreach (var author in artists) { - var images = _metaFileService.GetFilesByArtist(author.Id) + var images = _metaFileService.GetFilesByAuthor(author.Id) .Where(c => c.LastUpdated > new DateTime(2014, 12, 27) && imageExtensions.Any(x => c.RelativePath.EndsWith(x, StringComparison.InvariantCultureIgnoreCase))); foreach (var image in images) diff --git a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs index ced1dee09..2785f5dda 100644 --- a/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs +++ b/src/NzbDrone.Core/ImportLists/ImportListSyncService.cs @@ -214,7 +214,7 @@ namespace NzbDrone.Core.ImportLists Tags = importList.Tags, AddOptions = new AddAuthorOptions { - SearchForMissingAlbums = monitored, + SearchForMissingBooks = monitored, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } @@ -282,7 +282,7 @@ namespace NzbDrone.Core.ImportLists Tags = importList.Tags, AddOptions = new AddAuthorOptions { - SearchForMissingAlbums = monitored, + SearchForMissingBooks = monitored, Monitored = monitored, Monitor = monitored ? MonitorTypes.All : MonitorTypes.None } diff --git a/src/NzbDrone.Core/Indexers/SeedConfigProvider.cs b/src/NzbDrone.Core/Indexers/SeedConfigProvider.cs index 2d866606b..5344747d7 100644 --- a/src/NzbDrone.Core/Indexers/SeedConfigProvider.cs +++ b/src/NzbDrone.Core/Indexers/SeedConfigProvider.cs @@ -19,21 +19,21 @@ namespace NzbDrone.Core.Indexers _indexerFactory = indexerFactory; } - public TorrentSeedConfiguration GetSeedConfiguration(RemoteBook remoteAlbum) + public TorrentSeedConfiguration GetSeedConfiguration(RemoteBook remoteBook) { - if (remoteAlbum.Release.DownloadProtocol != DownloadProtocol.Torrent) + if (remoteBook.Release.DownloadProtocol != DownloadProtocol.Torrent) { return null; } - if (remoteAlbum.Release.IndexerId == 0) + if (remoteBook.Release.IndexerId == 0) { return null; } try { - var indexer = _indexerFactory.Get(remoteAlbum.Release.IndexerId); + var indexer = _indexerFactory.Get(remoteBook.Release.IndexerId); var torrentIndexerSettings = indexer.Settings as ITorrentIndexerSettings; if (torrentIndexerSettings != null && torrentIndexerSettings.SeedCriteria != null) @@ -43,7 +43,7 @@ namespace NzbDrone.Core.Indexers Ratio = torrentIndexerSettings.SeedCriteria.SeedRatio }; - var seedTime = remoteAlbum.ParsedBookInfo.Discography ? torrentIndexerSettings.SeedCriteria.DiscographySeedTime : torrentIndexerSettings.SeedCriteria.SeedTime; + var seedTime = remoteBook.ParsedBookInfo.Discography ? torrentIndexerSettings.SeedCriteria.DiscographySeedTime : torrentIndexerSettings.SeedCriteria.SeedTime; if (seedTime.HasValue) { seedConfig.SeedTime = TimeSpan.FromMinutes(seedTime.Value); diff --git a/src/NzbDrone.Core/MediaFiles/AudioTagService.cs b/src/NzbDrone.Core/MediaFiles/AudioTagService.cs index 71ef14804..e0a5c98f9 100644 --- a/src/NzbDrone.Core/MediaFiles/AudioTagService.cs +++ b/src/NzbDrone.Core/MediaFiles/AudioTagService.cs @@ -158,11 +158,11 @@ namespace NzbDrone.Core.MediaFiles // get the tracks to update foreach (var book in books) { - var trackFiles = book.BookFiles.Value; + var bookFiles = book.BookFiles.Value; - _logger.Debug($"Syncing audio tags for {trackFiles.Count} files"); + _logger.Debug($"Syncing audio tags for {bookFiles.Count} files"); - foreach (var file in trackFiles) + foreach (var file in bookFiles) { // populate tracks (which should also have release/book/author set) because // not all of the updates will have been committed to the database yet @@ -219,10 +219,10 @@ namespace NzbDrone.Core.MediaFiles public void Execute(RetagFilesCommand message) { var author = _authorService.GetAuthor(message.AuthorId); - var trackFiles = _mediaFileService.Get(message.Files); + var bookFiles = _mediaFileService.Get(message.Files); - _logger.ProgressInfo("Re-tagging {0} files for {1}", trackFiles.Count, author.Name); - foreach (var file in trackFiles) + _logger.ProgressInfo("Re-tagging {0} files for {1}", bookFiles.Count, author.Name); + foreach (var file in bookFiles) { WriteTags(file, false, force: true); } @@ -237,9 +237,9 @@ namespace NzbDrone.Core.MediaFiles foreach (var author in artistToRename) { - var trackFiles = _mediaFileService.GetFilesByAuthor(author.Id); + var bookFiles = _mediaFileService.GetFilesByAuthor(author.Id); _logger.ProgressInfo("Re-tagging all files in author: {0}", author.Name); - foreach (var file in trackFiles) + foreach (var file in bookFiles) { WriteTags(file, false, force: true); } diff --git a/src/NzbDrone.Core/MediaFiles/BookImport/Identification/CandidateService.cs b/src/NzbDrone.Core/MediaFiles/BookImport/Identification/CandidateService.cs index 8776b2e2f..6b2d99b92 100644 --- a/src/NzbDrone.Core/MediaFiles/BookImport/Identification/CandidateService.cs +++ b/src/NzbDrone.Core/MediaFiles/BookImport/Identification/CandidateService.cs @@ -167,7 +167,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification // Will eventually need adding locally if we find a match var watch = System.Diagnostics.Stopwatch.StartNew(); - List remoteAlbums = null; + List remoteBooks = null; var candidates = new List(); var goodreads = localAlbumRelease.LocalBooks.Select(x => x.FileTrackInfo.GoodreadsId).Distinct().ToList(); @@ -182,32 +182,32 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification { _logger.Trace($"Searching by goodreads id {id}"); - remoteAlbums = _bookSearchService.SearchByGoodreadsId(id); + remoteBooks = _bookSearchService.SearchByGoodreadsId(id); } } - if ((remoteAlbums == null || !remoteAlbums.Any()) && + if ((remoteBooks == null || !remoteBooks.Any()) && isbns.Count == 1 && isbns[0].IsNotNullOrWhiteSpace()) { _logger.Trace($"Searching by isbn {isbns[0]}"); - remoteAlbums = _bookSearchService.SearchByIsbn(isbns[0]); + remoteBooks = _bookSearchService.SearchByIsbn(isbns[0]); } // Calibre puts junk asins into books it creates so check for sensible length - if ((remoteAlbums == null || !remoteAlbums.Any()) && + if ((remoteBooks == null || !remoteBooks.Any()) && asins.Count == 1 && asins[0].IsNotNullOrWhiteSpace() && asins[0].Length == 10) { _logger.Trace($"Searching by asin {asins[0]}"); - remoteAlbums = _bookSearchService.SearchByAsin(asins[0]); + remoteBooks = _bookSearchService.SearchByAsin(asins[0]); } // if no asin/isbn or no result, fall back to text search - if (remoteAlbums == null || !remoteAlbums.Any()) + if (remoteBooks == null || !remoteBooks.Any()) { // fall back to author / book name search string artistTag; @@ -228,24 +228,24 @@ namespace NzbDrone.Core.MediaFiles.BookImport.Identification return candidates; } - remoteAlbums = _bookSearchService.SearchForNewBook(albumTag, artistTag); + remoteBooks = _bookSearchService.SearchForNewBook(albumTag, artistTag); - if (!remoteAlbums.Any()) + if (!remoteBooks.Any()) { var albumSearch = _bookSearchService.SearchForNewBook(albumTag, null); var artistSearch = _bookSearchService.SearchForNewBook(artistTag, null); - remoteAlbums = albumSearch.Concat(artistSearch).DistinctBy(x => x.ForeignBookId).ToList(); + remoteBooks = albumSearch.Concat(artistSearch).DistinctBy(x => x.ForeignBookId).ToList(); } } } catch (SkyHookException e) { _logger.Info(e, "Skipping book due to SkyHook error"); - remoteAlbums = new List(); + remoteBooks = new List(); } - foreach (var book in remoteAlbums) + foreach (var book in remoteBooks) { candidates.Add(new CandidateAlbumRelease { diff --git a/src/NzbDrone.Core/MediaFiles/BookImport/ImportApprovedBooks.cs b/src/NzbDrone.Core/MediaFiles/BookImport/ImportApprovedBooks.cs index 8cfcb3675..a7598bfcc 100644 --- a/src/NzbDrone.Core/MediaFiles/BookImport/ImportApprovedBooks.cs +++ b/src/NzbDrone.Core/MediaFiles/BookImport/ImportApprovedBooks.cs @@ -42,7 +42,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport private readonly IManageCommandQueue _commandQueueManager; private readonly Logger _logger; - public ImportApprovedBooks(IUpgradeMediaFiles trackFileUpgrader, + public ImportApprovedBooks(IUpgradeMediaFiles bookFileUpgrader, IMediaFileService mediaFileService, IAudioTagService audioTagService, IAuthorService authorService, @@ -56,7 +56,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport IManageCommandQueue commandQueueManager, Logger logger) { - _bookFileUpgrader = trackFileUpgrader; + _bookFileUpgrader = bookFileUpgrader; _mediaFileService = mediaFileService; _audioTagService = audioTagService; _authorService = authorService; @@ -304,7 +304,7 @@ namespace NzbDrone.Core.MediaFiles.BookImport author.Tags = rootFolder.DefaultTags; author.AddOptions = new AddAuthorOptions { - SearchForMissingAlbums = false, + SearchForMissingBooks = false, Monitored = author.Monitored, Monitor = rootFolder.DefaultMonitorOption }; diff --git a/src/NzbDrone.Core/MediaFiles/UpdateTrackFileService.cs b/src/NzbDrone.Core/MediaFiles/UpdateTrackFileService.cs index 88c5c7ddb..149c1c2aa 100644 --- a/src/NzbDrone.Core/MediaFiles/UpdateTrackFileService.cs +++ b/src/NzbDrone.Core/MediaFiles/UpdateTrackFileService.cs @@ -44,7 +44,7 @@ namespace NzbDrone.Core.MediaFiles private bool ChangeFileDate(BookFile bookFile, Book book) { - var trackFilePath = bookFile.Path; + var bookFilePath = bookFile.Path; switch (_configService.FileDate) { @@ -52,14 +52,14 @@ namespace NzbDrone.Core.MediaFiles { if (!book.ReleaseDate.HasValue) { - _logger.Debug("Could not create valid date to change file [{0}]", trackFilePath); + _logger.Debug("Could not create valid date to change file [{0}]", bookFilePath); return false; } var relDate = book.ReleaseDate.Value; // avoiding false +ve checks and set date skewing by not using UTC (Windows) - var oldDateTime = _diskProvider.FileGetLastWrite(trackFilePath); + var oldDateTime = _diskProvider.FileGetLastWrite(bookFilePath); if (OsInfo.IsNotWindows && relDate < EpochTime) { @@ -71,14 +71,14 @@ namespace NzbDrone.Core.MediaFiles { try { - _diskProvider.FileSetLastWriteTime(trackFilePath, relDate); - _logger.Debug("Date of file [{0}] changed from '{1}' to '{2}'", trackFilePath, oldDateTime, relDate); + _diskProvider.FileSetLastWriteTime(bookFilePath, relDate); + _logger.Debug("Date of file [{0}] changed from '{1}' to '{2}'", bookFilePath, oldDateTime, relDate); return true; } catch (Exception ex) { - _logger.Warn(ex, "Unable to set date of file [" + trackFilePath + "]"); + _logger.Warn(ex, "Unable to set date of file [" + bookFilePath + "]"); } } diff --git a/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs b/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs index 35e5debe8..d60f9a14a 100644 --- a/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs +++ b/src/NzbDrone.Core/MediaFiles/UpgradeMediaFileService.cs @@ -68,18 +68,18 @@ namespace NzbDrone.Core.MediaFiles foreach (var file in existingFiles) { - var trackFilePath = file.Path; - var subfolder = rootFolderPath.GetRelativePath(_diskProvider.GetParentFolder(trackFilePath)); + var bookFilePath = file.Path; + var subfolder = rootFolderPath.GetRelativePath(_diskProvider.GetParentFolder(bookFilePath)); bookFile.CalibreId = file.CalibreId; - if (_diskProvider.FileExists(trackFilePath)) + if (_diskProvider.FileExists(bookFilePath)) { _logger.Debug("Removing existing book file: {0}", file); if (!isCalibre) { - _recycleBinProvider.DeleteFile(trackFilePath, subfolder); + _recycleBinProvider.DeleteFile(bookFilePath, subfolder); } else { diff --git a/src/NzbDrone.Core/Notifications/Webhook/Webhook.cs b/src/NzbDrone.Core/Notifications/Webhook/Webhook.cs index ccec4b456..45e89dcca 100644 --- a/src/NzbDrone.Core/Notifications/Webhook/Webhook.cs +++ b/src/NzbDrone.Core/Notifications/Webhook/Webhook.cs @@ -20,21 +20,21 @@ namespace NzbDrone.Core.Notifications.Webhook public override void OnGrab(GrabMessage message) { - var remoteAlbum = message.Book; + var remoteBook = message.Book; var quality = message.Quality; var payload = new WebhookGrabPayload { EventType = "Grab", Author = new WebhookAuthor(message.Author), - Books = remoteAlbum.Books.ConvertAll(x => new WebhookBook(x) + Books = remoteBook.Books.ConvertAll(x => new WebhookBook(x) { // TODO: Stop passing these parameters inside an album v3 Quality = quality.Quality.Name, QualityVersion = quality.Revision.Version, - ReleaseGroup = remoteAlbum.ParsedBookInfo.ReleaseGroup + ReleaseGroup = remoteBook.ParsedBookInfo.ReleaseGroup }), - Release = new WebhookRelease(quality, remoteAlbum) + Release = new WebhookRelease(quality, remoteBook) }; _proxy.SendWebhook(payload, Settings); diff --git a/src/NzbDrone.Core/Notifications/Webhook/WebhookRelease.cs b/src/NzbDrone.Core/Notifications/Webhook/WebhookRelease.cs index 0d953f1b4..4b8b177b3 100644 --- a/src/NzbDrone.Core/Notifications/Webhook/WebhookRelease.cs +++ b/src/NzbDrone.Core/Notifications/Webhook/WebhookRelease.cs @@ -9,14 +9,14 @@ namespace NzbDrone.Core.Notifications.Webhook { } - public WebhookRelease(QualityModel quality, RemoteBook remoteAlbum) + public WebhookRelease(QualityModel quality, RemoteBook remoteBook) { Quality = quality.Quality.Name; QualityVersion = quality.Revision.Version; - ReleaseGroup = remoteAlbum.ParsedBookInfo.ReleaseGroup; - ReleaseTitle = remoteAlbum.Release.Title; - Indexer = remoteAlbum.Release.Indexer; - Size = remoteAlbum.Release.Size; + ReleaseGroup = remoteBook.ParsedBookInfo.ReleaseGroup; + ReleaseTitle = remoteBook.Release.Title; + Indexer = remoteBook.Release.Indexer; + Size = remoteBook.Release.Size; } public string Quality { get; set; } diff --git a/src/NzbDrone.Core/Parser/Model/RemoteBook.cs b/src/NzbDrone.Core/Parser/Model/RemoteBook.cs index 6c53df720..caa2f53bb 100644 --- a/src/NzbDrone.Core/Parser/Model/RemoteBook.cs +++ b/src/NzbDrone.Core/Parser/Model/RemoteBook.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Parser.Model Books = new List(); } - public bool IsRecentAlbum() + public bool IsRecentBook() { return Books.Any(e => e.ReleaseDate >= DateTime.UtcNow.Date.AddDays(-14)); } diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index 200d8e129..4c030931c 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -319,7 +319,7 @@ namespace NzbDrone.Core.Parser return null; } - public static ParsedBookInfo ParseAlbumTitleWithSearchCriteria(string title, Author author, List album) + public static ParsedBookInfo ParseBookTitleWithSearchCriteria(string title, Author author, List books) { try { @@ -328,12 +328,12 @@ namespace NzbDrone.Core.Parser return null; } - var artistName = author.Name == "Various Artists" ? "VA" : author.Name.RemoveAccent(); + var authorName = author.Name == "Various Artists" ? "VA" : author.Name.RemoveAccent(); - Logger.Debug("Parsing string '{0}' using search criteria author: '{1}' album: '{2}'", + Logger.Debug("Parsing string '{0}' using search criteria author: '{1}' books: '{2}'", title, - artistName.RemoveAccent(), - string.Join(", ", album.Select(a => a.Title.RemoveAccent()))); + authorName.RemoveAccent(), + string.Join(", ", books.Select(a => a.Title.RemoveAccent()))); var releaseTitle = RemoveFileExtension(title); @@ -343,23 +343,23 @@ namespace NzbDrone.Core.Parser simpleTitle = CleanTorrentSuffixRegex.Replace(simpleTitle); - var bestAlbum = album.OrderByDescending(x => simpleTitle.FuzzyContains(x.Title)).First(); + var bestAlbum = books.OrderByDescending(x => simpleTitle.FuzzyContains(x.Title)).First(); - var foundArtist = GetTitleFuzzy(simpleTitle, artistName, out var remainder); - var foundAlbum = GetTitleFuzzy(remainder, bestAlbum.Title, out _); + var foundAuthor = GetTitleFuzzy(simpleTitle, authorName, out var remainder); + var foundBook = GetTitleFuzzy(remainder, bestAlbum.Title, out _); - Logger.Trace($"Found {foundArtist} - {foundAlbum} with fuzzy parser"); + Logger.Trace($"Found {foundAuthor} - {foundBook} with fuzzy parser"); - if (foundArtist == null || foundAlbum == null) + if (foundAuthor == null || foundBook == null) { return null; } var result = new ParsedBookInfo { - AuthorName = foundArtist, - AuthorTitleInfo = GetArtistTitleInfo(foundArtist), - BookTitle = foundAlbum + AuthorName = foundAuthor, + AuthorTitleInfo = GetAuthorTitleInfo(foundAuthor), + BookTitle = foundBook }; try @@ -732,7 +732,7 @@ namespace NzbDrone.Core.Parser return result; } - private static AuthorTitleInfo GetArtistTitleInfo(string title) + private static AuthorTitleInfo GetAuthorTitleInfo(string title) { var artistTitleInfo = new AuthorTitleInfo(); artistTitleInfo.Title = title; @@ -772,7 +772,7 @@ namespace NzbDrone.Core.Parser result.AuthorName = artistName; result.BookTitle = albumTitle; - result.AuthorTitleInfo = GetArtistTitleInfo(result.AuthorName); + result.AuthorTitleInfo = GetAuthorTitleInfo(result.AuthorName); result.ReleaseDate = releaseYear.ToString(); result.ReleaseVersion = releaseVersion; diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 69e057868..741a52a8f 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -15,9 +15,9 @@ namespace NzbDrone.Core.Parser { Author GetArtist(string title); Author GetArtistFromTag(string file); - RemoteBook Map(ParsedBookInfo parsedAlbumInfo, SearchCriteriaBase searchCriteria = null); - RemoteBook Map(ParsedBookInfo parsedAlbumInfo, int authorId, IEnumerable bookIds); - List GetAlbums(ParsedBookInfo parsedAlbumInfo, Author author, SearchCriteriaBase searchCriteria = null); + RemoteBook Map(ParsedBookInfo parsedBookInfo, SearchCriteriaBase searchCriteria = null); + RemoteBook Map(ParsedBookInfo parsedBookInfo, int authorId, IEnumerable bookIds); + List GetAlbums(ParsedBookInfo parsedBookInfo, Author author, SearchCriteriaBase searchCriteria = null); ParsedBookInfo ParseAlbumTitleFuzzy(string title); @@ -45,11 +45,11 @@ namespace NzbDrone.Core.Parser public Author GetArtist(string title) { - var parsedAlbumInfo = Parser.ParseBookTitle(title); + var parsedBookInfo = Parser.ParseBookTitle(title); - if (parsedAlbumInfo != null && !parsedAlbumInfo.AuthorName.IsNullOrWhiteSpace()) + if (parsedBookInfo != null && !parsedBookInfo.AuthorName.IsNullOrWhiteSpace()) { - title = parsedAlbumInfo.AuthorName; + title = parsedBookInfo.AuthorName; } var artistInfo = _authorService.FindByName(title); @@ -95,53 +95,53 @@ namespace NzbDrone.Core.Parser return author; } - public RemoteBook Map(ParsedBookInfo parsedAlbumInfo, SearchCriteriaBase searchCriteria = null) + public RemoteBook Map(ParsedBookInfo parsedBookInfo, SearchCriteriaBase searchCriteria = null) { - var remoteAlbum = new RemoteBook + var remoteBook = new RemoteBook { - ParsedBookInfo = parsedAlbumInfo, + ParsedBookInfo = parsedBookInfo, }; - var author = GetArtist(parsedAlbumInfo, searchCriteria); + var author = GetArtist(parsedBookInfo, searchCriteria); if (author == null) { - return remoteAlbum; + return remoteBook; } - remoteAlbum.Author = author; - remoteAlbum.Books = GetAlbums(parsedAlbumInfo, author, searchCriteria); + remoteBook.Author = author; + remoteBook.Books = GetAlbums(parsedBookInfo, author, searchCriteria); - return remoteAlbum; + return remoteBook; } - public List GetAlbums(ParsedBookInfo parsedAlbumInfo, Author author, SearchCriteriaBase searchCriteria = null) + public List GetAlbums(ParsedBookInfo parsedBookInfo, Author author, SearchCriteriaBase searchCriteria = null) { - var albumTitle = parsedAlbumInfo.BookTitle; + var albumTitle = parsedBookInfo.BookTitle; var result = new List(); - if (parsedAlbumInfo.BookTitle == null) + if (parsedBookInfo.BookTitle == null) { return new List(); } Book albumInfo = null; - if (parsedAlbumInfo.Discography) + if (parsedBookInfo.Discography) { - if (parsedAlbumInfo.DiscographyStart > 0) + if (parsedBookInfo.DiscographyStart > 0) { return _bookService.AuthorBooksBetweenDates(author, - new DateTime(parsedAlbumInfo.DiscographyStart, 1, 1), - new DateTime(parsedAlbumInfo.DiscographyEnd, 12, 31), + new DateTime(parsedBookInfo.DiscographyStart, 1, 1), + new DateTime(parsedBookInfo.DiscographyEnd, 12, 31), false); } - if (parsedAlbumInfo.DiscographyEnd > 0) + if (parsedBookInfo.DiscographyEnd > 0) { return _bookService.AuthorBooksBetweenDates(author, new DateTime(1800, 1, 1), - new DateTime(parsedAlbumInfo.DiscographyEnd, 12, 31), + new DateTime(parsedBookInfo.DiscographyEnd, 12, 31), false); } @@ -156,13 +156,13 @@ namespace NzbDrone.Core.Parser if (albumInfo == null) { // TODO: Search by Title and Year instead of just Title when matching - albumInfo = _bookService.FindByTitle(author.AuthorMetadataId, parsedAlbumInfo.BookTitle); + albumInfo = _bookService.FindByTitle(author.AuthorMetadataId, parsedBookInfo.BookTitle); } if (albumInfo == null) { - _logger.Debug("Trying inexact book match for {0}", parsedAlbumInfo.BookTitle); - albumInfo = _bookService.FindByTitleInexact(author.AuthorMetadataId, parsedAlbumInfo.BookTitle); + _logger.Debug("Trying inexact book match for {0}", parsedBookInfo.BookTitle); + albumInfo = _bookService.FindByTitleInexact(author.AuthorMetadataId, parsedBookInfo.BookTitle); } if (albumInfo != null) @@ -171,45 +171,45 @@ namespace NzbDrone.Core.Parser } else { - _logger.Debug("Unable to find {0}", parsedAlbumInfo); + _logger.Debug("Unable to find {0}", parsedBookInfo); } return result; } - public RemoteBook Map(ParsedBookInfo parsedAlbumInfo, int authorId, IEnumerable bookIds) + public RemoteBook Map(ParsedBookInfo parsedBookInfo, int authorId, IEnumerable bookIds) { return new RemoteBook { - ParsedBookInfo = parsedAlbumInfo, + ParsedBookInfo = parsedBookInfo, Author = _authorService.GetAuthor(authorId), Books = _bookService.GetBooks(bookIds) }; } - private Author GetArtist(ParsedBookInfo parsedAlbumInfo, SearchCriteriaBase searchCriteria) + private Author GetArtist(ParsedBookInfo parsedBookInfo, SearchCriteriaBase searchCriteria) { Author author = null; if (searchCriteria != null) { - if (searchCriteria.Author.CleanName == parsedAlbumInfo.AuthorName.CleanAuthorName()) + if (searchCriteria.Author.CleanName == parsedBookInfo.AuthorName.CleanAuthorName()) { return searchCriteria.Author; } } - author = _authorService.FindByName(parsedAlbumInfo.AuthorName); + author = _authorService.FindByName(parsedBookInfo.AuthorName); if (author == null) { - _logger.Debug("Trying inexact author match for {0}", parsedAlbumInfo.AuthorName); - author = _authorService.FindByNameInexact(parsedAlbumInfo.AuthorName); + _logger.Debug("Trying inexact author match for {0}", parsedBookInfo.AuthorName); + author = _authorService.FindByNameInexact(parsedBookInfo.AuthorName); } if (author == null) { - _logger.Debug("No matching author {0}", parsedAlbumInfo.AuthorName); + _logger.Debug("No matching author {0}", parsedBookInfo.AuthorName); return null; } @@ -251,7 +251,7 @@ namespace NzbDrone.Core.Parser if (bestAuthor != null) { - return Parser.ParseAlbumTitleWithSearchCriteria(title, bestAuthor, new List { bestBook }); + return Parser.ParseBookTitleWithSearchCriteria(title, bestAuthor, new List { bestBook }); } return null; diff --git a/src/Readarr.Api.V1/Indexers/ReleaseModule.cs b/src/Readarr.Api.V1/Indexers/ReleaseModule.cs index 53adf1f54..365b478fd 100644 --- a/src/Readarr.Api.V1/Indexers/ReleaseModule.cs +++ b/src/Readarr.Api.V1/Indexers/ReleaseModule.cs @@ -52,9 +52,9 @@ namespace Readarr.Api.V1.Indexers private object DownloadRelease(ReleaseResource release) { - var remoteAlbum = _remoteBookCache.Find(GetCacheKey(release)); + var remoteBook = _remoteBookCache.Find(GetCacheKey(release)); - if (remoteAlbum == null) + if (remoteBook == null) { _logger.Debug("Couldn't find requested release in cache, cache timeout probably expired."); @@ -63,7 +63,7 @@ namespace Readarr.Api.V1.Indexers try { - _downloadService.DownloadReport(remoteAlbum); + _downloadService.DownloadReport(remoteBook); } catch (ReleaseDownloadException ex) { diff --git a/src/Readarr.Api.V1/Parse/ParseModule.cs b/src/Readarr.Api.V1/Parse/ParseModule.cs index 1dddf75f2..e122c590d 100644 --- a/src/Readarr.Api.V1/Parse/ParseModule.cs +++ b/src/Readarr.Api.V1/Parse/ParseModule.cs @@ -19,23 +19,23 @@ namespace Readarr.Api.V1.Parse private ParseResource Parse() { var title = Request.Query.Title.Value as string; - var parsedAlbumInfo = Parser.ParseBookTitle(title); + var parsedBookInfo = Parser.ParseBookTitle(title); - if (parsedAlbumInfo == null) + if (parsedBookInfo == null) { return null; } - var remoteAlbum = _parsingService.Map(parsedAlbumInfo); + var remoteBook = _parsingService.Map(parsedBookInfo); - if (remoteAlbum != null) + if (remoteBook != null) { return new ParseResource { Title = title, - ParsedBookInfo = remoteAlbum.ParsedBookInfo, - Author = remoteAlbum.Author.ToResource(), - Books = remoteAlbum.Books.ToResource() + ParsedBookInfo = remoteBook.ParsedBookInfo, + Author = remoteBook.Author.ToResource(), + Books = remoteBook.Books.ToResource() }; } else @@ -43,7 +43,7 @@ namespace Readarr.Api.V1.Parse return new ParseResource { Title = title, - ParsedBookInfo = parsedAlbumInfo + ParsedBookInfo = parsedBookInfo }; } }