Merge pull request #499 from Radarr/patch/hdbits

Update HDBits to work with Radarr
This commit is contained in:
Devin Buhl 2017-01-28 16:52:36 -05:00 committed by GitHub
commit 8274cc016f
4 changed files with 26 additions and 10 deletions

View File

@ -27,4 +27,4 @@ namespace NzbDrone.Core.Indexers.HDBits
return new HDBitsParser(Settings);
}
}
}
}

View File

@ -129,4 +129,4 @@ namespace NzbDrone.Core.Indexers.HDBits
ImdbImportFail = 8,
ImdbTvNotAllowed = 9
}
}
}

View File

@ -87,4 +87,4 @@ namespace NzbDrone.Core.Indexers.HDBits
}
}
}
}

View File

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NzbDrone.Common.Http;
@ -45,17 +44,34 @@ namespace NzbDrone.Core.Indexers.HDBits
return new IndexerPageableRequestChain();
}
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
public virtual IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
{
var pageableRequests = new IndexerPageableRequestChain();
var queryBase = new TorrentQuery();
var query = queryBase.Clone();
query.ImdbInfo.Id = int.Parse(searchCriteria.Movie.ImdbId.Substring(2));
pageableRequests.Add(GetRequest(query));
if (TryAddSearchParameters(queryBase, searchCriteria))
{
var query = queryBase.Clone();
query.ImdbInfo.Id = int.Parse(searchCriteria.Movie.ImdbId.Substring(2));
pageableRequests.Add(GetRequest(query));
}
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)
{
var request = new HttpRequestBuilder(Settings.BaseUrl)
@ -75,4 +91,4 @@ namespace NzbDrone.Core.Indexers.HDBits
yield return new IndexerRequest(request);
}
}
}
}