Fix AnimeBytes caps, Change to 4.5 #117, change all trackers to retry failed requests

This commit is contained in:
KZ 2015-07-29 18:47:51 +01:00
parent 70b9ecee1b
commit 37cf3e569c
51 changed files with 191 additions and 126 deletions

View File

@ -10,6 +10,8 @@
<RootNamespace>CurlSharp</RootNamespace>
<AssemblyName>CurlSharp</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +22,7 @@
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
@ -29,6 +32,7 @@
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>LINUX</DefineConstants>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -31,4 +31,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

View File

@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Console</RootNamespace>
<AssemblyName>JackettConsole</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -55,6 +56,14 @@
<Reference Include="Autofac.Integration.WebApi.Owin">
<HintPath>..\packages\Autofac.WebApi2.Owin.3.2.0\lib\net45\Autofac.Integration.WebApi.Owin.dll</HintPath>
</Reference>
<Reference Include="AutoMapper, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="CommandLine, Version=1.9.71.2, Culture=neutral, PublicKeyToken=de6f01bd326f8c32, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
<Private>True</Private>
@ -162,6 +171,7 @@
</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>
<Import Project="..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets" Condition="Exists('..\packages\AutoMapper.3.3.1\tools\AutoMapper.targets')" />
<!-- 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">

View File

@ -4,6 +4,7 @@
<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="AutoMapper" version="3.3.1" targetFramework="net45" />
<package id="CommandLineParser" version="1.9.71" 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" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
</configuration>

View File

@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Distribution</RootNamespace>
<AssemblyName>JackettDistribution</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -27,4 +27,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

View File

@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Service</RootNamespace>
<AssemblyName>JackettService</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>

View File

@ -8,7 +8,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JackettTest</RootNamespace>
<AssemblyName>JackettTest</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@ -18,6 +18,7 @@
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View File

@ -24,4 +24,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /></startup></configuration>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
@ -27,4 +27,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>

View File

@ -9,11 +9,12 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Tray</RootNamespace>
<AssemblyName>JackettTray</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -143,6 +144,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
@ -156,7 +158,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="jackett.ico" />

View File

@ -8,10 +8,10 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Jackett.Tray.Properties
{
namespace Jackett.Tray.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
@ -22,48 +22,40 @@ namespace Jackett.Tray.Properties
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Jackett.Tray.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}

View File

@ -8,21 +8,17 @@
// </auto-generated>
//------------------------------------------------------------------------------
namespace Jackett.Tray.Properties
{
namespace Jackett.Tray.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}

View File

@ -2,7 +2,7 @@
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>

View File

@ -79,7 +79,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
var response = await RequestStringWithCookies(episodeSearchUrl);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -159,7 +159,7 @@ namespace Jackett.Indexers
}
// Get the content from the tracker
var response = await RequestStringWithCookies(queryUrl);
var response = await RequestStringWithCookiesAndRetry(queryUrl);
CQ dom = response.Content;
// Parse

View File

@ -74,7 +74,7 @@ namespace Jackett.Indexers
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -79,7 +79,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm;
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
var response = await RequestStringWithCookies(episodeSearchUrl);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -10,6 +10,7 @@ using Jackett.Services;
using Jackett.Utils;
using Jackett.Utils.Clients;
using AutoMapper;
using System.Threading;
namespace Jackett.Indexers
{
@ -201,6 +202,26 @@ namespace Jackett.Indexers
return await webclient.GetString(request);
}
protected async Task<WebClientStringResult> RequestStringWithCookiesAndRetry(string url, string cookieOverride = null, string referer = null)
{
Exception lastException = null;
for (int i = 0; i < 3; i++)
{
try
{
return await RequestStringWithCookies(url, cookieOverride, referer);
}
catch (Exception e)
{
logger.Error(string.Format("On attempt {0} checking for results from {1}: {2}", (i + 1), DisplayName, e.Message));
lastException= e;
await Task.Delay(500);
}
}
throw lastException;
}
protected async Task<WebClientByteResult> RequestBytesWithCookies(string url, string cookieOverride = null)
{
var request = new Utils.Clients.WebRequest()
@ -227,6 +248,26 @@ namespace Jackett.Indexers
return await webclient.GetString(request);
}
protected async Task<WebClientStringResult> PostDataWithCookiesAndRetry(string url, Dictionary<string, string> data, string cookieOverride = null)
{
Exception lastException = null;
for (int i = 0; i < 3; i++)
{
try
{
return await PostDataWithCookies(url,data,cookieOverride);
}
catch (Exception e)
{
logger.Error(string.Format("On attempt {0} checking for results from {1}: {2}", (i + 1), DisplayName, e.Message));
lastException = e;
await Task.Delay(500);
}
}
throw lastException;
}
protected async Task<WebClientStringResult> RequestLoginAndFollowRedirect(string url, Dictionary<string, string> data, string cookies, bool returnCookiesFromFirstCall, string redirectUrlOverride = null, string referer =null)
{
var request = new Utils.Clients.WebRequest()

View File

@ -62,7 +62,7 @@ namespace Jackett.Indexers
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
await FollowIfRedirect(results);
try
{

View File

@ -66,7 +66,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;

View File

@ -79,7 +79,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format("{0}?search={1}&cat=0", SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;

View File

@ -61,7 +61,7 @@ namespace Jackett.Indexers
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookies(episodeSearchUrl);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = response.Cookies;

View File

@ -78,7 +78,7 @@ namespace Jackett.Indexers
episodeSearchUrl = string.Format("{0}?search={1}&cat=0", SearchUrl, HttpUtility.UrlEncode(searchString));
}
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;

View File

@ -67,7 +67,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookies(episodeSearchUrl);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
var results = response.Content;
try

View File

@ -65,7 +65,7 @@ namespace Jackett.Indexers
var searchurls = new List<string>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var searchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()));
var results = await RequestStringWithCookies(searchUrl);
var results = await RequestStringWithCookiesAndRetry(searchUrl);
try
{
CQ dom = results.Content;

View File

@ -72,22 +72,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
WebClientStringResult response = null;
// Their web server is fairly flakey - try up to three times.
for (int i = 0; i < 3; i++)
{
try
{
response = await RequestStringWithCookies(episodeSearchUrl, null, SearchUrl);
break;
}
catch (Exception e)
{
logger.Error("On attempt " + (i + 1) + " checking for results from IPTorrents: " + e.Message);
}
}
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl, null, SearchUrl);
var results = response.Content;
try

