mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
New: Added search support to Nyaa
This commit is contained in:
parent
09dcbf2618
commit
b9a5ff55ad
2 changed files with 20 additions and 6 deletions
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
public override string Name => "Nyaa";
|
public override string Name => "Nyaa";
|
||||||
|
|
||||||
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
public override DownloadProtocol Protocol => DownloadProtocol.Torrent;
|
||||||
public override int PageSize => 100;
|
public override int PageSize => 75;
|
||||||
|
|
||||||
public Nyaa(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
public Nyaa(IHttpClient httpClient, IIndexerStatusService indexerStatusService, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||||
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
: base(httpClient, indexerStatusService, configService, parsingService, logger)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||||
|
@ -13,8 +14,8 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
|
|
||||||
public NyaaRequestGenerator()
|
public NyaaRequestGenerator()
|
||||||
{
|
{
|
||||||
MaxPages = 30;
|
MaxPages = 3;
|
||||||
PageSize = 100;
|
PageSize = 75;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetRecentRequests()
|
public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||||
|
@ -28,12 +29,25 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(AlbumSearchCriteria searchCriteria)
|
public virtual IndexerPageableRequestChain GetSearchRequests(AlbumSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
|
var artistQuery = searchCriteria.CleanArtistQuery.Replace("+", " ").Trim();
|
||||||
|
var albumQuery = searchCriteria.CleanAlbumQuery.Replace("+", " ").Trim();
|
||||||
|
|
||||||
|
pageableRequests.Add(GetPagedRequests(MaxPages, PrepareQuery($"{artistQuery} {albumQuery}")));
|
||||||
|
|
||||||
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
|
public virtual IndexerPageableRequestChain GetSearchRequests(ArtistSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
|
var artistQuery = searchCriteria.CleanArtistQuery.Replace("+", " ").Trim();
|
||||||
|
|
||||||
|
pageableRequests.Add(GetPagedRequests(MaxPages, PrepareQuery(artistQuery)));
|
||||||
|
|
||||||
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string term)
|
private IEnumerable<IndexerRequest> GetPagedRequests(int maxPages, string term)
|
||||||
|
@ -62,7 +76,7 @@ namespace NzbDrone.Core.Indexers.Nyaa
|
||||||
|
|
||||||
private string PrepareQuery(string query)
|
private string PrepareQuery(string query)
|
||||||
{
|
{
|
||||||
return query.Replace(' ', '+');
|
return Uri.EscapeDataString(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue