mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-10 23:29:53 +02:00
limited newzbin search to English only.
This commit is contained in:
parent
555e62fd17
commit
cd96d546e8
@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test
|
|||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
public class IndexerTests : TestBase
|
public class IndexerTests : TestBase
|
||||||
{
|
{
|
||||||
|
|
||||||
[TestCase("nzbsorg.xml", 0)]
|
[TestCase("nzbsorg.xml", 0)]
|
||||||
[TestCase("nzbsrus.xml", 6)]
|
[TestCase("nzbsrus.xml", 6)]
|
||||||
[TestCase("newzbin.xml", 1)]
|
[TestCase("newzbin.xml", 1)]
|
||||||
@ -60,16 +60,20 @@ public void parse_feed_xml(string fileName, int warns)
|
|||||||
public void newzbin_rss_fetch()
|
public void newzbin_rss_fetch()
|
||||||
{
|
{
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
|
mocker.Resolve<HttpProvider>();
|
||||||
mocker.GetMock<HttpProvider>()
|
|
||||||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
|
||||||
.Returns(File.OpenRead(".\\Files\\Rss\\newzbin.xml"));
|
|
||||||
|
|
||||||
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
|
var fakeSettings = Builder<IndexerSetting>.CreateNew().Build();
|
||||||
mocker.GetMock<IndexerProvider>()
|
mocker.GetMock<IndexerProvider>()
|
||||||
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
.Setup(c => c.GetSettings(It.IsAny<Type>()))
|
||||||
.Returns(fakeSettings);
|
.Returns(fakeSettings);
|
||||||
|
|
||||||
|
mocker.GetMock<ConfigProvider>()
|
||||||
|
.SetupGet(c => c.NewzbinUsername)
|
||||||
|
.Returns("nzbdrone");
|
||||||
|
|
||||||
|
mocker.GetMock<ConfigProvider>()
|
||||||
|
.SetupGet(c => c.NewzbinPassword)
|
||||||
|
.Returns("smartar39865");
|
||||||
|
|
||||||
var newzbinProvider = mocker.Resolve<Newzbin>();
|
var newzbinProvider = mocker.Resolve<Newzbin>();
|
||||||
var parseResults = newzbinProvider.FetchRss();
|
var parseResults = newzbinProvider.FetchRss();
|
||||||
|
|
||||||
@ -84,11 +88,10 @@ public void newzbin_rss_fetch()
|
|||||||
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
|
parseResults.Should().OnlyContain(s => s.Indexer == newzbinProvider.Name);
|
||||||
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
parseResults.Should().OnlyContain(s => !String.IsNullOrEmpty(s.NzbTitle));
|
||||||
|
|
||||||
|
ExceptionVerification.IgnoreWarns();
|
||||||
ExceptionVerification.ExcpectedWarns(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
|
[TestCase("Adventure.Inc.S03E19.DVDRip.XviD-OSiTV", 3, 19, QualityTypes.DVD)]
|
||||||
public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality)
|
public void custome_parser_partial_success(string title, int season, int episode, QualityTypes quality)
|
||||||
{
|
{
|
||||||
@ -179,8 +182,8 @@ public void nzbsorg_search_returns_valid_results()
|
|||||||
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23));
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestCase("simpsons",21,23)]
|
[TestCase("simpsons", 21, 23)]
|
||||||
[TestCase("Hawaii Five-0", 1, 5)]
|
[TestCase("Hawaii Five-0 2010", 1, 5)]
|
||||||
public void newzbin_search_returns_valid_results(string title, int season, int episode)
|
public void newzbin_search_returns_valid_results(string title, int season, int episode)
|
||||||
{
|
{
|
||||||
var mocker = new AutoMoqer();
|
var mocker = new AutoMoqer();
|
||||||
@ -198,7 +201,7 @@ public void newzbin_search_returns_valid_results(string title, int season, int e
|
|||||||
var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
|
var result = mocker.Resolve<Newzbin>().FetchEpisode(title, season, episode);
|
||||||
|
|
||||||
result.Should().NotBeEmpty();
|
result.Should().NotBeEmpty();
|
||||||
result.Should().OnlyContain(r => r.CleanTitle == title);
|
result.Should().OnlyContain(r => r.CleanTitle == Parser.NormalizeTitle(title));
|
||||||
result.Should().OnlyContain(r => r.SeasonNumber == season);
|
result.Should().OnlyContain(r => r.SeasonNumber == season);
|
||||||
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
|
result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode));
|
||||||
}
|
}
|
||||||
|
@ -10,19 +10,21 @@ namespace NzbDrone.Core.Providers.Indexer
|
|||||||
{
|
{
|
||||||
public class Newzbin : IndexerBase
|
public class Newzbin : IndexerBase
|
||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider)
|
public Newzbin(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||||
: base(httpProvider, configProvider)
|
: base(httpProvider, configProvider)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private const string UrlParams = "feed=rss&hauth=1&ps_rb_language=4096";
|
||||||
|
|
||||||
protected override string[] Urls
|
protected override string[] Urls
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
"http://www.newzbin.com/browse/category/p/tv?feed=rss&hauth=1"
|
"http://www.newzbin.com/browse/category/p/tv?" + UrlParams
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +40,7 @@ protected override NetworkCredential Credentials
|
|||||||
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> { 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) };
|
return new List<string> { String.Format(@"http://www.newzbin.com/search/query/?q={0}+{1}x{2:00}&fpn=p&searchaction=Go&category=8&{3}", GetQueryTitle(seriesTitle), seasonNumber, episodeNumber, UrlParams) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string Name
|
public override string Name
|
||||||
|
Loading…
Reference in New Issue
Block a user