|
|
|
@ -135,22 +135,22 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
var parameters = new NameValueCollection();
|
|
|
|
|
|
|
|
|
|
if (searchCriteria.Artist.IsNotNullOrWhiteSpace())
|
|
|
|
|
if (searchCriteria.Artist.IsNotNullOrWhiteSpace() && searchCriteria.Artist != "VA")
|
|
|
|
|
{
|
|
|
|
|
parameters.Add("artistname", searchCriteria.Artist);
|
|
|
|
|
parameters.Set("artistname", searchCriteria.Artist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchCriteria.Album.IsNotNullOrWhiteSpace())
|
|
|
|
|
{
|
|
|
|
|
parameters.Add("groupname", searchCriteria.Album);
|
|
|
|
|
parameters.Set("groupname", searchCriteria.Album);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchCriteria.Year.HasValue)
|
|
|
|
|
{
|
|
|
|
|
parameters.Add("year", searchCriteria.Year.ToString());
|
|
|
|
|
parameters.Set("year", searchCriteria.Year.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
|
}
|
|
|
|
@ -160,7 +160,7 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
var parameters = new NameValueCollection();
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
|
}
|
|
|
|
@ -180,28 +180,28 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
|
var parameters = new NameValueCollection();
|
|
|
|
|
|
|
|
|
|
pageableRequests.Add(GetRequest(searchCriteria, parameters));
|
|
|
|
|
pageableRequests.Add(GetPagedRequests(searchCriteria, parameters));
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IEnumerable<IndexerRequest> GetRequest(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
|
|
|
|
|
private IEnumerable<IndexerRequest> GetPagedRequests(SearchCriteriaBase searchCriteria, NameValueCollection parameters)
|
|
|
|
|
{
|
|
|
|
|
var term = searchCriteria.SanitizedSearchTerm.Trim();
|
|
|
|
|
|
|
|
|
|
parameters.Add("action", "browse");
|
|
|
|
|
parameters.Add("order_by", "time");
|
|
|
|
|
parameters.Add("order_way", "desc");
|
|
|
|
|
parameters.Add("searchstr", term);
|
|
|
|
|
parameters.Set("action", "browse");
|
|
|
|
|
parameters.Set("order_by", "time");
|
|
|
|
|
parameters.Set("order_way", "desc");
|
|
|
|
|
|
|
|
|
|
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
|
|
|
|
if (term.IsNotNullOrWhiteSpace())
|
|
|
|
|
{
|
|
|
|
|
parameters.Set("searchstr", term);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (queryCats.Count > 0)
|
|
|
|
|
var queryCats = _capabilities.Categories.MapTorznabCapsToTrackers(searchCriteria.Categories);
|
|
|
|
|
if (queryCats.Any())
|
|
|
|
|
{
|
|
|
|
|
foreach (var cat in queryCats)
|
|
|
|
|
{
|
|
|
|
|
parameters.Add($"filter_cat[{cat}]", "1");
|
|
|
|
|
}
|
|
|
|
|
queryCats.ForEach(cat => parameters.Set($"filter_cat[{cat}]", "1"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var request = RequestBuilder()
|
|
|
|
@ -267,12 +267,14 @@ namespace NzbDrone.Core.Indexers.Definitions
|
|
|
|
|
var release = new GazelleInfo
|
|
|
|
|
{
|
|
|
|
|
Guid = infoUrl,
|
|
|
|
|
InfoUrl = infoUrl,
|
|
|
|
|
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
|
|
|
|
Title = WebUtility.HtmlDecode(title),
|
|
|
|
|
Artist = WebUtility.HtmlDecode(result.Artist),
|
|
|
|
|
Album = WebUtility.HtmlDecode(result.GroupName),
|
|
|
|
|
Container = torrent.Encoding,
|
|
|
|
|
Codec = torrent.Format,
|
|
|
|
|
Size = long.Parse(torrent.Size),
|
|
|
|
|
DownloadUrl = GetDownloadUrl(id, torrent.CanUseToken),
|
|
|
|
|
InfoUrl = infoUrl,
|
|
|
|
|
Seeders = int.Parse(torrent.Seeders),
|
|
|
|
|
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
|
|
|
|
|
PublishDate = torrent.Time.ToUniversalTime(),
|
|
|
|
|