mirror of
https://github.com/Readarr/Readarr
synced 2025-12-16 05:12:42 +01:00
Disable newznab book-search, enable for Torznab
This commit is contained in:
parent
93105cfff7
commit
6a24bf7a78
4 changed files with 30 additions and 22 deletions
|
|
@ -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 @@ private bool SupportsSearch
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ public virtual IndexerPageableRequestChain GetSearchRequests(BookSearchCriteria
|
|||
{
|
||||
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 @@ protected virtual string GetArtist(XElement item)
|
|||
|
||||
protected virtual string GetAlbum(XElement item)
|
||||
{
|
||||
var albumString = TryGetNewznabAttribute(item, "book");
|
||||
var albumString = TryGetNewznabAttribute(item, "booktitle");
|
||||
|
||||
if (!albumString.IsNullOrWhiteSpace())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class Torznab : HttpIndexerBase<TorznabSettings>
|
|||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue