Reinstate changes from merge

This commit is contained in:
Kayomani
2015-07-19 15:08:56 +01:00
128 changed files with 2767 additions and 1176 deletions

15
Build.bat Normal file
View File

@@ -0,0 +1,15 @@
rmdir /s /q build
cd src
Msbuild Jackett.sln /t:Clean,Build /p:Configuration=Release
cd ..
xcopy src\Jackett.Console\bin\Release Build\ /e /y
copy /Y src\Jackett.Service\bin\Release\JackettService.exe build\JackettService.exe
copy /Y src\Jackett.Service\bin\Release\JackettService.exe.config build\JackettService.exe.config
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe build\JackettTray.exe
copy /Y src\Jackett.Tray\bin\Release\JackettTray.exe.config build\JackettTray.exe.config
cd build
del *.pdb
del *.xml
cd ..

58
Installer.iss Normal file
View File

@@ -0,0 +1,58 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Jackett"
#define MyAppVersion "0.5"
#define MyAppPublisher "Jackett Inc."
#define MyAppURL "https://github.com/zone117x/Jackett"
#define MyAppExeName "JackettTray.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{C2A9FC00-AA48-4F17-9A72-62FBCEE2785B}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
SetupIconFile=O:\Documents\JackettKayo\src\Jackett.Console\jackett.ico
Compression=lzma
SolidCompression=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "windowsService"; Description: "Install as a Windows Service"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "O:\Documents\JackettKayo\Build\JackettTray.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "O:\Documents\JackettKayo\Build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Run]
Filename: "{app}\JackettConsole.exe"; Parameters: "/u"; Flags: waituntilterminated;
Filename: "{app}\JackettConsole.exe"; Parameters: "/r"; Flags: waituntilterminated;
Filename: "{app}\JackettConsole.exe"; Parameters: "/i"; Flags: waituntilterminated; Tasks: windowsService
[UninstallRun]
Filename: "{app}\JackettConsole.exe"; Parameters: "/u"; Flags: waituntilterminated skipifdoesntexist

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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>
<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="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.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="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.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Console</RootNamespace>
<AssemblyName>JackettConsole</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>jackett.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<StartupObject>JackettConsole.Program</StartupObject>
</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>
</Reference>
<Reference Include="Autofac.Integration.Owin">
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
</Reference>
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
</Reference>
<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="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.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<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>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Owin.Hosting">
<HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\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">
<HintPath>..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.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">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
</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.Core" />
<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.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">
<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.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.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>
<Content Include="jackett.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,50 @@
using Jackett;
using Jackett.Indexers;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
namespace JackettConsole
{
public class Program
{
static void Main(string[] args)
{
try
{
if (args.Length > 0)
{
switch (args[0].ToLowerInvariant())
{
case "/i":
Engine.ServiceConfig.Install();
return;
case "/r":
Engine.Server.ReserveUrls();
return;
case "/u":
Engine.Server.ReserveUrls(false);
Engine.ServiceConfig.Uninstall();
return;
}
}
Engine.Server.Start();
Engine.Logger.Info("Running in headless mode.");
Engine.RunTime.Spin();
Engine.Logger.Info("Server thread exit");
}
catch(Exception e)
{
Engine.Logger.Error(e, "Top level exception");
}
}
}
}

View 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.Console")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jackett.Console")]
[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("4e2a81da-e235-4a88-ad20-38aabbfbf33c")]
// 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")]

View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="3.5.0" targetFramework="net452" userInstalled="true" />
<package id="Autofac.Owin" version="3.1.0" targetFramework="net452" userInstalled="true" />
<package id="Autofac.WebApi2" version="3.4.0" targetFramework="net452" userInstalled="true" />
<package id="Autofac.WebApi2.Owin" version="3.2.0" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.Owin.Host.HttpListener" version="2.0.2" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.Owin.Hosting" version="2.0.2" targetFramework="net452" userInstalled="true" />
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" userInstalled="true" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" userInstalled="true" />
<package id="NLog" version="4.0.1" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" userInstalled="true" />
</packages>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<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>

View File

@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Service</RootNamespace>
<AssemblyName>JackettService</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>jackett.ico</ApplicationIcon>
</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>
</Reference>
<Reference Include="Autofac.Integration.Owin">
<HintPath>..\packages\Autofac.Owin.3.1.0\lib\net45\Autofac.Integration.Owin.dll</HintPath>
</Reference>
<Reference Include="Autofac.Integration.WebApi, Version=3.4.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Autofac.WebApi2.3.4.0\lib\net45\Autofac.Integration.WebApi.dll</HintPath>
</Reference>
<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="Microsoft.Owin, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Owin.FileSystems, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.FileSystems.3.0.1\lib\net45\Microsoft.Owin.FileSystems.dll</HintPath>
</Reference>
<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>
<Reference Include="Microsoft.Owin.StaticFiles, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.Owin.StaticFiles.3.0.1\lib\net45\Microsoft.Owin.StaticFiles.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.Owin, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.WebApi.Owin.5.2.3\lib\net45\System.Web.Http.Owin.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Service.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Service.Designer.cs">
<DependentUpon>Service.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Content Include="jackett.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Jackett\Jackett.csproj">
<Project>{e636d5f8-68b4-4903-b4ed-ccfd9c9e899f}</Project>
<Name>Jackett</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace Jackett.Service
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Service()
};
ServiceBase.Run(ServicesToRun);
}
}
}

