mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-01-07 09:15:58 +00:00
Disable newznab book-search, enable for Torznab
This commit is contained in:
@@ -8,7 +8,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
{
|
||||
public class NewznabRequestGenerator : IIndexerRequestGenerator
|
||||
{
|
||||
private readonly INewznabCapabilitiesProvider _capabilitiesProvider;
|
||||
protected readonly INewznabCapabilitiesProvider _capabilitiesProvider;
|
||||
public int MaxPages { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
public NewznabSettings Settings { get; set; }
|
||||
@@ -32,18 +32,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
}
|
||||
}
|
||||
|
||||
private bool SupportsBookSearch
|
||||
{
|
||||
get
|
||||
{
|
||||
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
|
||||
|
||||
return capabilities.SupportedBookSearchParameters != null &&
|
||||
capabilities.SupportedBookSearchParameters.Contains("q") &&
|
||||
capabilities.SupportedBookSearchParameters.Contains("author") &&
|
||||
capabilities.SupportedBookSearchParameters.Contains("title");
|
||||
}
|
||||
}
|
||||
protected virtual bool SupportsBookSearch => false;
|
||||
|
||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
{
|
||||
@@ -78,13 +67,6 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
{
|
||||
pageableRequests.AddTier();
|
||||
|
||||
/* pageableRequests.Add(GetPagedRequests(MaxPages,
|
||||
Settings.Categories,
|
||||
"search",
|
||||
NewsnabifyTitle($"&q={searchCriteria.BookIsbn}")));
|
||||
|
||||
pageableRequests.AddTier();*/
|
||||
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages,
|
||||
Settings.Categories,
|
||||
"search",
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||
|
||||
protected virtual string GetAlbum(XElement item)
|
||||
{
|
||||
var albumString = TryGetNewznabAttribute(item, "book");
|
||||
var albumString = TryGetNewznabAttribute(item, "booktitle");
|
||||
|
||||
if (!albumString.IsNullOrWhiteSpace())
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.Indexers.Torznab
|
||||
|
||||
public override IIndexerRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
return new NewznabRequestGenerator(_capabilitiesProvider)
|
||||
return new TorznabRequestGenerator(_capabilitiesProvider)
|
||||
{
|
||||
PageSize = PageSize,
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user