From 67e55e5c39fdd4ae51e12b2e4c90a76c2ac4f25d Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 2 Jun 2011 18:15:19 -0700 Subject: [PATCH] newzbin now supports episode search --- NzbDrone.Core.Test/IndexerTests.cs | 33 +++++++++++++++++++++- NzbDrone.Core/Providers/Indexer/Newzbin.cs | 8 ++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/NzbDrone.Core.Test/IndexerTests.cs b/NzbDrone.Core.Test/IndexerTests.cs index 2a509e877..067e2cee0 100644 --- a/NzbDrone.Core.Test/IndexerTests.cs +++ b/NzbDrone.Core.Test/IndexerTests.cs @@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test } [Test] - public void newzbin() + public void newzbin_rss_fetch() { var mocker = new AutoMoqer(); @@ -90,6 +90,12 @@ namespace NzbDrone.Core.Test ExceptionVerification.ExcpectedWarns(1); } + [Test] + public void newzbing_rss_search() + { + + } + [Test] [TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)] @@ -188,6 +194,31 @@ namespace NzbDrone.Core.Test } + [Test] + public void newzbin_search_returns_valid_results() + { + var mocker = new AutoMoqer(); + + mocker.GetMock() + .SetupGet(c => c.NewzbinUsername) + .Returns("nzbdrone"); + + mocker.GetMock() + .SetupGet(c => c.NewzbinPassword) + .Returns("smartar39865"); + + + mocker.Resolve(); + + var result = mocker.Resolve().FetchEpisode("Simpsons", 21, 23); + + result.Should().NotBeEmpty(); + result.Should().OnlyContain(r => r.CleanTitle == "simpsons"); + result.Should().OnlyContain(r => r.SeasonNumber == 21); + result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); + } + + [Test] public void nzbsorg_multi_word_search_returns_valid_results() { diff --git a/NzbDrone.Core/Providers/Indexer/Newzbin.cs b/NzbDrone.Core/Providers/Indexer/Newzbin.cs index e2df61f1a..3ff516313 100644 --- a/NzbDrone.Core/Providers/Indexer/Newzbin.cs +++ b/NzbDrone.Core/Providers/Indexer/Newzbin.cs @@ -10,7 +10,8 @@ namespace NzbDrone.Core.Providers.Indexer { public class Newzbin : IndexerBase { - public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider) + public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider) + : base(httpProvider, configProvider) { } @@ -35,7 +36,8 @@ namespace NzbDrone.Core.Providers.Indexer protected override IList GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber) { - return new List(); + + return new List { String.Format(@"http://www.newzbin.com/search/query/?q={0}+{1}x{2:00}&fpn=p&searchaction=Go&category=8&feed=rss&hauth=1", GetQueryTitle(seriesTitle), seasonNumber, episodeNumber) }; } public override string Name @@ -54,7 +56,7 @@ namespace NzbDrone.Core.Providers.Indexer { var quality = Parser.ParseQuality(item.Summary.Text); - currentResult.Quality = quality; + currentResult.Quality = quality; } return currentResult; }