View 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.Service")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jackett.Service")]
[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("bf611f7b-4658-4cb8-aa9e-0736fadaa3ba")]
// 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")]

37
src/Jackett.Service/Service.Designer.cs generated Normal file
View File

@@ -0,0 +1,37 @@
namespace Jackett.Service
{
partial class Service
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.ServiceName = "Jackett";
}
#endregion
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace Jackett.Service
{
public partial class Service : ServiceBase
{
public Service()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
Engine.Logger.Info("Service starting");
Engine.Server.Start();
Engine.Logger.Info("Service started");
}
protected override void OnStop()
{
Engine.Logger.Info("Service stopping");
Engine.Server.Stop();
}
}
}

View File

Before

Width:  |  Height:  |  Size: 361 KiB

After

Width:  |  Height:  |  Size: 361 KiB

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Autofac" version="3.5.0" 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="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.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.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" />
<package id="Owin" version="1.0" targetFramework="net452" />
</packages>

View File

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

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Jackett.Tray</RootNamespace>
<AssemblyName>JackettTray</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<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' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>jackett.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.cs">
<DependentUpon>Main.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="jackett.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,6 +1,4 @@
#if !__MonoCS__
namespace Jackett
namespace JackettTray
{
partial class Main
{
@@ -100,4 +98,3 @@ namespace Jackett
}
}
#endif

View File

@@ -13,7 +13,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Jackett
namespace JackettTray
{
public partial class Main : Form
{
@@ -28,13 +28,13 @@ namespace Jackett
toolStripMenuItemWebUI.Click += toolStripMenuItemWebUI_Click;
toolStripMenuItemShutdown.Click += toolStripMenuItemShutdown_Click;
if (Program.IsFirstRun)
AutoStart = true;
//if (Server.IsFirstRun)
// AutoStart = true;
}
void toolStripMenuItemWebUI_Click(object sender, EventArgs e)
{
Process.Start("http://127.0.0.1:" + Server.Port);
// Process.Start("http://127.0.0.1:" + Server.Port);
}
void toolStripMenuItemShutdown_Click(object sender, EventArgs e)
@@ -84,12 +84,12 @@ namespace Jackett
private void CreateShortcut()
{
var appPath = Assembly.GetExecutingAssembly().Location;
/* var appPath = Assembly.GetExecutingAssembly().Location;
var shell = new IWshRuntimeLibrary.WshShell();
var shortcut = (IWshRuntimeLibrary.IWshShortcut)shell.CreateShortcut(ShortcutPath);
shortcut.Description = Assembly.GetExecutingAssembly().GetName().Name;
shortcut.TargetPath = appPath;
shortcut.Save();
shortcut.Save();*/
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace JackettTray
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
}
}

