Added NzbInfoUrl to indexers.
This commit is contained in:
parent
ce0a6f8b86
commit
b314ff5e82
|
@ -26,7 +26,6 @@ namespace NzbDrone.Core.Test
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class IndexerTests : CoreTest
|
public class IndexerTests : CoreTest
|
||||||
{
|
{
|
||||||
|
|
||||||
[TestCase("nzbsorg.xml")]
|
[TestCase("nzbsorg.xml")]
|
||||||
[TestCase("nzbsrus.xml")]
|
[TestCase("nzbsrus.xml")]
|
||||||
[TestCase("newzbin.xml")]
|
[TestCase("newzbin.xml")]
|
||||||
|
@ -563,5 +562,39 @@ namespace NzbDrone.Core.Test
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentCulture = currentCulture;
|
Thread.CurrentThread.CurrentCulture = currentCulture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("nzbsorg.xml", "info")]
|
||||||
|
[TestCase("nzbsrus.xml", "info")]
|
||||||
|
[TestCase("newzbin.xml", "info")]
|
||||||
|
[TestCase("nzbmatrix.xml", "info")]
|
||||||
|
[TestCase("newznab.xml", "info")]
|
||||||
|
[TestCase("wombles.xml", "info")]
|
||||||
|
[TestCase("filesharingtalk.xml", "info")]
|
||||||
|
[TestCase("nzbindex.xml", "info")]
|
||||||
|
[TestCase("nzbclub.xml", "info")]
|
||||||
|
public void NzbInfoUrl_should_contain_information_string(string fileName, string expectedContent)
|
||||||
|
{
|
||||||
|
Mocker.GetMock<HttpProvider>()
|
||||||
|
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||||
|
.Returns(File.OpenRead(".\\Files\\Rss\\" + fileName));
|
||||||
|
|
||||||
|
var fakeSettings = Builder<IndexerDefinition>.CreateNew().Build();
|
||||||
|
Mocker.GetMock<IndexerProvider>()
|
||||||
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
||||||
|
.Returns(fakeSettings);
|
||||||
|
|
||||||
|
var mockIndexer = Mocker.Resolve<MockIndexer>();
|
||||||
|
var parseResults = mockIndexer.FetchRss();
|
||||||
|
|
||||||
|
foreach (var episodeParseResult in parseResults)
|
||||||
|
{
|
||||||
|
episodeParseResult.NzbInfoUrl.Should().Contain(expectedContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
parseResults.Should().NotBeEmpty();
|
||||||
|
parseResults.Should().OnlyContain(s => s.Indexer == mockIndexer.Name);
|
||||||
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.OriginalString));
|
||||||
|
parseResults.Should().OnlyContain(s => s.Age >= 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,11 +141,15 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
get { return "Mocked Indexer"; }
|
get { return "Mocked Indexer"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override string NzbDownloadUrl(SyndicationItem item)
|
protected override string NzbDownloadUrl(SyndicationItem item)
|
||||||
{
|
{
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[1].Uri.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TestUrlIndexer : IndexerBase
|
public class TestUrlIndexer : IndexerBase
|
||||||
|
@ -194,6 +198,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
{
|
{
|
||||||
return "http://google.com";
|
return "http://google.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return "http://google.com";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CustomParserIndexer : IndexerBase
|
public class CustomParserIndexer : IndexerBase
|
||||||
|
@ -243,6 +252,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
return "http://www.google.com";
|
return "http://www.google.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return "http://www.google.com";
|
||||||
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
{
|
{
|
||||||
if (currentResult == null) currentResult = new EpisodeParseResult();
|
if (currentResult == null) currentResult = new EpisodeParseResult();
|
||||||
|
@ -297,6 +311,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DefaultEnabledIndexer : IndexerBase
|
public class DefaultEnabledIndexer : IndexerBase
|
||||||
|
@ -346,11 +365,16 @@ namespace NzbDrone.Core.Test.ProviderTests
|
||||||
get { return "Mocked Indexer"; }
|
get { return "Mocked Indexer"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected override string NzbDownloadUrl(SyndicationItem item)
|
protected override string NzbDownloadUrl(SyndicationItem item)
|
||||||
{
|
{
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[1].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public override bool EnabledByDefault
|
public override bool EnabledByDefault
|
||||||
{
|
{
|
||||||
get { return true; }
|
get { return true; }
|
||||||
|
|
|
@ -224,6 +224,7 @@
|
||||||
<Compile Include="Datastore\MigrationLogger.cs" />
|
<Compile Include="Datastore\MigrationLogger.cs" />
|
||||||
<Compile Include="Datastore\MigrationsHelper.cs" />
|
<Compile Include="Datastore\MigrationsHelper.cs" />
|
||||||
<Compile Include="Datastore\CustomeMapper.cs" />
|
<Compile Include="Datastore\CustomeMapper.cs" />
|
||||||
|
<Compile Include="Datastore\Migrations\Migration20120430.cs" />
|
||||||
<Compile Include="Datastore\Migrations\Migration20120420.cs" />
|
<Compile Include="Datastore\Migrations\Migration20120420.cs" />
|
||||||
<Compile Include="Datastore\Migrations\Migration20120228.cs" />
|
<Compile Include="Datastore\Migrations\Migration20120228.cs" />
|
||||||
<Compile Include="Datastore\Migrations\Migration20120227.cs" />
|
<Compile Include="Datastore\Migrations\Migration20120227.cs" />
|
||||||
|
|
|
@ -68,6 +68,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
{
|
{
|
||||||
if (currentResult != null)
|
if (currentResult != null)
|
||||||
|
|
|
@ -97,6 +97,13 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
/// <returns>Download link URL</returns>
|
/// <returns>Download link URL</returns>
|
||||||
protected abstract string NzbDownloadUrl(SyndicationItem item);
|
protected abstract string NzbDownloadUrl(SyndicationItem item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generates link to the NZB info at the indexer
|
||||||
|
/// </summary>
|
||||||
|
/// <param name = "item">RSS Feed item to generate the link for</param>
|
||||||
|
/// <returns>Nzb Info URL</returns>
|
||||||
|
protected abstract string NzbInfoUrl(SyndicationItem item);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches RSS feed and process each news item.
|
/// Fetches RSS feed and process each news item.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -191,6 +198,7 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
if (parsedEpisode != null)
|
if (parsedEpisode != null)
|
||||||
{
|
{
|
||||||
parsedEpisode.NzbUrl = NzbDownloadUrl(item);
|
parsedEpisode.NzbUrl = NzbDownloadUrl(item);
|
||||||
|
parsedEpisode.NzbInfoUrl = NzbInfoUrl(item);
|
||||||
parsedEpisode.Indexer = Name;
|
parsedEpisode.Indexer = Name;
|
||||||
result.Add(parsedEpisode);
|
result.Add(parsedEpisode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Id + "nzb";
|
return item.Id + "nzb";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
{
|
{
|
||||||
if (currentResult != null)
|
if (currentResult != null)
|
||||||
|
|
|
@ -74,6 +74,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
{
|
{
|
||||||
if (currentResult != null)
|
if (currentResult != null)
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[1].Uri.ToString();
|
return item.Links[1].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
var searchUrls = new List<String>();
|
var searchUrls = new List<String>();
|
||||||
|
|
|
@ -101,6 +101,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
{
|
{
|
||||||
if (currentResult != null)
|
if (currentResult != null)
|
||||||
|
|
|
@ -98,6 +98,11 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Id;
|
return item.Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
protected override EpisodeParseResult CustomParser(SyndicationItem item, EpisodeParseResult currentResult)
|
||||||
{
|
{
|
||||||
if (currentResult != null)
|
if (currentResult != null)
|
||||||
|
|
|
@ -49,6 +49,10 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,6 +45,10 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||||
return item.Links[0].Uri.ToString();
|
return item.Links[0].Uri.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string NzbInfoUrl(SyndicationItem item)
|
||||||
|
{
|
||||||
|
return item.Links[0].Uri.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
protected override IList<string> GetEpisodeSearchUrls(string seriesTitle, int seasonNumber, int episodeNumber)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue