Fixed: Updated HDBits api to api changes.

Closes #1448
pull/4/head
Björn Dahlgren 8 years ago committed by Taloth
parent aa37b65842
commit 17f6841426

@ -0,0 +1,57 @@
{
"status": 0,
"data": [
{
"id": "257142",
"hash": "EABC50AEF9F53CEDED84ADF14144D3368E586F3A",
"leechers": 1,
"seeders": 46,
"name": "Supernatural S10E17 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 49,
"size": 1718009717,
"utadded": 1428179446,
"added": "2015-04-04T20:30:46+0000",
"comments": 0,
"numfiles": 1,
"filename": "Supernatural.S10E17.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no",
"type_category": 2,
"type_codec": 1,
"type_medium": 6,
"type_origin": 0,
"username": "abc",
"owner": 1107944,
"tvdb": {
"id": 78901,
"season": 10,
"episode": 17
}
},
{
"id": "257140",
"hash": "BE3BA5396B9A30544353B55FDD89EDE46C8FB72A",
"leechers": 0,
"seeders": 18,
"name": "Scandal S04E18 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 19,
"size": 1789106197,
"utadded": 1428179128,
"added": "2015-04-04T20:25:28+0000",
"comments": 0,
"numfiles": 1,
"filename": "Scandal.2012.S04E18.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no",
"type_category": 2,
"type_codec": 1,
"type_medium": 6,
"type_origin": 0,
"username": "abc",
"owner": 1107944,
"tvdb": {
"id": 248841,
"season": 4,
"episode": 18
}
}
]
}

@ -27,10 +27,11 @@ namespace NzbDrone.Core.Test.IndexerTests.HDBitsTests
};
}
[Test]
public void should_parse_recent_feed_from_HDBits()
[TestCase("Files/Indexers/HdBits/RecentFeedLongIDs.json")]
[TestCase("Files/Indexers/HdBits/RecentFeedStringIDs.json")]
public void should_parse_recent_feed_from_HDBits(string fileName)
{
var responseJson = ReadAllText(@"Files/Indexers/HdBits/RecentFeed.json");
var responseJson = ReadAllText(fileName);
Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.POST)))

@ -373,6 +373,9 @@
<Compile Include="UpdateTests\UpdatePackageProviderFixture.cs" />
<Compile Include="UpdateTests\UpdateServiceFixture.cs" />
<Compile Include="XbmcVersionTests.cs" />
<None Include="Files\Indexers\HdBits\RecentFeedStringIDs.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Marr.Data\Marr.Data.csproj">
@ -408,7 +411,7 @@
<None Include="Files\Indexers\BroadcastheNet\RecentFeed.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Files\Indexers\HdBits\RecentFeed.json">
<None Include="Files\Indexers\HdBits\RecentFeedLongIDs.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="Files\html_image.jpg">

@ -10,8 +10,6 @@ namespace NzbDrone.Core.Indexers.HDBits
[JsonProperty(Required = Required.Always)]
public string Passkey { get; set; }
public int? Id { get; set; }
public string Hash { get; set; }
public string Search { get; set; }
@ -54,7 +52,7 @@ namespace NzbDrone.Core.Indexers.HDBits
public class TorrentQueryResponse
{
public long Id { get; set; }
public string Id { get; set; }
public string Hash { get; set; }
public int Leechers { get; set; }
public int Seeders { get; set; }

@ -70,21 +70,21 @@ namespace NzbDrone.Core.Indexers.HDBits
return torrentInfos.ToArray();
}
private string GetDownloadUrl(long torrentId)
private string GetDownloadUrl(string torrentId)
{
var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/download.php")
.AddQueryParam("id", torrentId.ToString())
.AddQueryParam("id", torrentId)
.AddQueryParam("passkey", _settings.ApiKey);
return url.FullUri;
}
private string GetInfoUrl(long torrentId)
private string GetInfoUrl(string torrentId)
{
var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/details.php")
.AddQueryParam("id", torrentId.ToString());
.AddQueryParam("id", torrentId);
return url.FullUri;

Loading…
Cancel
Save