mirror of
https://github.com/Jackett/Jackett
synced 2025-01-01 12:46:23 +00:00
Merge pull request #108 from zone117x/develop
BakaBT + Switch from x64 back to any cpu
This commit is contained in:
commit
d14eb12c00
25 changed files with 2407 additions and 71 deletions
|
@ -16,7 +16,7 @@
|
|||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
@ -42,8 +42,8 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Autofac.3.5.0\lib\net40\Autofac.dll</HintPath>
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
|
@ -70,15 +70,15 @@
|
|||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.0" targetFramework="net452" />
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net452" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net452" />
|
||||
|
@ -16,9 +16,9 @@
|
|||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net452" />
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Autofac.3.5.0\lib\net40\Autofac.dll</HintPath>
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
|
@ -63,9 +63,9 @@
|
|||
<Reference Include="Microsoft.Owin.Host.HttpListener">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.0" targetFramework="net452" />
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net452" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net452" />
|
||||
|
@ -15,7 +15,7 @@
|
|||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net452" />
|
||||
|
|
176
src/Jackett.Test/Indexers/BakaBTTests.cs
Normal file
176
src/Jackett.Test/Indexers/BakaBTTests.cs
Normal file
|
@ -0,0 +1,176 @@
|
|||
using Jackett.Utils.Clients;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Autofac;
|
||||
using Jackett.Indexers;
|
||||
using FluentAssertions;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Jackett;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace JackettTest.Indexers
|
||||
{
|
||||
[TestFixture]
|
||||
class BakaBTTests : TestBase
|
||||
{
|
||||
[Test]
|
||||
public async void should_return_be_able_to_login_successfully()
|
||||
{
|
||||
// Do Login
|
||||
TestUtil.RegisterStringCall(new WebRequest()
|
||||
{
|
||||
Url = "http://bakabt.me/login.php",
|
||||
Cookies = "bbtid=b",
|
||||
Type = RequestType.POST,
|
||||
Referer = "http://bakabt.me/",
|
||||
PostData = new Dictionary<string, string>()
|
||||
{
|
||||
{"username", "user" },
|
||||
{"password", "pwd" },
|
||||
{"returnto", "/index.php" }
|
||||
}
|
||||
}, (req) => {
|
||||
return new WebClientStringResult()
|
||||
{
|
||||
Status = System.Net.HttpStatusCode.Found,
|
||||
Cookies = "bbtid=c",
|
||||
};
|
||||
});
|
||||
|
||||
// Get login form
|
||||
TestUtil.RegisterStringCall(new WebRequest()
|
||||
{
|
||||
Url = "http://bakabt.me/login.php",
|
||||
Type = RequestType.GET
|
||||
}, (req) => {
|
||||
return new WebClientStringResult()
|
||||
{
|
||||
Cookies = "bbtid=b",
|
||||
Status = System.Net.HttpStatusCode.Found
|
||||
};
|
||||
});
|
||||
|
||||
// Get logged in page
|
||||
TestUtil.RegisterStringCall(new WebRequest()
|
||||
{
|
||||
Cookies = "bbtid=c",
|
||||
Type = RequestType.GET,
|
||||
Url = "http://bakabt.me/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&reorder=1&q="
|
||||
}, (req) => {
|
||||
return new WebClientStringResult()
|
||||
{
|
||||
Content = TestUtil.GetResource("Indexers/BakaBTTestsSearchPage.html"),
|
||||
Status = System.Net.HttpStatusCode.OK
|
||||
};
|
||||
});
|
||||
|
||||
var indexer = TestUtil.Container.ResolveNamed<IIndexer>(BakaBT.GetIndexerID(typeof(BakaBT))) as BakaBT;
|
||||
|
||||
indexer.DisplayName.Should().Be("BakaBT");
|
||||
indexer.DisplayDescription.Should().Be("Anime Community");
|
||||
indexer.ID.Should().Be("bakabt");
|
||||
|
||||
indexer.LoginUrl.Should().Be("http://bakabt.me/login.php");
|
||||
|
||||
var token = JObject.Parse("{\"username\":\"user\",\"password\":\"pwd\"}");
|
||||
await indexer.ApplyConfiguration(token);
|
||||
indexer.IsConfigured.Should().Be(true);
|
||||
|
||||
((string)TestUtil.IndexManager.LastSavedConfig["cookies"]).Should().Be("bbtid=c");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async void should_return_be_able_to_login_unsuccessfully()
|
||||
{
|
||||
// Do Login
|
||||
TestUtil.RegisterStringCall(new WebRequest()
|
||||
{
|
||||
Url = "http://bakabt.me/login.php",
|
||||
Cookies = "bbtid=b",
|
||||
Type = RequestType.POST,
|
||||
Referer = "http://bakabt.me/",
|
||||
PostData = new Dictionary<string, string>()
|
||||
{
|
||||
{"username", "user" },
|
||||
{"password", "pwd" },
|
||||
{"returnto", "/index.php" }
|
||||
}
|
||||
}, (req) => {
|
||||
return new WebClientStringResult()
|
||||
{
|
||||
Status = System.Net.HttpStatusCode.OK,
|
||||
Cookies = "bbtid=c",
|
||||
Content = TestUtil.GetResource("Indexers/BakaBTTestsLoginError.html"),
|
||||
};
|
||||
});
|
||||
|
||||
// Get login form
|
||||
TestUtil.RegisterStringCall(new WebRequest()
|
||||
{
|
||||
Url = "http://bakabt.me/login.php",
|
||||
Type = RequestType.GET
|
||||
}, (req) => {
|
||||
return new WebClientStringResult()
|
||||
{
|
||||
Cookies = "bbtid=b",
|
||||
Status = System.Net.HttpStatusCode.Found
|
||||
};
|
||||
});
|
||||
|
||||
var indexer = TestUtil.Container.ResolveNamed<IIndexer>(BakaBT.GetIndexerID(typeof(BakaBT))) as BakaBT;
|
||||
|
||||
var token = JObject.Parse("{\"username\":\"user\",\"password\":\"pwd\"}");
|
||||
try {
|
||||
await indexer.ApplyConfiguration(token);
|
||||
}
|
||||
catch(ExceptionWithConfigData e)
|
||||
{
|
||||
e.Message.Should().Be("Username or password is incorrect");
|
||||
}
|
||||
|
||||
indexer.IsConfigured.Should().Be(false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async void should_return_be_able_to_scrape_the_search_page()
|
||||
{
|
||||
// Do Search
|
||||
TestUtil.RegisterStringCall(new WebRequest()
|
||||
{
|
||||
Url = "http://bakabt.me/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&reorder=1&q=Series",
|
||||
Cookies = "bbtid=c",
|
||||
Type = RequestType.GET
|
||||
}, (req) => {
|
||||
return new WebClientStringResult()
|
||||
{
|
||||
Status = System.Net.HttpStatusCode.OK,
|
||||
Cookies = "bbtid=c",
|
||||
Content = TestUtil.GetResource("Indexers/BakaBTTestsSearchPage.html"),
|
||||
};
|
||||
});
|
||||
|
||||
var indexer = TestUtil.Container.ResolveNamed<IIndexer>(BakaBT.GetIndexerID(typeof(BakaBT))) as BakaBT;
|
||||
|
||||
indexer.LoadFromSavedConfiguration(JObject.Parse("{\"cookies\":\"bbtid=c\"}"));
|
||||
var results = await indexer.PerformQuery(new Jackett.Models.TorznabQuery() { SanitizedSearchTerm = "Series S1", Season = 1 });
|
||||
|
||||
results.Length.Should().Be(44);
|
||||
results[0].Title.Should().Be("Golden Time Season 1 (BD 720p) [FFF]");
|
||||
results[0].Guid.Should().Be("http://bakabt.me/torrent/180302/golden-time-bd-720p-fff");
|
||||
results[0].Comments.Should().Be("http://bakabt.me/torrent/180302/golden-time-bd-720p-fff");
|
||||
results[0].Size.Should().Be(10307921920);
|
||||
results[0].Description.Should().Be("Golden Time Season 1 (BD 720p) [FFF]");
|
||||
results[0].Link.Should().Be("http://bakabt.me/torrent/180302/golden-time-bd-720p-fff");
|
||||
results[0].Peers.Should().Be(161);
|
||||
results[0].Seeders.Should().Be(151);
|
||||
|
||||
results[1].Title.Should().Be("Yowamushi Pedal Season 1 (BD 720p) [Commie]");
|
||||
results[4].Title.Should().Be("Dungeon ni Deai o Motomeru no wa Machigatte Iru Darouka: Familia Myth Season 1 (480p) [HorribleSubs]");
|
||||
results[5].Title.Should().Be("Is It Wrong to Try to Pick Up Girls in a Dungeon? Season 1 (480p) [HorribleSubs]");
|
||||
}
|
||||
}
|
||||
}
|
59
src/Jackett.Test/Indexers/BakaBTTestsLoginError.html
Normal file
59
src/Jackett.Test/Indexers/BakaBTTestsLoginError.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<html class="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Login - BakaBT</title>
|
||||
<link rel="shortcut icon" href="/resources/img/favicon.png">
|
||||
<base href="/">
|
||||
<script type="text/javascript" async="" src="http://www.google-analytics.com/ga.js"></script>
|
||||
<script type="text/javascript" src="resources/61ccf6a181efcd89748c30755b9c6541.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="resources/61ccf6a181efcd89748c30755b9c6541.css">
|
||||
<script type="text/javascript">var user = create_user({"id":0,"class":0,"avatars":false});</script>
|
||||
<style type="text/css">
|
||||
.fancybox-margin {
|
||||
margin-right: 15px;
|
||||
}
|
||||
</style>
|
||||
<style type="text/css">
|
||||
@media print {
|
||||
.lpiframeoverlay {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="dango"></div><div class="heart" style="transform: rotate(0deg); bottom: 50px; right: 55px;"></div><div class="main">
|
||||
<div class="banner" style="background-image:url(images/banners/Grimmjow.jpg);"><a href="" class="home"></a><a href="rss.php?uid=0&pass=" class="icon rss" title="RSS Feed"></a></div><div class="headerbar"><ul><li><a href="">News</a></li><li><a href="browse.php">Browse</a></li><li><a href="http://forums.bakabt.me">Forums</a></li><li><a href="http://bakashots.me">BakaSHOTS</a><ul><li><a href="http://compare.bakashots.me">BakaCOMPARE</a></li></ul></li><li><a href="http://wiki.bakabt.me">Wiki</a><ul><li><a href="http://wiki.bakabt.me/index.php/Rules">Rules</a></li><li><a href="http://wiki.bakabt.me/index.php/FAQ">FAQ</a></li></ul></li><li><a href="http://wiki.bakabt.me/index.php/IRC" title="#bakabt@irc.rizon.net">IRC</a><ul><li><a href="webirc.php">Web IRC</a></li></ul></li><li><a href="http://www.cafepress.com/bakabt">Store</a></li><li><a href="donate.php">Donate</a></li><li><a href="#" onclick="return false;">More…</a><ul><li><a href="http://blog.bakabt.me">Blog</a></li><li><a href="topten.php">Top 10</a></li><li><a href="banners.php">Banners</a></li><li><a href="random" title="Go to a random torrent">Random</a></li><li><a href="keywords.php">Keywords</a></li></ul></li><li><form method="get" action="browse.php"><input type="text" maxlength="128" name="q"></form></li><li class="welcomeback">Welcome, <strong>Guest</strong>. <a href="login.php">Login</a> or <a href="signup.php">Signup</a></li></ul></div>
|
||||
<div class="content">
|
||||
<div class="login">
|
||||
<h1>Login</h1>
|
||||
<p class="error">Username or password is incorrect</p>
|
||||
<form method="post" action="login.php" name="login">
|
||||
<input type="text" name="username" placeholder="Username" autocomplete="off" style="cursor: auto; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QsPDiIBl+zfqgAAAdJJREFUOMvNkj9oU2EUxX/3e4+X2AYtgoIotAUVlZSiVQKCOFgwQ50cKhUcg4qbEITwvfyTjEKnCqUgbqJooQgFRXAROoiiKFWHOsdiSw0UXvK4DkloGl+wOHm2c7ice++5F/47ZLPZQ9baM21urU1Za0d61ZtOYq29FY/Hl0VkDhBARGRGRN75vl+JMnC7eCAi/cCItXZSVRsichJAVb9FGUg3933/tYicA76qaigix4FXxWLxQk+DXC43aIzZXa/XN13XHTLGLIqI0+ocApdVtSoiiUaj8aNSqbzftoLruneA67FY7M8OTaN5keawruvOApnuEM2/Xk1a6Y+p6j5VXReR/Y7jPANMu+tfDTqRz+dfAOOq+tEY07q/x1j6EqeG9rLx/QPPF5eo9fiDK8B4i5bb+pGJDBOpJH3EOJZKk5kcjX4k4CjQUNVPpVLpSVNKMHjAY315nun7D1gJoS8WjzYol8ulIAhGwzC8CWhTrfFy9h7Tj1yy+dsMO7BarfbOoBOFQkHB40TqLLt+fubL6h4uXp0iObDCzN2HVCNeOQL9nE6fZzg4yMbcG3Caan3n91/j6eMlfnmHmbpxjeTAJm8XFljb+Qpb8BIeQS3YVvMbj7WWjTVB6I8AAAAASUVORK5CYII=); background-attachment: scroll; background-position: 100% 50%; background-repeat: no-repeat;">
|
||||
<input type="password" name="password" onfocus="formInUse = true;" placeholder="Password" autocomplete="off" style="cursor: auto; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAASCAYAAABSO15qAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QsPDiIBl+zfqgAAAdJJREFUOMvNkj9oU2EUxX/3e4+X2AYtgoIotAUVlZSiVQKCOFgwQ50cKhUcg4qbEITwvfyTjEKnCqUgbqJooQgFRXAROoiiKFWHOsdiSw0UXvK4DkloGl+wOHm2c7ice++5F/47ZLPZQ9baM21urU1Za0d61ZtOYq29FY/Hl0VkDhBARGRGRN75vl+JMnC7eCAi/cCItXZSVRsichJAVb9FGUg3933/tYicA76qaigix4FXxWLxQk+DXC43aIzZXa/XN13XHTLGLIqI0+ocApdVtSoiiUaj8aNSqbzftoLruneA67FY7M8OTaN5keawruvOApnuEM2/Xk1a6Y+p6j5VXReR/Y7jPANMu+tfDTqRz+dfAOOq+tEY07q/x1j6EqeG9rLx/QPPF5eo9fiDK8B4i5bb+pGJDBOpJH3EOJZKk5kcjX4k4CjQUNVPpVLpSVNKMHjAY315nun7D1gJoS8WjzYol8ulIAhGwzC8CWhTrfFy9h7Tj1yy+dsMO7BarfbOoBOFQkHB40TqLLt+fubL6h4uXp0iObDCzN2HVCNeOQL9nE6fZzg4yMbcG3Caan3n91/j6eMlfnmHmbpxjeTAJm8XFljb+Qpb8BIeQS3YVvMbj7WWjTVB6I8AAAAASUVORK5CYII=); background-attachment: scroll; background-position: 100% 50%; background-repeat: no-repeat;">
|
||||
<input type="submit" value="Log in" class="border button">
|
||||
<input type="hidden" name="returnto" value="/index.php">
|
||||
</form>
|
||||
<p><a href="recover.php">Recover Password </a></p>
|
||||
<p><a href="signup.php">Sign up</a></p>
|
||||
<script type="text/javascript">
|
||||
var formInUse = false;
|
||||
$(document).ready(function() {
|
||||
if(!formInUse)
|
||||
document.login.username.focus();
|
||||
});
|
||||
|
||||
</script>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>try{function lpshowmenudiv(id){ closelpmenus(id); var div = document.getElementById('lppopup'+id); var btn = document.getElementById('lp'+id); if(btn && div){ var btnstyle = window.getComputedStyle(btn, null); var divstyle = window.getComputedStyle(div, null); var posx = btn.offsetLeft; posx -= 80; var divwidth = parseInt(divstyle.getPropertyValue('width')); if(posx + divwidth > window.innerWidth - 25){ posx -= ((posx + divwidth) - window.innerWidth + 25); } div.style.left = posx + "px"; div.style.top = (btn.offsetTop + parseInt(btnstyle.getPropertyValue('height'))) + "px"; if(div.style.display=='block'){div.style.display = 'none'; if(typeof(slideup)=='function'){slideup();} } else div.style.display = 'block'; } }function closelpmenus(id){ if(typeof(lpgblmenus)!='undefined'){ for(var i=0; i < lpgblmenus.length; i++){ if((id==null || lpgblmenus[i]!='lppopup'+id) && document.getElementById(lpgblmenus[i])) document.getElementById(lpgblmenus[i]).style.display = 'none'; } }} var lpcustomEvent = document.createEvent('Event'); lpcustomEvent.initEvent('lpCustomEventMenu', true, true); }catch(e){}</script>
|
||||
<script>try{if(typeof(lpgblmenus)=='undefined'){ lpgblmenus = new Array(); } lpgblmenus[lpgblmenus.length] = 'lppopupnever'; }catch(e){}</script>
|
||||
<script>try{document.addEventListener('mouseup', function(e){ if(typeof(closelpmenus)=='function'){closelpmenus();}}, false)}catch(e){}</script><div style="position: absolute; z-index: -10000; top: 0px; left: 0px; right: 0px; height: 592px;"></div>
|
||||
<script id="hiddenlpsubmitdiv" style="display: none;"></script>
|
||||
<script>try{for(var lastpass_iter=0; lastpass_iter < document.forms.length; lastpass_iter++){ var lastpass_f = document.forms[lastpass_iter]; if(typeof(lastpass_f.lpsubmitorig2)=="undefined"){ lastpass_f.lpsubmitorig2 = lastpass_f.submit; if (typeof(lastpass_f.lpsubmitorig2)=='object'){ continue;}lastpass_f.submit = function(){ var form=this; var customEvent = document.createEvent("Event"); customEvent.initEvent("lpCustomEvent", true, true); var d = document.getElementById("hiddenlpsubmitdiv"); if (d) {for(var i = 0; i < document.forms.length; i++){ if(document.forms[i]==form){ if (typeof(d.innerText) != 'undefined') { d.innerText=i.toString(); } else { d.textContent=i.toString(); } } } d.dispatchEvent(customEvent); }form.lpsubmitorig2(); } } }}catch(e){}</script>
|
||||
</body>
|
||||
</html>
|
1312
src/Jackett.Test/Indexers/BakaBTTestsSearchPage.html
Normal file
1312
src/Jackett.Test/Indexers/BakaBTTestsSearchPage.html
Normal file
File diff suppressed because it is too large
Load diff
212
src/Jackett.Test/Jackett.Test.csproj
Normal file
212
src/Jackett.Test/Jackett.Test.csproj
Normal file
|
@ -0,0 +1,212 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>JackettTest</RootNamespace>
|
||||
<AssemblyName>JackettTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.WebApi.Owin, Version=3.2.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.WebApi2.Owin.3.2.0\lib\net45\Autofac.Integration.WebApi.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="CsQuery, Version=1.3.3.249, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\CsQuery.1.3.4\lib\net40\CsQuery.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions, Version=3.4.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FluentAssertions.3.4.1\lib\net45\FluentAssertions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions.Core, Version=3.4.1.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\FluentAssertions.3.4.1\lib\net45\FluentAssertions.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core.interfaces, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.core.interfaces.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.util, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\nunit.util.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NUnit.VisualStudio.TestAdapter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4cb40d35494691ac, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnitTestAdapter.2.0.0\lib\NUnit.VisualStudio.TestAdapter.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="Indexers\BakaBTTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestBase.cs" />
|
||||
<Compile Include="TestIIndexerManagerServiceHelper.cs" />
|
||||
<Compile Include="TestUtil.cs" />
|
||||
<Compile Include="TestWebClient.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Jackett\Jackett.csproj">
|
||||
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
|
||||
<Name>Jackett</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Indexers\BakaBTTestsSearchPage.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Indexers\BakaBTTestsLoginError.html" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
src/Jackett.Test/Properties/AssemblyInfo.cs
Normal file
36
src/Jackett.Test/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Jackett.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Jackett.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e75d4f15-5da3-4332-adb1-28fb673dae56")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
18
src/Jackett.Test/TestBase.cs
Normal file
18
src/Jackett.Test/TestBase.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
abstract class TestBase
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
TestUtil.SetupContainer();
|
||||
}
|
||||
}
|
||||
}
|
46
src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
Normal file
46
src/Jackett.Test/TestIIndexerManagerServiceHelper.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using Jackett.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jackett.Indexers;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
class TestIndexerManagerServiceHelper : IIndexerManagerService
|
||||
{
|
||||
public JToken LastSavedConfig { get; set; }
|
||||
|
||||
public void DeleteIndexer(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<IIndexer> GetAllIndexers()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IIndexer GetIndexer(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void InitIndexers()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SaveConfig(IIndexer indexer, JToken obj)
|
||||
{
|
||||
LastSavedConfig = obj;
|
||||
}
|
||||
|
||||
public Task TestIndexer(string name)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
74
src/Jackett.Test/TestUtil.cs
Normal file
74
src/Jackett.Test/TestUtil.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using Autofac;
|
||||
using Jackett;
|
||||
using Jackett.Services;
|
||||
using Jackett.Utils.Clients;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
class TestUtil
|
||||
{
|
||||
private static IContainer testContainer = null;
|
||||
|
||||
public static void SetupContainer()
|
||||
{
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterModule<JackettModule>();
|
||||
builder.RegisterType<TestWebClient>().As<IWebClient>().SingleInstance();
|
||||
builder.RegisterInstance<Logger>(LogManager.GetCurrentClassLogger()).SingleInstance();
|
||||
builder.RegisterType<TestIndexerManagerServiceHelper>().As<IIndexerManagerService>().SingleInstance();
|
||||
testContainer = builder.Build();
|
||||
|
||||
// Register the container in itself to allow for late resolves
|
||||
var secondaryBuilder = new ContainerBuilder();
|
||||
secondaryBuilder.RegisterInstance<IContainer>(testContainer).SingleInstance();
|
||||
secondaryBuilder.Update(testContainer);
|
||||
}
|
||||
|
||||
public static TestIndexerManagerServiceHelper IndexManager
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContainer.Resolve<IIndexerManagerService>() as TestIndexerManagerServiceHelper;
|
||||
}
|
||||
}
|
||||
|
||||
public static IContainer Container
|
||||
{
|
||||
get { return testContainer; }
|
||||
}
|
||||
|
||||
public static void RegisterByteCall(WebRequest r, Func<WebRequest, WebClientByteResult> f)
|
||||
{
|
||||
var client = testContainer.Resolve<IWebClient>() as TestWebClient;
|
||||
client.RegisterByteCall(r, f);
|
||||
}
|
||||
|
||||
public static void RegisterStringCall(WebRequest r, Func<WebRequest, WebClientStringResult> f)
|
||||
{
|
||||
var client = testContainer.Resolve<IWebClient>() as TestWebClient;
|
||||
client.RegisterStringCall(r, f);
|
||||
}
|
||||
|
||||
public static string GetResource(string item)
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
var resourceName = "JackettTest." + item.Replace('/','.');
|
||||
|
||||
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
src/Jackett.Test/TestWebClient.cs
Normal file
35
src/Jackett.Test/TestWebClient.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using Jackett.Utils.Clients;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace JackettTest
|
||||
{
|
||||
public class TestWebClient : IWebClient
|
||||
{
|
||||
private Dictionary<WebRequest, Func<WebRequest, WebClientByteResult>> byteCallbacks = new Dictionary<WebRequest, Func<WebRequest, WebClientByteResult>>();
|
||||
private Dictionary<WebRequest, Func<WebRequest, WebClientStringResult>> stringCallbacks = new Dictionary<WebRequest, Func<WebRequest, WebClientStringResult>>();
|
||||
|
||||
public void RegisterByteCall(WebRequest req, Func<WebRequest, WebClientByteResult> f)
|
||||
{
|
||||
byteCallbacks.Add(req, f);
|
||||
}
|
||||
|
||||
public void RegisterStringCall(WebRequest req, Func<WebRequest, WebClientStringResult> f)
|
||||
{
|
||||
stringCallbacks.Add(req, f);
|
||||
}
|
||||
|
||||
public Task<WebClientByteResult> GetBytes(WebRequest request)
|
||||
{
|
||||
return Task.FromResult< WebClientByteResult>(byteCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request));
|
||||
}
|
||||
|
||||
public Task<WebClientStringResult> GetString(WebRequest request)
|
||||
{
|
||||
return Task.FromResult<WebClientStringResult>(stringCallbacks.Where(r => r.Key.Equals(request)).First().Value.Invoke(request));
|
||||
}
|
||||
}
|
||||
}
|
27
src/Jackett.Test/app.config
Normal file
27
src/Jackett.Test/app.config
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
25
src/Jackett.Test/packages.config
Normal file
25
src/Jackett.Test/packages.config
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net452" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net452" />
|
||||
<package id="CsQuery" version="1.3.4" targetFramework="net452" />
|
||||
<package id="FluentAssertions" version="3.4.1" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net452" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net452" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net452" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net452" />
|
||||
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net452" />
|
||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||
</packages>
|
|
@ -39,7 +39,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Autofac.3.5.0\lib\net40\Autofac.dll</HintPath>
|
||||
<HintPath>..\packages\Autofac.3.5.2\lib\net40\Autofac.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Owin, Version=3.1.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
@ -62,12 +62,12 @@
|
|||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.0" targetFramework="net452" />
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net452" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net452" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net452" />
|
||||
|
@ -14,8 +14,8 @@
|
|||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net452" />
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.23107.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett", "Jackett\Jackett.csproj", "{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}"
|
||||
EndProject
|
||||
|
@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Service", "Jackett.
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Tray", "Jackett.Tray\Jackett.Tray.csproj", "{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Test", "Jackett.Test\Jackett.Test.csproj", "{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -47,6 +49,10 @@ Global
|
|||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E75D4F15-5DA3-4332-ADB1-28FB673DAE56}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -3,6 +3,7 @@ using Jackett.Services;
|
|||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
@ -42,7 +43,12 @@ namespace Jackett.Controllers
|
|||
};
|
||||
}
|
||||
|
||||
if (!string.Equals(torznabQuery.ApiKey, serverService.Config.APIKey, StringComparison.InvariantCultureIgnoreCase))
|
||||
var allowBadApiDueToDebug = false;
|
||||
#if DEBUG
|
||||
allowBadApiDueToDebug = Debugger.IsAttached;
|
||||
#endif
|
||||
|
||||
if (!allowBadApiDueToDebug && !string.Equals(torznabQuery.ApiKey, serverService.Config.APIKey, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
logger.Warn(string.Format("A request from {0} was made with an incorrect API key.", Request.GetOwinContext().Request.RemoteIpAddress));
|
||||
return Request.CreateResponse(HttpStatusCode.Forbidden, "Incorrect API key");
|
||||
|
|
246
src/Jackett/Indexers/BakaBT.cs
Normal file
246
src/Jackett/Indexers/BakaBT.cs
Normal file
|
@ -0,0 +1,246 @@
|
|||
using CsQuery;
|
||||
using Jackett.Models;
|
||||
using Jackett.Services;
|
||||
using Jackett.Utils;
|
||||
using Jackett.Utils.Clients;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace Jackett.Indexers
|
||||
{
|
||||
public class BakaBT : BaseIndexer, IIndexer
|
||||
{
|
||||
public readonly string SearchUrl = "";
|
||||
public readonly string LoginUrl = "";
|
||||
private string cookieHeader = "";
|
||||
private IWebClient webclient;
|
||||
|
||||
public BakaBT(IIndexerManagerService i, IWebClient wc, Logger l)
|
||||
: base(name: "BakaBT",
|
||||
description: "Anime Community",
|
||||
link: new Uri("http://bakabt.me/"),
|
||||
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
|
||||
manager: i,
|
||||
logger: l)
|
||||
{
|
||||
TorznabCaps.Categories.Clear();
|
||||
TorznabCaps.Categories.Add(new TorznabCategory { ID = "5070", Name = "TV/Anime" });
|
||||
|
||||
SearchUrl = SiteLink + "browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&reorder=1&q=";
|
||||
LoginUrl = SiteLink + "login.php";
|
||||
webclient = wc;
|
||||
}
|
||||
|
||||
public Task<ConfigurationData> GetConfigurationForSetup()
|
||||
{
|
||||
var config = new ConfigurationDataBasicLogin();
|
||||
return Task.FromResult<ConfigurationData>((ConfigurationData)config);
|
||||
}
|
||||
|
||||
public async Task ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
var config = new ConfigurationDataBasicLogin();
|
||||
config.LoadValuesFromJson(configJson);
|
||||
|
||||
var loginForm = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = LoginUrl,
|
||||
Type = RequestType.GET
|
||||
});
|
||||
|
||||
var pairs = new Dictionary<string, string> {
|
||||
{ "username", config.Username.Value },
|
||||
{ "password", config.Password.Value },
|
||||
{ "returnto", "/index.php" }
|
||||
};
|
||||
|
||||
var response = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = LoginUrl,
|
||||
PostData = pairs,
|
||||
Referer = SiteLink.ToString(),
|
||||
Type = RequestType.POST,
|
||||
Cookies = loginForm.Cookies
|
||||
});
|
||||
|
||||
cookieHeader = response.Cookies;
|
||||
if (response.Status == HttpStatusCode.Found)
|
||||
{
|
||||
response = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = SearchUrl,
|
||||
Cookies = cookieHeader
|
||||
});
|
||||
}
|
||||
|
||||
var responseContent = response.Content;
|
||||
|
||||
if (!responseContent.Contains("<a href=\"logout.php\">Logout</a>"))
|
||||
{
|
||||
CQ dom = responseContent;
|
||||
var messageEl = dom[".error"].First();
|
||||
var errorMessage = messageEl.Text().Trim();
|
||||
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)config);
|
||||
}
|
||||
else
|
||||
{
|
||||
var configSaveData = new JObject();
|
||||
configSaveData["cookies"] = cookieHeader;
|
||||
SaveConfig(configSaveData);
|
||||
IsConfigured = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadFromSavedConfiguration(JToken jsonConfig)
|
||||
{
|
||||
cookieHeader = (string)jsonConfig["cookies"];
|
||||
IsConfigured = true;
|
||||
}
|
||||
|
||||
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)
|
||||
{
|
||||
|
||||
// This tracker only deals with full seasons so chop off the episode/season number if we have it D:
|
||||
if (!string.IsNullOrWhiteSpace(query.SanitizedSearchTerm))
|
||||
{
|
||||
var splitindex = query.SanitizedSearchTerm.LastIndexOf(' ');
|
||||
if (splitindex > -1)
|
||||
query.SanitizedSearchTerm = query.SanitizedSearchTerm.Substring(0, splitindex);
|
||||
}
|
||||
|
||||
var releases = new List<ReleaseInfo>();
|
||||
var searchString = query.SanitizedSearchTerm;
|
||||
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
|
||||
|
||||
var response = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = episodeSearchUrl,
|
||||
Cookies = cookieHeader
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
CQ dom = response.Content;
|
||||
var rows = dom[".torrents tr.torrent"];
|
||||
|
||||
foreach (var row in rows)
|
||||
{
|
||||
|
||||
var qRow = row.Cq();
|
||||
var qTitleLink = qRow.Find("a.title").First();
|
||||
var title = qTitleLink.Text().Trim();
|
||||
|
||||
// Insert before the release info
|
||||
var taidx = title.IndexOf('(');
|
||||
var tbidx = title.IndexOf('[');
|
||||
|
||||
if (taidx == -1)
|
||||
taidx = title.Length;
|
||||
|
||||
if (tbidx == -1)
|
||||
tbidx = title.Length;
|
||||
var titleSplit = Math.Min(taidx, tbidx);
|
||||
var titleSeries = title.Substring(0, titleSplit);
|
||||
var releaseInfo = title.Substring(titleSplit);
|
||||
|
||||
// For each over each pipe deliminated name
|
||||
foreach (var name in titleSeries.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
var release = new ReleaseInfo();
|
||||
|
||||
release.Title = (name + releaseInfo).Trim();
|
||||
// Ensure the season is defined as this tracker only deals with full seasons
|
||||
if (release.Title.IndexOf("Season") == -1)
|
||||
{
|
||||
// Insert before the release info
|
||||
var aidx = release.Title.IndexOf('(');
|
||||
var bidx = release.Title.IndexOf('[');
|
||||
|
||||
if (aidx == -1)
|
||||
aidx = release.Title.Length;
|
||||
|
||||
if (bidx == -1)
|
||||
bidx = release.Title.Length;
|
||||
|
||||
var insertPoint = Math.Min(aidx, bidx);
|
||||
release.Title = release.Title.Substring(0, insertPoint) + "Season 1 " + release.Title.Substring(insertPoint);
|
||||
}
|
||||
|
||||
release.Description = release.Title;
|
||||
release.Guid = new Uri(SiteLink + qTitleLink.Attr("href"));
|
||||
release.Comments = release.Guid;
|
||||
|
||||
release.Link = new Uri(SiteLink + qRow.Find(".peers a").First().Attr("href"));
|
||||
|
||||
release.Seeders = int.Parse(qRow.Find(".peers a").Get(0).InnerText);
|
||||
release.Peers = release.Seeders + int.Parse(qRow.Find(".peers a").Get(1).InnerText);
|
||||
|
||||
var size = qRow.Find(".size").First().Text().Split(' ');
|
||||
release.Size = ReleaseInfo.GetBytes(size[1], ParseUtil.CoerceFloat(size[0]));
|
||||
|
||||
//22 Jul 15
|
||||
var dateStr = qRow.Find(".added . datetime").First().Text().Replace("'", string.Empty);
|
||||
if (dateStr.Split(' ')[0].Length == 1)
|
||||
dateStr = "0" + dateStr;
|
||||
|
||||
if (string.Equals(dateStr, "yesterday", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
release.PublishDate = DateTime.Now.AddDays(-1);
|
||||
}
|
||||
else if (string.Equals(dateStr, "today", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
release.PublishDate = DateTime.Now;
|
||||
}
|
||||
else
|
||||
{
|
||||
release.PublishDate = DateTime.ParseExact(dateStr, "dd MMM yy", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
releases.Add(release);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
OnParseError(response.Content, ex);
|
||||
}
|
||||
|
||||
return releases.ToArray();
|
||||
}
|
||||
|
||||
public async Task<byte[]> Download(Uri link)
|
||||
{
|
||||
var downloadPage = await webclient.GetString(new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = link.ToString(),
|
||||
Cookies = cookieHeader
|
||||
});
|
||||
|
||||
CQ dom = downloadPage.Content;
|
||||
var downloadLink = dom.Find(".download_link").First().Attr("href");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(downloadLink))
|
||||
{
|
||||
throw new Exception("Unable to find download link.");
|
||||
}
|
||||
|
||||
downloadLink = SiteLink + downloadLink;
|
||||
|
||||
var response = await webclient.GetBytes(new Utils.Clients.WebRequest()
|
||||
{
|
||||
Url = downloadLink,
|
||||
Cookies = cookieHeader
|
||||
});
|
||||
|
||||
return response.Content;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,6 +27,8 @@
|
|||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
|
@ -84,15 +86,15 @@
|
|||
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Host.HttpListener, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.HttpListener.3.0.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Host.SystemWeb">
|
||||
<HintPath>..\packages\Microsoft.Owin.Host.SystemWeb.3.0.1\lib\net45\Microsoft.Owin.Host.SystemWeb.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=2.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Reference Include="Microsoft.Owin.Hosting, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Owin.Hosting.3.0.1\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
@ -153,6 +155,7 @@
|
|||
<Compile Include="Controllers\APIController.cs" />
|
||||
<Compile Include="Controllers\DownloadController.cs" />
|
||||
<Compile Include="Engine.cs" />
|
||||
<Compile Include="Indexers\BakaBT.cs" />
|
||||
<Compile Include="Indexers\BaseIndexer.cs" />
|
||||
<Compile Include="Indexers\BB.cs" />
|
||||
<Compile Include="Indexers\PrivateHD.cs" />
|
||||
|
@ -242,7 +245,9 @@
|
|||
<None Include="Content\fonts\glyphicons-halflings-regular.woff2">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Content\fonts\glyphicons-halflings-regular.woff">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
@ -272,7 +277,9 @@
|
|||
<Content Include="Content\logos\animebytes.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\logos\BakaBT.png" />
|
||||
<Content Include="Content\logos\BakaBT.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Content\logos\bb.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
@ -427,9 +434,11 @@
|
|||
</Properties>
|
||||
</MonoDevelop>
|
||||
</ProjectExtensions>
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureBclBuildImported" BeforeTargets="BeforeBuild" Condition="'$(BclBuildImported)' == ''">
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
|
||||
<Error Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -11,18 +11,18 @@ namespace Jackett.Models
|
|||
{
|
||||
public class TorznabQuery
|
||||
{
|
||||
public string QueryType { get; private set; }
|
||||
public string[] Categories { get; private set; }
|
||||
public int Extended { get; private set; }
|
||||
public string ApiKey { get; private set; }
|
||||
public int Limit { get; private set; }
|
||||
public int Offset { get; private set; }
|
||||
public int RageID { get; private set; }
|
||||
public string QueryType { get; set; }
|
||||
public string[] Categories { get; set; }
|
||||
public int Extended { get; set; }
|
||||
public string ApiKey { get; set; }
|
||||
public int Limit { get; set; }
|
||||
public int Offset { get; set; }
|
||||
public int RageID { get; set; }
|
||||
|
||||
public int Season { get; private set; }
|
||||
public string Episode { get; private set; }
|
||||
public string SearchTerm { get; private set; }
|
||||
public string SanitizedSearchTerm { get; private set; }
|
||||
public int Season { get; set; }
|
||||
public string Episode { get; set; }
|
||||
public string SearchTerm { get; set; }
|
||||
public string SanitizedSearchTerm { get; set; }
|
||||
|
||||
public string GetEpisodeSearchString()
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@ using System.Net;
|
|||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Jackett.CurlHelper;
|
||||
|
||||
namespace Jackett.Utils.Clients
|
||||
{
|
||||
|
@ -24,7 +23,7 @@ namespace Jackett.Utils.Clients
|
|||
|
||||
public async Task<WebClientByteResult> GetBytes(WebRequest request)
|
||||
{
|
||||
CurlResponse response;
|
||||
Jackett.CurlHelper.CurlResponse response;
|
||||
|
||||
logger.Debug(string.Format("UnixLibCurlWebClient:GetBytes(Url:{0})", request.Url));
|
||||
|
||||
|
|
|
@ -19,6 +19,56 @@ namespace Jackett.Utils.Clients
|
|||
public string Cookies { get; set; }
|
||||
public string Referer { get; set; }
|
||||
public RequestType Type { get; set; }
|
||||
|
||||
public override bool Equals(System.Object obj)
|
||||
{
|
||||
if(obj is WebRequest)
|
||||
{
|
||||
var other = obj as WebRequest;
|
||||
var postDataSame = PostData == null && other.PostData == null;
|
||||
if (!postDataSame)
|
||||
{
|
||||
if (!(PostData == null || other.PostData == null))
|
||||
{
|
||||
var ok = PostData.Count == other.PostData.Count;
|
||||
foreach(var i in PostData)
|
||||
{
|
||||
if (!other.PostData.ContainsKey(i.Key))
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if(PostData[i.Key] != other.PostData[i.Key])
|
||||
{
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ok)
|
||||
{
|
||||
postDataSame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return other.Url == Url &&
|
||||
other.Referer == Referer &&
|
||||
other.Cookies == Cookies &&
|
||||
other.Type == Type &&
|
||||
postDataSame;
|
||||
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public enum RequestType
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Autofac.WebApi" version="3.1.0" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net451" userInstalled="true" />
|
||||
<package id="CsQuery" version="1.3.4" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Autofac" version="3.5.2" targetFramework="net451" />
|
||||
<package id="Autofac.Owin" version="3.1.0" targetFramework="net451" />
|
||||
<package id="Autofac.WebApi" version="3.1.0" targetFramework="net451" />
|
||||
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net451" />
|
||||
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net451" />
|
||||
<package id="CsQuery" version="1.3.4" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebApi.Tracing" version="5.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net451" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net451" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net451" />
|
||||
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net451" userInstalled="true" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net451" userInstalled="true" />
|
||||
<package id="NLog.Windows.Forms" version="2.0.0.0" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Owin" version="1.0" targetFramework="net451" userInstalled="true" />
|
||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net451" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net451" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net451" />
|
||||
<package id="NLog.Windows.Forms" version="2.0.0.0" targetFramework="net451" />
|
||||
<package id="Owin" version="1.0" targetFramework="net451" />
|
||||
</packages>
|
Loading…
Reference in a new issue