Disable newznab book-search, enable for Torznab

pull/354/head
ta264 4 years ago
parent 93105cfff7
commit 6a24bf7a78

@ -8,7 +8,7 @@ namespace NzbDrone.Core.Indexers.Newznab
{ {
public class NewznabRequestGenerator : IIndexerRequestGenerator public class NewznabRequestGenerator : IIndexerRequestGenerator
{ {
private readonly INewznabCapabilitiesProvider _capabilitiesProvider; protected readonly INewznabCapabilitiesProvider _capabilitiesProvider;
public int MaxPages { get; set; } public int MaxPages { get; set; }
public int PageSize { get; set; } public int PageSize { get; set; }
public NewznabSettings Settings { get; set; } public NewznabSettings Settings { get; set; }
@ -32,18 +32,7 @@ namespace NzbDrone.Core.Indexers.Newznab
} }
} }
private bool SupportsBookSearch protected virtual bool SupportsBookSearch => false;
{
get
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
return capabilities.SupportedBookSearchParameters != null &&
capabilities.SupportedBookSearchParameters.Contains("q") &&
capabilities.SupportedBookSearchParameters.Contains("author") &&
capabilities.SupportedBookSearchParameters.Contains("title");
}
}
public virtual IndexerPageableRequestChain GetRecentRequests() public virtual IndexerPageableRequestChain GetRecentRequests()
{ {
@ -78,13 +67,6 @@ namespace NzbDrone.Core.Indexers.Newznab
{ {
pageableRequests.AddTier(); pageableRequests.AddTier();
/* pageableRequests.Add(GetPagedRequests(MaxPages,
Settings.Categories,
"search",
NewsnabifyTitle($"&q={searchCriteria.BookIsbn}")));
pageableRequests.AddTier();*/
pageableRequests.Add(GetPagedRequests(MaxPages, pageableRequests.Add(GetPagedRequests(MaxPages,
Settings.Categories, Settings.Categories,
"search", "search",

@ -128,7 +128,7 @@ namespace NzbDrone.Core.Indexers.Newznab
protected virtual string GetAlbum(XElement item) protected virtual string GetAlbum(XElement item)
{ {
var albumString = TryGetNewznabAttribute(item, "book"); var albumString = TryGetNewznabAttribute(item, "booktitle");
if (!albumString.IsNullOrWhiteSpace()) if (!albumString.IsNullOrWhiteSpace())
{ {

@ -23,7 +23,7 @@ namespace NzbDrone.Core.Indexers.Torznab
public override IIndexerRequestGenerator GetRequestGenerator() public override IIndexerRequestGenerator GetRequestGenerator()
{ {
return new NewznabRequestGenerator(_capabilitiesProvider) return new TorznabRequestGenerator(_capabilitiesProvider)
{ {
PageSize = PageSize, PageSize = PageSize,
Settings = Settings Settings = Settings

@ -0,0 +1,26 @@
using System.Linq;
using NzbDrone.Core.Indexers.Newznab;
namespace NzbDrone.Core.Indexers.Torznab
{
public class TorznabRequestGenerator : NewznabRequestGenerator
{
public TorznabRequestGenerator(INewznabCapabilitiesProvider capabilitiesProvider)
: base(capabilitiesProvider)
{
}
protected override bool SupportsBookSearch
{
get
{
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
return capabilities.SupportedBookSearchParameters != null &&
capabilities.SupportedBookSearchParameters.Contains("q") &&
capabilities.SupportedBookSearchParameters.Contains("author") &&
capabilities.SupportedBookSearchParameters.Contains("title");
}
}
}
}
Loading…
Cancel
Save