View 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.Tray")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jackett.Tray")]
[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("ff9025b1-ec14-4aa9-8081-9f69c5e35b63")]
// 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")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Jackett.Tray.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[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
{
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()
{
}
/// <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))
{
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
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
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
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

@@ -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.22823.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett", "Jackett\Jackett.csproj", "{E636D5F8-68B4-4903-B4ED-CCFD9C9E899F}"
EndProject
@@ -13,6 +13,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Console", "Jackett.Console\Jackett.Console.csproj", "{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Service", "Jackett.Service\Jackett.Service.csproj", "{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jackett.Tray", "Jackett.Tray\Jackett.Tray.csproj", "{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +33,18 @@ Global
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74420A79-CC16-442C-8B1E-7C1B913844F0}.Release|Any CPU.Build.0 = Release|Any CPU
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E2A81DA-E235-4A88-AD20-38AABBFBF33C}.Release|Any CPU.Build.0 = Release|Any CPU
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BF611F7B-4658-4CB8-AA9E-0736FADAA3BA}.Release|Any CPU.Build.0 = Release|Any CPU
{FF9025B1-EC14-4AA9-8081-9F69C5E35B63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Jackett
{
public class ApiKey
{
public static string CurrentKey;
const string chars = "abcdefghijklmnopqrstuvwxyz0123456789";
public static string Generate()
{
var randBytes = new byte[32];
var rngCsp = new RNGCryptoServiceProvider();
rngCsp.GetBytes(randBytes);
var key = "";
foreach (var b in randBytes)
{
key += chars[b % chars.Length];
}
return key;
}
}
}

View File

@@ -9,7 +9,27 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.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="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.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="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.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@@ -13,14 +13,14 @@ $("#change-jackett-port").click(function () {
var jackett_port = $("#jackett-port").val();
var jsonObject = JSON.parse('{"port":"' + jackett_port + '"}');
var jqxhr = $.post("apply_jackett_config", JSON.stringify(jsonObject), function (data) {
var jqxhr = $.post("admin/apply_jackett_config", JSON.stringify(jsonObject), function (data) {
if (data.result == "error") {
doNotify("Error: " + data.error, "danger", "glyphicon glyphicon-alert");
return;
} else {
doNotify("The port has been changed. Jackett will now restart...", "success", "glyphicon glyphicon-ok");
var jqxhr0 = $.post("jackett_restart", null, function (data_restart) { });
var jqxhr0 = $.post("admin/jackett_restart", null, function (data_restart) { });
window.setTimeout(function () {
url = window.location.href;
@@ -35,7 +35,7 @@ $("#change-jackett-port").click(function () {
});
function getJackettConfig(callback) {
var jqxhr = $.get("get_jackett_config", function (data) {
var jqxhr = $.get("admin/get_jackett_config", function (data) {
callback(data);
}).fail(function () {
@@ -47,7 +47,7 @@ function reloadIndexers() {
$('#indexers').hide();
$('#indexers > .indexer').remove();
$('#unconfigured-indexers').empty();
var jqxhr = $.get("get_indexers", function (data) {
var jqxhr = $.get("admin/get_indexers", function (data) {
$("#api-key-input").val(data.api_key);
$("#app-version").html(data.app_version);
displayIndexers(data.items);
@@ -82,7 +82,7 @@ function prepareDeleteButtons() {
var $btn = $(btn);
var id = $btn.data("id");
$btn.click(function () {
var jqxhr = $.post("delete_indexer", JSON.stringify({ indexer: id }), function (data) {
var jqxhr = $.post("admin/delete_indexer", JSON.stringify({ indexer: id }), function (data) {
if (data.result == "error") {
doNotify("Delete error for " + id + "\n" + data.error, "danger", "glyphicon glyphicon-alert");
}
@@ -114,7 +114,7 @@ function prepareTestButtons() {
var id = $btn.data("id");
$btn.click(function () {
doNotify("Test started for " + id, "info", "glyphicon glyphicon-transfer");
var jqxhr = $.post("test_indexer", JSON.stringify({ indexer: id }), function (data) {
var jqxhr = $.post("admin/test_indexer", JSON.stringify({ indexer: id }), function (data) {
if (data.result == "error") {
doNotify("Test failed for " + data.name + "\n" + data.error, "danger", "glyphicon glyphicon-alert");
}
@@ -130,7 +130,7 @@ function prepareTestButtons() {
function displayIndexerSetup(id) {
var jqxhr = $.post("get_config_form", JSON.stringify({ indexer: id }), function (data) {
var jqxhr = $.post("admin/get_config_form", JSON.stringify({ indexer: id }), function (data) {
if (data.result == "error") {
doNotify("Error: " + data.error, "danger", "glyphicon glyphicon-alert");
return;
@@ -200,7 +200,7 @@ function populateSetupForm(indexerId, name, config) {
$goButton.prop('disabled', true);
$goButton.html($('#templates > .spinner')[0].outerHTML);
var jqxhr = $.post("configure_indexer", JSON.stringify(data), function (data) {
var jqxhr = $.post("admin/configure_indexer", JSON.stringify(data), function (data) {
if (data.result == "error") {
if (data.config) {
populateConfigItems(configForm, data.config);

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

Before

Width:  |  Height:  |  Size: 8.9 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@@ -0,0 +1,73 @@
using Jackett.Models;
using Jackett.Services;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
namespace Jackett.Controllers
{
public class APIController : ApiController
{
private IIndexerManagerService indexerService;
private Logger logger;
public APIController(IIndexerManagerService i, Logger l)
{
indexerService = i;
logger = l;
}
[HttpGet]
public async Task<HttpResponseMessage> Call(string indexerName)
{
var indexer = indexerService.GetIndexer(indexerName);
var torznabQuery = TorznabQuery.FromHttpQuery(HttpUtility.ParseQueryString(Request.RequestUri.Query));
if (torznabQuery.RageIDLookupEnabled && indexer.RequiresRageIDLookupDisabled)
{
throw new ArgumentException("This indexer requires RageID lookup disabled");
}
var releases = await indexer.PerformQuery(torznabQuery);
logger.Debug(string.Format("Found {0} releases from {1}", releases.Length, indexer.DisplayName));
var severUrl = string.Format("{0}://{1}:{2}/", Request.RequestUri.Scheme, Request.RequestUri.Host, Request.RequestUri.Port);
var resultPage = new ResultPage(new ChannelInfo
{
Title = indexer.DisplayName,
Description = indexer.DisplayDescription,
Link = indexer.SiteLink,
ImageUrl = new Uri(severUrl + "logos/" + indexer.DisplayName + ".png"),
ImageTitle = indexer.DisplayName,
ImageLink = indexer.SiteLink,
ImageDescription = indexer.DisplayName
});
// add Jackett proxy to download links...
foreach (var release in releases)
{
if (release.Link == null || release.Link.Scheme == "magnet")
continue;
var originalLink = release.Link;
var encodedLink = HttpServerUtility.UrlTokenEncode(Encoding.UTF8.GetBytes(originalLink.ToString())) + "/download.torrent";
var proxyLink = string.Format("{0}api/{1}/download/{2}", severUrl, indexer.DisplayName.ToLowerInvariant(), encodedLink);
release.Link = new Uri(proxyLink);
}
resultPage.Releases.AddRange(releases);
var xml = resultPage.ToXml(new Uri(severUrl));
// Force the return as XML
return new HttpResponseMessage()
{
Content = new StringContent(xml, Encoding.UTF8, "application/rss+xml")
};
}
}
}

View File

@@ -0,0 +1,210 @@
using Autofac;
using Jackett.Models;
using Jackett.Services;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace Jackett.Controllers
{
[RoutePrefix("admin")]
public class AdminController : ApiController
{
private IConfigurationService config;
private IIndexerManagerService indexerService;
private IServerService serverService;
public AdminController(IConfigurationService config, IIndexerManagerService i, IServerService ss)
{
this.config = config;
indexerService = i;
serverService = ss;
}
private async Task<JToken> ReadPostDataJson()
{
var content = await Request.Content.ReadAsStringAsync();
return JObject.Parse(content);
}
[Route("get_config_form")]
[HttpGet]
public async Task<IHttpActionResult> GetConfigForm()
{
var jsonReply = new JObject();
try
{
var postData = await ReadPostDataJson();
var indexer = indexerService.GetIndexer((string)postData["indexer"]);
var config = await indexer.GetConfigurationForSetup();
jsonReply["config"] = config.ToJson();
jsonReply["name"] = indexer.DisplayName;
jsonReply["result"] = "success";
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
return Json(jsonReply);
}
[Route("configure_indexer")]
[HttpPost]
public async Task<IHttpActionResult> Configure()
{
JToken jsonReply = new JObject();
try
{
var postData = await ReadPostDataJson();
string indexerString = (string)postData["indexer"];
var indexer = indexerService.GetIndexer((string)postData["indexer"]);
jsonReply["name"] = indexer.DisplayName;
await indexer.ApplyConfiguration(postData["config"]);
indexerService.TestIndexer((string)postData["indexer"]);
jsonReply["result"] = "success";
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
if (ex is ExceptionWithConfigData)
{
jsonReply["config"] = ((ExceptionWithConfigData)ex).ConfigData.ToJson();
}
}
return Json(jsonReply);
}
[Route("get_indexers")]
[HttpGet]
public IHttpActionResult Indexers()
{
var jsonReply = new JObject();
try
{
jsonReply["result"] = "success";
jsonReply["api_key"] = serverService.Config.APIKey;
jsonReply["app_version"] = config.GetVersion();
JArray items = new JArray();
foreach (var indexer in indexerService.GetAllIndexers())
{
var item = new JObject();
item["id"] = indexer.GetType().Name.ToLowerInvariant();
item["name"] = indexer.DisplayName;
item["description"] = indexer.DisplayDescription;
item["configured"] = indexer.IsConfigured;
item["site_link"] = indexer.SiteLink;
items.Add(item);
}
jsonReply["items"] = items;
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
return Json(jsonReply);
}
[Route("test_indexer")]
[HttpPost]
public async Task<IHttpActionResult> Test()
{
JToken jsonReply = new JObject();
try
{
var postData = await ReadPostDataJson();
string indexerString = (string)postData["indexer"];
indexerService.TestIndexer(indexerString);
jsonReply["result"] = "success";
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
return Json(jsonReply);
}
[Route("delete_indexer")]
[HttpPost]
public async Task<IHttpActionResult> Delete()
{
var jsonReply = new JObject();
try
{
var postData = await ReadPostDataJson();
string indexerString = (string)postData["indexer"];
indexerService.DeleteIndexer(indexerString);
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
return Json(jsonReply);
}
[Route("get_jackett_config")]
[HttpGet]
public IHttpActionResult GetConfig()
{
var jsonReply = new JObject();
try
{
jsonReply["config"] = config.ReadServerSettingsFile();
jsonReply["result"] = "success";
}
catch (CustomException ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
return Json(jsonReply);
}
[Route("apply_jackett_config")]
[HttpPost]
public async Task<IHttpActionResult> SetConfig()
{
var jsonReply = new JObject();
try
{
var postData = await ReadPostDataJson();
// int port = await WebServer.ApplyPortConfiguration(postData);
jsonReply["result"] = "success";
// jsonReply["port"] = port;
}
catch (Exception ex)
{
jsonReply["result"] = "error";
jsonReply["error"] = ex.Message;
}
return Json(jsonReply);
}
[Route("jackett_restart")]
[HttpPost]
public IHttpActionResult Restart()
{
return null;
}
}
}

View File

@@ -0,0 +1,48 @@
using Jackett.Services;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
namespace Jackett.Controllers
{
public class DownloadController : ApiController
{
private Logger logger;
private IIndexerManagerService indexerService;
public DownloadController(IIndexerManagerService i, Logger l)
{
logger = l;
indexerService = i;
}
[HttpGet]
public async Task<HttpResponseMessage> Download(string indexerName, string path)
{
try
{
var indexer = indexerService.GetIndexer(indexerName);
var remoteFile = Encoding.UTF8.GetString(HttpServerUtility.UrlTokenDecode(path));
var downloadBytes = await indexer.Download(new Uri(remoteFile));
var result = new HttpResponseMessage(HttpStatusCode.OK);
result.Content = new ByteArrayContent(downloadBytes);
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-bittorrent");
return result;
}
catch (Exception e)
{
logger.Error(e, "Error downloading " + indexerName + " " + path);
return new HttpResponseMessage(HttpStatusCode.NotFound);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,8 +12,7 @@ namespace Jackett
{
public static class CookieContainerExtensions
{
public static void FillFromJson(this CookieContainer cookies, Uri uri, JToken json)
public static void FillFromJson(this CookieContainer cookies, Uri uri, JToken json, Logger logger)
{
if (json["cookies"] != null)
{
@@ -43,12 +43,17 @@ namespace Jackett
}
catch (CookieException ex)
{
Program.LoggerInstance.Info("(Non-critical) Problem loading cookie {0}, {1}, {2}", uri, c, ex.Message);
logger.Info("(Non-critical) Problem loading cookie {0}, {1}, {2}", uri, c, ex.Message);
}
}
}
}
public static void DumpToJson(this CookieContainer cookies, string uri, JToken json)
{
DumpToJson(cookies, new Uri(uri), json);
}
public static void DumpToJson(this CookieContainer cookies, Uri uri, JToken json)
{
json["cookie_header"] = cookies.GetCookieHeader(uri);

View File

@@ -10,7 +10,6 @@ namespace Jackett
{
public class DataUrl
{
public static string ReadFileToDataUrl(string file)
{
string mime = MimeMapping.GetMimeMapping(file);

111
src/Jackett/Engine.cs Normal file
View File

@@ -0,0 +1,111 @@
using Autofac;
using Jackett.Services;
using NLog;
using NLog.Config;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett
{
public class Engine
{
private static IContainer container = null;
static Engine()
{
var builder = new ContainerBuilder();
builder.RegisterModule<JackettModule>();
container = builder.Build();
// Register the container in itself to allow for late resolves
var secondaryBuilder = new ContainerBuilder();
secondaryBuilder.RegisterInstance<IContainer>(container).SingleInstance();
SetupLogging(secondaryBuilder);
secondaryBuilder.Update(container);
Logger.Info("Starting Jackett " + ConfigService.GetVersion());
}
public static IContainer GetContainer()
{
return container;
}
public static bool IsWindows {
get {
return Environment.OSVersion.Platform == PlatformID.Win32NT;
}
}
public static IConfigurationService ConfigService
{
get
{
return container.Resolve<IConfigurationService>();
}
}
public static IServiceConfigService ServiceConfig
{
get
{
return container.Resolve<IServiceConfigService>();
}
}
public static IServerService Server
{
get
{
return container.Resolve<IServerService>();
}
}
public static IRunTimeService RunTime
{
get
{
return container.Resolve<IRunTimeService>();
}
}
public static Logger Logger
{
get
{
return container.Resolve<Logger>();
}
}
private static void SetupLogging(ContainerBuilder builder)
{
var logConfig = new LoggingConfiguration();
var logFile = new FileTarget();
logConfig.AddTarget("file", logFile);
logFile.Layout = "${longdate} ${level} ${message} ${exception:format=ToString}";
logFile.FileName = Path.Combine(ConfigurationService.GetAppDataFolderStatic(), "log.txt");
logFile.ArchiveFileName = "log.{#####}.txt";
logFile.ArchiveAboveSize = 500000;
logFile.MaxArchiveFiles = 1;
logFile.KeepFileOpen = false;
logFile.ArchiveNumbering = ArchiveNumberingMode.DateAndSequence;
var logFileRule = new LoggingRule("*", LogLevel.Debug, logFile);
logConfig.LoggingRules.Add(logFileRule);
var logConsole = new ConsoleTarget();
logConfig.AddTarget("console", logConsole);
logConsole.Layout = "${longdate} ${level} ${message} ${exception:format=ToString}";
var logConsoleRule = new LoggingRule("*", LogLevel.Debug, logConsole);
logConfig.LoggingRules.Add(logConsoleRule);
LogManager.Configuration = logConfig;
builder.RegisterInstance<Logger>(LogManager.GetCurrentClassLogger()).SingleInstance();
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Jackett.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

View File

@@ -1,107 +0,0 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett
{
public class IndexerManager
{
static string IndexerConfigDirectory = Path.Combine(Program.AppConfigDirectory, "Indexers");
public Dictionary<string, IndexerInterface> Indexers { get; private set; }
public IndexerManager()
{
Indexers = new Dictionary<string, IndexerInterface>();
LoadMissingIndexers();
}
void LoadMissingIndexers()
{
var implementedIndexerTypes = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => typeof(IndexerInterface).IsAssignableFrom(p) && !p.IsInterface)
.ToArray();
foreach (var t in implementedIndexerTypes)
{
LoadIndexer(t);
}
}
void LoadIndexer(Type indexerType)
{
var name = indexerType.Name.Trim().ToLower();
if (Indexers.ContainsKey(name))
return;
IndexerInterface newIndexer = (IndexerInterface)Activator.CreateInstance(indexerType);
newIndexer.OnSaveConfigurationRequested += newIndexer_OnSaveConfigurationRequested;
newIndexer.OnResultParsingError += newIndexer_OnResultParsingError;
var configFilePath = GetIndexerConfigFilePath(newIndexer);
if (File.Exists(configFilePath))
{
var jsonString = JObject.Parse(File.ReadAllText(configFilePath));
newIndexer.LoadFromSavedConfiguration(jsonString);
}
Indexers.Add(name, newIndexer);
}
void newIndexer_OnResultParsingError(IndexerInterface indexer, string results, Exception ex)
{
var fileName = string.Format("Error on {0} for {1}.txt", DateTime.Now.ToString("yyyyMMddHHmmss"), indexer.DisplayName);
var spacing = string.Join("", Enumerable.Repeat(Environment.NewLine, 5));
var fileContents = string.Format("{0}{1}{2}", ex, spacing, results);
File.WriteAllText(Path.Combine(Program.AppConfigDirectory, fileName), fileContents);
}
string GetIndexerConfigFilePath(IndexerInterface indexer)
{
return Path.Combine(IndexerConfigDirectory, indexer.GetType().Name.ToLower() + ".json");
}
void newIndexer_OnSaveConfigurationRequested(IndexerInterface indexer, JToken obj)
{
var configFilePath = GetIndexerConfigFilePath(indexer);
if (!Directory.Exists(IndexerConfigDirectory))
Directory.CreateDirectory(IndexerConfigDirectory);
File.WriteAllText(configFilePath, obj.ToString());
}
public IndexerInterface GetIndexer(string name)
{
IndexerInterface indexer;
if (!Indexers.TryGetValue(name, out indexer))
throw new Exception(string.Format("No indexer with ID '{0}'", name));
return indexer;
}
public void DeleteIndexer(string name)
{
var indexer = GetIndexer(name);
var configPath = GetIndexerConfigFilePath(indexer);
File.Delete(configPath);
Indexers.Remove(name);
LoadMissingIndexers();
}
public async Task TestIndexer(IndexerInterface indexer)
{
var browseQuery = new TorznabQuery();
var results = await indexer.PerformQuery(browseQuery);
Program.LoggerInstance.Debug(string.Format("Found {0} releases from {1}", results.Length, indexer.DisplayName));
if (results.Length == 0)
throw new Exception("Found no results while trying to browse this tracker");
}
}
}

View File

@@ -9,10 +9,13 @@ using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Net.Http.Headers;
using Jackett.Models;
using Jackett.Utils;
using NLog;
namespace Jackett.Indexers
{
public class AlphaRatio : IndexerInterface
public class AlphaRatio : IIndexer
{
public string DisplayName
{
@@ -32,8 +35,8 @@ namespace Jackett.Indexers
public bool RequiresRageIDLookupDisabled { get { return true; } }
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public bool IsConfigured { get; private set; }
@@ -54,9 +57,11 @@ namespace Jackett.Indexers
HttpClient client;
string cookieHeader;
private Logger logger;
public AlphaRatio()
public AlphaRatio(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -100,7 +105,7 @@ namespace Jackett.Indexers
configSaveData = new JObject();
if (Program.IsWindows)
if (Engine.IsWindows)
{
// If Windows use .net http
var response = await client.SendAsync(message);
@@ -144,7 +149,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(SiteLink, jsonConfig);
cookies.FillFromJson(SiteLink, jsonConfig, logger);
cookieHeader = cookies.GetCookieHeader(SiteLink);
IsConfigured = true;
}
@@ -167,7 +172,7 @@ namespace Jackett.Indexers
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
string results;
if (Program.IsWindows)
if (Engine.IsWindows)
{
var request = CreateHttpRequest(new Uri(episodeSearchUrl));
request.Method = HttpMethod.Get;
@@ -234,7 +239,7 @@ namespace Jackett.Indexers
public async Task<byte[]> Download(Uri link)
{
if (Program.IsWindows)
if (Engine.IsWindows)
{
return await client.GetByteArrayAsync(link);
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -15,7 +18,7 @@ using System.Web;
namespace Jackett.Indexers
{
public class AnimeBytes : IndexerInterface
public class AnimeBytes : IIndexer
{
class ConfigurationDataBasicLoginAnimeBytes : ConfigurationDataBasicLogin
{
@@ -38,8 +41,8 @@ namespace Jackett.Indexers
private static List<CachedResult> cache = new List<CachedResult>();
private static readonly TimeSpan cacheTime = new TimeSpan(0, 9, 0);
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
@@ -71,9 +74,11 @@ namespace Jackett.Indexers
CookieContainer cookieContainer;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public AnimeBytes()
public AnimeBytes(Logger l)
{
logger = l;
IsConfigured = false;
cookieContainer = new CookieContainer();
handler = new HttpClientHandler
@@ -164,7 +169,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookieContainer.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookieContainer.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
AllowRaws = jsonConfig["raws"].Value<bool>();
}

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Jackett.Models;
using Newtonsoft.Json.Linq;
using NLog;
namespace Jackett.Indexers
{
public abstract class BaseIndexer: IIndexer
{
public string DisplayDescription { get; private set; }
public string DisplayName { get; private set; }
public bool IsConfigured { get; protected set; }
public Uri SiteLink { get; private set; }
public bool RequiresRageIDLookupDisabled { get; private set; }
public abstract Task ApplyConfiguration(JToken configJson);
public abstract Task<byte[]> Download(Uri link);
public abstract Task<ConfigurationData> GetConfigurationForSetup();
public abstract void LoadFromSavedConfiguration(JToken jsonConfig);
public abstract Task<ReleaseInfo[]> PerformQuery(TorznabQuery query);
private Logger logger;
public BaseIndexer(string name, string description, Uri link, Logger logger)
{
DisplayName = name;
DisplayDescription = description;
SiteLink = link;
this.logger = logger;
}
protected void LogParseError(string results, Exception ex)
{
var fileName = string.Format("Error on {0} for {1}.txt", DateTime.Now.ToString("yyyyMMddHHmmss"), DisplayName);
var spacing = string.Join("", Enumerable.Repeat(Environment.NewLine, 5));
var fileContents = string.Format("{0}{1}{2}", ex, spacing, results);
logger.Error(fileName + fileContents);
}
}
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -11,11 +14,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class BeyondHD : IndexerInterface
public class BeyondHD : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{
@@ -43,9 +46,11 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public BeyondHD()
public BeyondHD(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -70,7 +75,7 @@ namespace Jackett.Indexers
var jsonCookie = new JObject();
jsonCookie["cookie_header"] = config.CookieHeader;
cookies.FillFromJson(new Uri(BaseUrl), jsonCookie);
cookies.FillFromJson(new Uri(BaseUrl), jsonCookie, logger);
var responseContent = await client.GetStringAsync(BaseUrl);
@@ -94,7 +99,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,9 +15,9 @@ using System.Web;
namespace Jackett.Indexers
{
public class BitHdtv : IndexerInterface
public class BitHdtv : IIndexer
{
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{
@@ -41,9 +44,11 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger loggger;
public BitHdtv()
public BitHdtv(Logger l)
{
loggger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -97,13 +102,13 @@ namespace Jackett.Indexers
}
}
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public bool IsConfigured { get; private set; }
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, loggger);
IsConfigured = true;
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -11,9 +14,9 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
namespace Jackett
namespace Jackett.Indexers
{
public class BitMeTV : IndexerInterface
public class BitMeTV : IIndexer
{
class BmtvConfig : ConfigurationData
{
@@ -48,12 +51,14 @@ namespace Jackett
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public BitMeTV()
public BitMeTV(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -124,7 +129,7 @@ namespace Jackett
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,4 +1,6 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -10,11 +12,11 @@ using System.Web;
namespace Jackett.Indexers
{
class FrenchTorrentDb : IndexerInterface
class FrenchTorrentDb : IIndexer
{
public event Action<IndexerInterface, Newtonsoft.Json.Linq.JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, Newtonsoft.Json.Linq.JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
class ConfigurationDataBasicLoginFrenchTorrentDb : ConfigurationData
{

View File

@@ -1,5 +1,9 @@
using CsQuery;
using Jackett.Indexers;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -14,9 +18,9 @@ using System.Web.UI.WebControls;
namespace Jackett
{
public class Freshon : IndexerInterface
public class Freshon : IIndexer
{
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
static string BaseUrl = "https://freshon.tv";
static string LoginUrl = BaseUrl + "/login.php";
@@ -39,10 +43,12 @@ namespace Jackett
public bool RequiresRageIDLookupDisabled { get { return true; } }
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
private Logger logger;
public Freshon()
public Freshon(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -94,8 +100,8 @@ namespace Jackett
var configSaveData = new JObject();
cookies.DumpToJson(SiteLink, configSaveData);
if (OnSaveConfigurationRequested != null)
OnSaveConfigurationRequested(this, configSaveData);
// if (OnSaveConfigurationRequested != null)
// OnSaveConfigurationRequested(this, configSaveData);
IsConfigured = true;
}
@@ -103,7 +109,7 @@ namespace Jackett
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,26 +15,27 @@ using System.Web;
namespace Jackett.Indexers
{
public class HDTorrents : IndexerInterface
public class HDTorrents : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
const string DefaultUrl = "http://hdts.ru"; // Of the accessible domains the .ru seems the most reliable. https://hdts.ru | https://hd-torrents.org | https://hd-torrents.net | https://hd-torrents.me
string BaseUrl = DefaultUrl;
static string chromeUserAgent = BrowserUtil.ChromeUserAgent;
private string SearchUrl = DefaultUrl + "/torrents.php?search={0}&active=1&options=0&category%5B%5D=59&category%5B%5D=60&category%5B%5D=30&category%5B%5D=38&page={1}";
private static string LoginUrl = DefaultUrl + "/login.php";
private static string LoginPostUrl = DefaultUrl + "/login.php?returnto=index.php";
private const int MAXPAGES = 3;
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public HDTorrents()
public HDTorrents(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -124,7 +128,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(SiteLink, jsonConfig);
cookies.FillFromJson(SiteLink, jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Jackett.Models;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -6,16 +7,10 @@ using System.Text;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
namespace Jackett
namespace Jackett.Indexers
{
public interface IndexerInterface
public interface IIndexer
{
// Invoked when the indexer configuration has been applied and verified so the cookie needs to be saved
event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
event Action<IndexerInterface, string, Exception> OnResultParsingError;
string DisplayName { get; }
string DisplayDescription { get; }
Uri SiteLink { get; }

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,11 +15,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class IPTorrents : IndexerInterface
public class IPTorrents : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName { get { return "IPTorrents"; } }
@@ -38,9 +41,11 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public IPTorrents()
public IPTorrents(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -112,7 +117,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(Newtonsoft.Json.Linq.JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -0,0 +1,16 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett.Indexers
{
class Master
{
}
}

View File

@@ -1,5 +1,7 @@
using CsQuery;
using Jackett.Models;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
@@ -12,7 +14,7 @@ using System.Web;
namespace Jackett.Indexers
{
public class MoreThanTV : IndexerInterface
public class MoreThanTV : IIndexer
{
public string DisplayName
{
@@ -31,8 +33,8 @@ namespace Jackett.Indexers
public bool RequiresRageIDLookupDisabled { get { return true; } }
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public bool IsConfigured { get; private set; }
@@ -49,12 +51,14 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
private Logger logger;
string cookieHeader;
int retries = 3;
public MoreThanTV()
public MoreThanTV(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -90,7 +94,7 @@ namespace Jackett.Indexers
var configSaveData = new JObject();
if (Program.IsWindows)
if (Engine.IsWindows)
{
// If Windows use .net http
var response = await client.PostAsync(LoginUrl, content);
@@ -126,7 +130,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(SiteLink, jsonConfig);
cookies.FillFromJson(SiteLink, jsonConfig, logger);
cookieHeader = cookies.GetCookieHeader(SiteLink);
IsConfigured = true;
}
@@ -150,7 +154,7 @@ namespace Jackett.Indexers
var episodeSearchUrl = SearchUrl + HttpUtility.UrlEncode(searchString);
string results;
if (Program.IsWindows)
if (Engine.IsWindows)
{
results = await client.GetStringAsync(episodeSearchUrl, retries);
}
@@ -217,7 +221,7 @@ namespace Jackett.Indexers
public async Task<byte[]> Download(Uri link)
{
if (Program.IsWindows)
if (Engine.IsWindows)
{
return await client.GetByteArrayAsync(link);
}

View File

@@ -1,4 +1,6 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -10,11 +12,11 @@ using System.Threading.Tasks;
namespace Jackett.Indexers
{
public class Rarbg : IndexerInterface
public class Rarbg : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -10,11 +13,11 @@ using System.Threading.Tasks;
namespace Jackett.Indexers
{
class SceneAccess : IndexerInterface
class SceneAccess : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{
@@ -48,9 +51,11 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
string cookieHeader;
private Logger logger;
public SceneAccess()
public SceneAccess(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -84,7 +89,7 @@ namespace Jackett.Indexers
string responseContent;
var configSaveData = new JObject();
if (Program.IsWindows)
if (Engine.IsWindows)
{
// If Windows use .net http
var response = await client.PostAsync(LoginUrl, content);
@@ -118,7 +123,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
cookieHeader = cookies.GetCookieHeader(SiteLink);
IsConfigured = true;
}
@@ -134,7 +139,7 @@ namespace Jackett.Indexers
var searchUrl = string.Format(SearchUrl, searchSection, searchCategory, searchString);
string results;
if (Program.IsWindows)
if (Engine.IsWindows)
{
results = await client.GetStringAsync(searchUrl);
}
@@ -189,7 +194,7 @@ namespace Jackett.Indexers
public async Task<byte[]> Download(Uri link)
{
if (Program.IsWindows)
if (Engine.IsWindows)
{
return await client.GetByteArrayAsync(link);
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,11 +15,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class SceneTime : IndexerInterface
public class SceneTime : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{
@@ -45,10 +48,12 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public SceneTime()
public SceneTime(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -101,7 +106,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,4 +1,6 @@
using Newtonsoft.Json.Linq;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,11 +14,11 @@ using System.Xml;
namespace Jackett.Indexers
{
public class ShowRSS : IndexerInterface
public class ShowRSS : IIndexer
{
public event Action<IndexerInterface, Newtonsoft.Json.Linq.JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, Newtonsoft.Json.Linq.JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json.Linq;
using Jackett.Models;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -11,11 +12,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class Strike : IndexerInterface
public class Strike : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{

View File

@@ -1,4 +1,6 @@
using Newtonsoft.Json.Linq;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,12 +14,12 @@ using System.Web;
namespace Jackett.Indexers
{
public class T411 : IndexerInterface
public class T411 : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{

View File

@@ -1,4 +1,6 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -13,12 +15,12 @@ using System.Web;
namespace Jackett.Indexers
{
public class ThePirateBay : IndexerInterface
public class ThePirateBay : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName { get { return "The Pirate Bay"; } }
@@ -101,7 +103,7 @@ namespace Jackett.Indexers
string results;
if (Program.IsWindows)
if (Engine.IsWindows)
{
results = await client.GetStringAsync(episodeSearchUrl);
}
@@ -175,7 +177,7 @@ namespace Jackett.Indexers
}
catch (Exception ex)
{
OnResultParsingError(this, results, ex);
// OnResultParsingError(this, results, ex);
throw ex;
}
return releases.ToArray();

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,11 +15,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class TorrentDay : IndexerInterface
public class TorrentDay : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{
@@ -47,9 +50,11 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public TorrentDay()
public TorrentDay(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -120,7 +125,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,11 +15,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class TorrentLeech : IndexerInterface
public class TorrentLeech : IIndexer
{
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public string DisplayName
{
@@ -45,9 +48,11 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public TorrentLeech()
public TorrentLeech(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -103,7 +108,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@@ -1,5 +1,8 @@
using CsQuery;
using Jackett.Models;
using Jackett.Utils;
using Newtonsoft.Json.Linq;
using NLog;
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -12,11 +15,11 @@ using System.Web;
namespace Jackett.Indexers
{
public class TorrentShack : IndexerInterface
public class TorrentShack : IIndexer
{
public event Action<IndexerInterface, JToken> OnSaveConfigurationRequested;
public event Action<IIndexer, JToken> OnSaveConfigurationRequested;
public event Action<IndexerInterface, string, Exception> OnResultParsingError;
public event Action<IIndexer, string, Exception> OnResultParsingError;
public string DisplayName
{
@@ -43,11 +46,13 @@ namespace Jackett.Indexers
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
Logger logger;
public bool IsConfigured { get; private set; }
public TorrentShack()
public TorrentShack(Logger l)
{
logger = l;
IsConfigured = false;
cookies = new CookieContainer();
handler = new HttpClientHandler
@@ -105,7 +110,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

Some files were not shown because too many files have changed in this diff Show More