|
|
@ -1,4 +1,3 @@
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
@ -45,17 +44,34 @@ namespace NzbDrone.Core.Indexers.HDBits
|
|
|
|
return new IndexerPageableRequestChain();
|
|
|
|
return new IndexerPageableRequestChain();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
|
|
|
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
var pageableRequests = new IndexerPageableRequestChain();
|
|
|
|
var queryBase = new TorrentQuery();
|
|
|
|
var queryBase = new TorrentQuery();
|
|
|
|
var query = queryBase.Clone();
|
|
|
|
|
|
|
|
query.ImdbInfo.Id = int.Parse(searchCriteria.Movie.ImdbId.Substring(2));
|
|
|
|
if (TryAddSearchParameters(queryBase, searchCriteria))
|
|
|
|
pageableRequests.Add(GetRequest(query));
|
|
|
|
{
|
|
|
|
|
|
|
|
var query = queryBase.Clone();
|
|
|
|
|
|
|
|
query.ImdbInfo.Id = int.Parse(searchCriteria.Movie.ImdbId.Substring(2));
|
|
|
|
|
|
|
|
pageableRequests.Add(GetRequest(query));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pageableRequests;
|
|
|
|
return pageableRequests;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool TryAddSearchParameters(TorrentQuery query, SearchCriteriaBase searchCriteria)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var imdbId = int.Parse(searchCriteria.Movie.ImdbId.Substring(2));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (imdbId != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
query.ImdbInfo = query.ImdbInfo ?? new ImdbInfo();
|
|
|
|
|
|
|
|
query.ImdbInfo.Id = imdbId;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private IEnumerable<IndexerRequest> GetRequest(TorrentQuery query)
|
|
|
|
private IEnumerable<IndexerRequest> GetRequest(TorrentQuery query)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var request = new HttpRequestBuilder(Settings.BaseUrl)
|
|
|
|
var request = new HttpRequestBuilder(Settings.BaseUrl)
|
|
|
|