1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Fixed: Updated HDBits api to api changes.

Closes #1448
This commit is contained in:
Björn Dahlgren 2016-09-03 11:18:19 +02:00 committed by Taloth
parent aa37b65842
commit 17f6841426
6 changed files with 70 additions and 11 deletions

View File

@ -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
}
}
]
}

View File

@ -27,10 +27,11 @@ public void Setup()
}; };
} }
[Test] [TestCase("Files/Indexers/HdBits/RecentFeedLongIDs.json")]
public void should_parse_recent_feed_from_HDBits() [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>() Mocker.GetMock<IHttpClient>()
.Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.POST))) .Setup(o => o.Execute(It.Is<HttpRequest>(v => v.Method == HttpMethod.POST)))

View File

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

View File

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

View File

@ -70,21 +70,21 @@ public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
return torrentInfos.ToArray(); return torrentInfos.ToArray();
} }
private string GetDownloadUrl(long torrentId) private string GetDownloadUrl(string torrentId)
{ {
var url = new HttpUri(_settings.BaseUrl) var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/download.php") .CombinePath("/download.php")
.AddQueryParam("id", torrentId.ToString()) .AddQueryParam("id", torrentId)
.AddQueryParam("passkey", _settings.ApiKey); .AddQueryParam("passkey", _settings.ApiKey);
return url.FullUri; return url.FullUri;
} }
private string GetInfoUrl(long torrentId) private string GetInfoUrl(string torrentId)
{ {
var url = new HttpUri(_settings.BaseUrl) var url = new HttpUri(_settings.BaseUrl)
.CombinePath("/details.php") .CombinePath("/details.php")
.AddQueryParam("id", torrentId.ToString()); .AddQueryParam("id", torrentId);
return url.FullUri; return url.FullUri;