View File

@ -103,7 +103,7 @@ namespace Jackett.Indexers
searchUrl += string.Format(QueryString, HttpUtility.UrlEncode(searchString));
}
var results = await RequestStringWithCookies(searchUrl);
var results = await RequestStringWithCookiesAndRetry(searchUrl);
try
{

View File

@ -77,21 +77,10 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
WebClientStringResult response = null;
WebClientStringResult response = null;
response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
// Their web server is fairly flakey - try up to three times.
for(int i = 0; i < 3; i++)
{
try
{
response = await RequestStringWithCookies(episodeSearchUrl);
break;
}
catch (Exception e){
logger.Error("On attempt " + (i+1) + " checking for results from MoreThanTv: " + e.Message );
}
}
try
{
var json = JObject.Parse(response.Content);

View File

@ -75,7 +75,7 @@ namespace Jackett.Indexers
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookies(episodeSearchUrl);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -67,7 +67,7 @@ namespace Jackett.Indexers
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var response = await RequestStringWithCookies(episodeSearchUrl);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -66,7 +66,7 @@ namespace Jackett.Indexers
async Task<string> GetToken(string url)
{
var response = await RequestStringWithCookies(url + TokenUrl);
var response = await RequestStringWithCookiesAndRetry(url + TokenUrl);
JObject obj = JObject.Parse(response.Content);
return (string)obj["token"];
}
@ -86,7 +86,7 @@ namespace Jackett.Indexers
else
searchUrl = string.Format(baseUrl + SearchQueryUrl, query.SanitizedSearchTerm, token);
var results = await RequestStringWithCookies(searchUrl);
var results = await RequestStringWithCookiesAndRetry(searchUrl);
try
{
var jItems = JArray.Parse(results.Content);

View File

@ -64,7 +64,7 @@ namespace Jackett.Indexers
var searchSection = string.IsNullOrEmpty(query.Episode) ? "archive" : "browse";
var searchCategory = string.IsNullOrEmpty(query.Episode) ? "26" : "27";
var searchUrl = string.Format(SearchUrl, searchSection, searchCategory, searchString);
var results = await RequestStringWithCookies(searchUrl);
var results = await RequestStringWithCookiesAndRetry(searchUrl);
try
{

View File

@ -77,7 +77,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(searchAllUrl);
var result = await RequestStringWithCookies(episodeSearchUrl, string.Empty);
var result = await RequestStringWithCookiesAndRetry(episodeSearchUrl, string.Empty);
var xmlDoc = new XmlDocument();
try

View File

@ -66,7 +66,7 @@ namespace Jackett.Indexers
var formData = HttpUtility.ParseQueryString(SearchFormData);
var formDict = formData.AllKeys.ToDictionary(t => t, t => formData[t]);
formDict.Add("search", query.SanitizedSearchTerm);
var response = await PostDataWithCookies(SearchUrl, formDict);
var response = await PostDataWithCookiesAndRetry(SearchUrl, formDict);
try
{
var jsonResult = JObject.Parse(response.Content);

View File

@ -64,7 +64,7 @@ namespace Jackett.Indexers
var searchString = searchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl =string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()));
var results = await RequestStringWithCookies(episodeSearchUrl, string.Empty);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl, string.Empty);
try
{
var jResults = JObject.Parse(results.Content);

View File

@ -76,7 +76,7 @@ namespace Jackett.Indexers
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var queryStr = HttpUtility.UrlEncode(searchString);
var episodeSearchUrl = baseUrl + string.Format(SearchUrl, queryStr);
var response = await RequestStringWithCookies(episodeSearchUrl, string.Empty);
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl, string.Empty);
try
{

View File

@ -68,7 +68,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -64,7 +64,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;

View File

@ -66,7 +66,7 @@ namespace Jackett.Indexers
var releases = new List<ReleaseInfo>();
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
var results = await RequestStringWithCookies(episodeSearchUrl);
var results = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{
CQ dom = results.Content;

View File

@ -62,7 +62,7 @@ namespace Jackett.Indexers
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString.Trim()));
var xmlDoc = new XmlDocument();
string xml = string.Empty;
var result = await RequestStringWithCookies(episodeSearchUrl);
var result = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
try
{

View File

@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett</RootNamespace>
<AssemblyName>Jackett</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
@ -255,9 +255,12 @@
<Compile Include="Utils\WebAPIRequestLogger.cs" />
<Compile Include="Utils\WebAPIToNLogTracer.cs" />
<Compile Include="Utils\Clients\WindowsWebClient.cs" />
<Compile Include="WebAPIExceptionLogger.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="Content\fonts\fontawesome-webfont.eot">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

@ -21,10 +21,16 @@ namespace Jackett.Models
public TorznabCapabilities()
{
Categories = new List<TorznabCategory>();
SearchAvailable = true;
TVSearchAvailable = true;
SupportsTVRageSearch = false;
}
public TorznabCapabilities(params TorznabCategory[] cats)
{
SearchAvailable = true;
TVSearchAvailable = true;
SupportsTVRageSearch = false;
Categories = new List<TorznabCategory>();
Categories.AddRange(cats);
}

View File

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -72,7 +72,7 @@ namespace Jackett.Properties {
/// &lt;webMaster&gt;($email) (HDA Invites)&lt;/webMaster&gt;
/// &lt;category&gt;search&lt;/category&gt;
/// &lt;image&gt;
/// &lt;url&gt;https://hdac [rest of string was truncated]&quot;;.
/// &lt;url&gt;h [rest of string was truncated]&quot;;.
/// </summary>
internal static string test {
get {

View File

@ -105,13 +105,9 @@ namespace Jackett.Services
{
logger.Info("Starting Jackett " + configService.GetVersion());
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
// Allow all SSL.. sucks I know but mono on linux is having problems without it..
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// Load indexers
indexerService.InitIndexers();
}
public void Start()

View File

@ -18,7 +18,6 @@ namespace Jackett.Utils.Clients
public WindowsWebClient(Logger l)
{
logger = l;
}
public async Task<WebClientByteResult> GetBytes(WebRequest request)
@ -65,7 +64,7 @@ namespace Jackett.Utils.Clients
client.DefaultRequestHeaders.Add("User-Agent", BrowserUtil.ChromeUserAgent);
HttpResponseMessage response = null;
if (request.Type == RequestType.POST)
{
var content = new FormUrlEncodedContent(request.PostData);

View File

@ -38,5 +38,23 @@ namespace Jackett.Utils
return sb.ToString();
}
public static string GetExceptionDetails(this Exception exception)
{
var properties = exception.GetType()
.GetProperties();
var fields = properties
.Select(property => new {
Name = property.Name,
Value = property.GetValue(exception, null)
})
.Select(x => String.Format(
"{0} = {1}",
x.Name,
x.Value != null ? x.Value.ToString() : String.Empty
));
return String.Join("\n", fields);
}
}
}

View File

@ -12,9 +12,6 @@ namespace Jackett.Utils
public static TorznabCapabilities CreateDefaultTorznabTVCaps()
{
var caps = new TorznabCapabilities();
caps.SearchAvailable = true;
caps.TVSearchAvailable = true;
caps.SupportsTVRageSearch = false;
caps.Categories.AddRange(new[] {
TorznabCatType.TV,
TorznabCatType.TVSD,
@ -22,6 +19,5 @@ namespace Jackett.Utils
});
return caps;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web.Http.ExceptionHandling;
using Jackett.Utils;
namespace Jackett
{
class WebAPIExceptionLogger : IExceptionLogger
{
public async Task LogAsync(ExceptionLoggerContext context, CancellationToken cancellationToken)
{
Engine.Logger.Error("Unhandled exception: " + context.Exception.GetExceptionDetails());
var request = await context.Request.Content.ReadAsStringAsync();
Engine.Logger.Error("Unhandled exception url: " + context.Request.RequestUri);
Engine.Logger.Error("Unhandled exception request body: " + request);
}
}
}

View File

@ -5,7 +5,7 @@
<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="AutoMapper" version="3.3.1" targetFramework="net451" />
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
<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" />