newzbin now supports episode search

This commit is contained in:
kay.one 2011-06-02 18:15:19 -07:00
parent d09a82a20f
commit 67e55e5c39
2 changed files with 37 additions and 4 deletions

View File

@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
public void newzbin() public void newzbin_rss_fetch()
{ {
var mocker = new AutoMoqer(); var mocker = new AutoMoqer();
@ -90,6 +90,12 @@ namespace NzbDrone.Core.Test
ExceptionVerification.ExcpectedWarns(1); ExceptionVerification.ExcpectedWarns(1);
} }
[Test]
public void newzbing_rss_search()
{
}
[Test] [Test]
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)] [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<ConfigProvider>()
.SetupGet(c => c.NewzbinUsername)
.Returns("nzbdrone");
mocker.GetMock<ConfigProvider>()
.SetupGet(c => c.NewzbinPassword)
.Returns("smartar39865");
mocker.Resolve<HttpProvider>();
var result = mocker.Resolve<Newzbin>().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] [Test]
public void nzbsorg_multi_word_search_returns_valid_results() public void nzbsorg_multi_word_search_returns_valid_results()
{ {

View File

@ -10,7 +10,8 @@ namespace NzbDrone.Core.Providers.Indexer
{ {
public class Newzbin : IndexerBase 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<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber) protected override IList<string> GetSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
{ {
return new List<string>();
return new List<string> { 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 public override string Name
@ -54,7 +56,7 @@ namespace NzbDrone.Core.Providers.Indexer
{ {
var quality = Parser.ParseQuality(item.Summary.Text); var quality = Parser.ParseQuality(item.Summary.Text);
currentResult.Quality = quality; currentResult.Quality = quality;
} }
return currentResult; return currentResult;
} }