From 074d7f2df50bbb66eb5b8ef8b5c4ca3a1eb8703a Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 8 Jun 2013 10:53:26 -0700 Subject: [PATCH] fixed newznab parsing limited Wombles rss to TV --- NzbDrone.Api/Indexers/ReleaseModule.cs | 2 +- .../IndexerIntegrationTests.cs | 37 +++++++++++++------ NzbDrone.Core/Indexers/Newznab/Newznab.cs | 8 +++- NzbDrone.Core/Indexers/Wombles/Wombles.cs | 10 ++++- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/NzbDrone.Api/Indexers/ReleaseModule.cs b/NzbDrone.Api/Indexers/ReleaseModule.cs index 6e68124fa..a824d0200 100644 --- a/NzbDrone.Api/Indexers/ReleaseModule.cs +++ b/NzbDrone.Api/Indexers/ReleaseModule.cs @@ -42,7 +42,7 @@ namespace NzbDrone.Api.Indexers private List GetRss() { - if (results == null) + //if (results == null) { var reports = _rssFetcherAndParser.Fetch(); var decisions = _downloadDecisionMaker.GetRssDecision(reports); diff --git a/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs b/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs index a244d89a8..eb18358f2 100644 --- a/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs +++ b/NzbDrone.Core.Test/IndexerTests/IntegrationTests/IndexerIntegrationTests.cs @@ -4,6 +4,7 @@ using NzbDrone.Core.Indexers; using NzbDrone.Core.Indexers.Newznab; using NzbDrone.Core.Indexers.NzbClub; using NzbDrone.Core.Indexers.Nzbx; +using NzbDrone.Core.Indexers.Wombles; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Test.Framework; using NUnit.Framework; @@ -18,7 +19,7 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests public void SetUp() { UseRealHttp(); - + } [Test] @@ -43,6 +44,17 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests + [Test] + public void wombles_rss() + { + var indexer = new Wombles(); + + var result = Subject.FetchRss(indexer); + + ValidateResult(result, skipSize: true, skipInfo: true); + } + + [Test] [Explicit("needs newznab api key")] public void nzbsorg_rss() @@ -58,25 +70,26 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests var result = Subject.FetchRss(indexer); - result.Should().NotBeEmpty(); - result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title)); - result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbUrl)); - - //TODO: uncomment these after moving to restsharp for rss - //result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbInfoUrl)); - //result.Should().OnlyContain(c => c.Size > 0); - + ValidateResult(result); } - private void ValidateResult(IList reports) + private void ValidateResult(IList reports, bool skipSize = false, bool skipInfo = false) { reports.Should().NotBeEmpty(); reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title)); - reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbInfoUrl)); reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbUrl)); - reports.Should().OnlyContain(c => c.Size > 0); + + if (!skipInfo) + { + reports.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.NzbInfoUrl)); + } + + if (!skipSize) + { + reports.Should().OnlyContain(c => c.Size > 0); + } } } diff --git a/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/NzbDrone.Core/Indexers/Newznab/Newznab.cs index 2ad2236cb..89aeb7c27 100644 --- a/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -7,7 +7,13 @@ namespace NzbDrone.Core.Indexers.Newznab { public class Newznab : IndexerWithSetting { - + public override IParseFeed Parser + { + get + { + return new NewznabParser(this); + } + } public override IEnumerable DefaultDefinitions { diff --git a/NzbDrone.Core/Indexers/Wombles/Wombles.cs b/NzbDrone.Core/Indexers/Wombles/Wombles.cs index bf699be14..dbc460124 100644 --- a/NzbDrone.Core/Indexers/Wombles/Wombles.cs +++ b/NzbDrone.Core/Indexers/Wombles/Wombles.cs @@ -5,9 +5,17 @@ namespace NzbDrone.Core.Indexers.Wombles { public class Wombles : IndexerBase { + public override IParseFeed Parser + { + get + { + return new WomblesParser(); + } + } + public override IEnumerable RecentFeed { - get { yield return string.Format("http://nzb.isasecret.com/rss"); } + get { yield return "http://nzb.isasecret.com/rss/?sec=TV&fr=false"; } } public override string Name