1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 23:42:33 +01:00

fixed newznab parsing limited Wombles rss to TV

This commit is contained in:
kay.one 2013-06-08 10:53:26 -07:00
parent 5dc7e03b8d
commit 074d7f2df5
4 changed files with 42 additions and 15 deletions

View File

@ -42,7 +42,7 @@ namespace NzbDrone.Api.Indexers
private List<ReleaseResource> GetRss()
{
if (results == null)
//if (results == null)
{
var reports = _rssFetcherAndParser.Fetch();
var decisions = _downloadDecisionMaker.GetRssDecision(reports);

View File

@ -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<ReportInfo> reports)
private void ValidateResult(IList<ReportInfo> 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);
}
}
}

View File

@ -7,7 +7,13 @@ namespace NzbDrone.Core.Indexers.Newznab
{
public class Newznab : IndexerWithSetting<NewznabSettings>
{
public override IParseFeed Parser
{
get
{
return new NewznabParser(this);
}
}
public override IEnumerable<IndexerDefinition> DefaultDefinitions
{

View File

@ -5,9 +5,17 @@ namespace NzbDrone.Core.Indexers.Wombles
{
public class Wombles : IndexerBase
{
public override IParseFeed Parser
{
get
{
return new WomblesParser();
}
}
public override IEnumerable<string> 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