Add support for searches in newznab if indexer doesnt support audio params (Jackett)

pull/94/head
Qstick 7 years ago
parent 1322633d0d
commit 4e7a2a3ed4

@ -67,10 +67,25 @@ namespace NzbDrone.Core.Indexers.Newznab
{
var pageableRequests = new IndexerPageableRequestChain();
AddAudioPageableRequests(pageableRequests,
string.Format("&artist={0}&album={1}",
searchCriteria.Artist.Name,
searchCriteria.AlbumTitle));
if (SupportsAudioSearch)
{
AddAudioPageableRequests(pageableRequests, searchCriteria,
string.Format("&artist={0}&album={1}",
searchCriteria.Artist.Name,
searchCriteria.AlbumTitle));
}
if (SupportsSearch)
{
pageableRequests.AddTier();
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search",
string.Format("&q={0}",
NewsnabifyTitle(string.Format("{0} - {1}",
searchCriteria.Artist.Name,
searchCriteria.AlbumTitle)))));
}
return pageableRequests;
}
@ -79,25 +94,35 @@ namespace NzbDrone.Core.Indexers.Newznab
{
var pageableRequests = new IndexerPageableRequestChain();
AddAudioPageableRequests(pageableRequests,
string.Format("&artist={0}",
searchCriteria.Artist.Name));
return pageableRequests;
}
private void AddAudioPageableRequests(IndexerPageableRequestChain chain, string parameters)
{
if (SupportsAudioSearch)
{
chain.AddTier();
chain.Add(GetPagedRequests(MaxPages, Settings.Categories, "music",
AddAudioPageableRequests(pageableRequests, searchCriteria,
string.Format("&artist={0}",
searchCriteria.Artist.Name));
}
if (SupportsSearch)
{
pageableRequests.AddTier();
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search",
string.Format("&q={0}",
parameters)));
NewsnabifyTitle(searchCriteria.Artist.Name))));
}
return pageableRequests;
}
private void AddAudioPageableRequests(IndexerPageableRequestChain chain, SearchCriteriaBase searchCriteria, string parameters)
{
chain.AddTier();
chain.Add(GetPagedRequests(MaxPages, Settings.Categories, "music",
string.Format("&q={0}",
parameters)));
}
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, IEnumerable<int> categories, string searchType, string parameters)

Loading…
Cancel
Save