Merge changes

This commit is contained in:
KZ 2015-07-20 22:09:07 +01:00
commit fad2a10bef
35 changed files with 335 additions and 194 deletions

View File

@ -43,6 +43,7 @@ Download in the [Releases page](https://github.com/zone117x/Jackett/releases)
* [BeyondHD](https://beyondhd.me/)
* [T411](http://www.t411.io/)
* [FrenchTorrentDb](http://www.frenchtorrentdb.com/)
* [bB](http://reddit.com/r/baconbits)
### Additional Trackers

View File

@ -13,6 +13,7 @@ using System.Web.Http;
namespace Jackett.Controllers
{
[AllowAnonymous]
public class DownloadController : ApiController
{
private Logger logger;

View File

@ -18,6 +18,11 @@ namespace Jackett
static Engine()
{
#if DEBUG
TracingEnabled = true;
#endif
var builder = new ContainerBuilder();
builder.RegisterModule<JackettModule>();
container = builder.Build();
@ -48,8 +53,10 @@ namespace Jackett
return container;
}
public static bool IsWindows {
get {
public static bool IsWindows
{
get
{
return Environment.OSVersion.Platform == PlatformID.Win32NT;
}
}

View File

@ -16,7 +16,7 @@ using Jackett.Services;
namespace Jackett.Indexers
{
public class AlphaRatio : BaseIndexer,IIndexer
public class AlphaRatio : BaseIndexer, IIndexer
{
private readonly string LoginUrl = "";
private readonly string SearchUrl = "";
@ -29,13 +29,13 @@ namespace Jackett.Indexers
string cookieHeader;
public AlphaRatio(IIndexerManagerService i, Logger l):
base(name: "AlphaRatio",
description: "Legendary",
link: new Uri("https://alpharatio.cc"),
rageid: true,
manager:i,
logger:l)
public AlphaRatio(IIndexerManagerService i, Logger l)
: base(name: "AlphaRatio",
description: "Legendary",
link: new Uri("https://alpharatio.cc"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/login.php";
SearchUrl = SiteLink + "/ajax.php?action=browse&searchstr=";

View File

@ -39,7 +39,7 @@ namespace Jackett.Indexers
}
}
private readonly string LoginUrl = "";
private readonly string SearchUrl = "";
@ -48,15 +48,16 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public AnimeBytes(IIndexerManagerService i, Logger l) :
base(name: "AnimeBytes",
description: "The web's best Chinese cartoons",
link: new Uri("https://animebytes.tv"),
rageid: true,
manager: i,
logger: l)
public AnimeBytes(IIndexerManagerService i, Logger l)
: base(name: "AnimeBytes",
description: "The web's best Chinese cartoons",
link: new Uri("https://animebytes.tv"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
TorznabCaps.Categories.Clear();
TorznabCaps.Categories.Add(new TorznabCategory { ID = "5070", Name = "TV/Anime" });
LoginUrl = SiteLink + "/user/login";
SearchUrl = SiteLink + "/torrents.php?filter_cat[1]=1";
@ -169,7 +170,7 @@ namespace Jackett.Indexers
return sb.ToString();
}
public async Task<ReleaseInfo[]> PerformQuery(TorznabQuery query)

View File

@ -27,13 +27,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public BB(IIndexerManagerService i, Logger l) :
base(name: "bB",
description: "bB",
link: new Uri("http://www.reddit.com/r/baconbits"),
rageid: true,
manager: i,
logger: l)
public BB(IIndexerManagerService i, Logger l)
: base(name: "bB",
description: "bB",
link: new Uri("http://www.reddit.com/r/baconbits"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
BaseUrl = StringUtil.FromBase64("aHR0cHM6Ly9iYWNvbmJpdHMub3Jn");
@ -68,7 +68,6 @@ namespace Jackett.Indexers
};
var content = new FormUrlEncodedContent(pairs);
var response = await client.PostAsync(LoginUrl, content);
var responseContent = await response.Content.ReadAsStringAsync();
@ -87,8 +86,9 @@ namespace Jackett.Indexers
}
else
{
var configSaveData = new JObject();
cookies.DumpToJson(SiteLink, configSaveData);
cookies.DumpToJson(BaseUrl, configSaveData);
SaveConfig(configSaveData);
IsConfigured = true;
}
@ -97,7 +97,7 @@ namespace Jackett.Indexers
public void LoadFromSavedConfiguration(JToken jsonConfig)
{
cookies.FillFromJson(SiteLink, jsonConfig, logger);
cookies.FillFromJson(new Uri(BaseUrl), jsonConfig, logger);
IsConfigured = true;
}

View File

@ -16,9 +16,11 @@ namespace Jackett.Indexers
public string DisplayDescription { get; private set; }
public string DisplayName { get; private set; }
public string ID { get { return GetIndexerID(GetType()); } }
public bool IsConfigured { get; protected set; }
public Uri SiteLink { get; private set; }
public bool RequiresRageIDLookupDisabled { get; private set; }
public TorznabCapabilities TorznabCaps { get; private set; }
protected Logger logger;
protected IIndexerManagerService indexerService;
@ -31,14 +33,14 @@ namespace Jackett.Indexers
return StringUtil.StripNonAlphaNumeric(type.Name.ToLowerInvariant());
}
public BaseIndexer(string name, string description, bool rageid, Uri link, IIndexerManagerService manager, Logger logger)
public BaseIndexer(string name, string description, Uri link, TorznabCapabilities caps, IIndexerManagerService manager, Logger logger)
{
DisplayName = name;
DisplayDescription = description;
SiteLink = link;
TorznabCaps = caps;
this.logger = logger;
indexerService = manager;
RequiresRageIDLookupDisabled = rageid;
}
protected void SaveConfig(JToken config)

View File

@ -24,13 +24,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public BeyondHD(IIndexerManagerService i, Logger l) :
base(name: "BeyondHD",
description: "Without BeyondHD, your HDTV is just a TV",
link: new Uri("https://beyondhd.me"),
rageid: true,
manager:i,
logger:l)
public BeyondHD(IIndexerManagerService i, Logger l)
: base(name: "BeyondHD",
description: "Without BeyondHD, your HDTV is just a TV",
link: new Uri("https://beyondhd.me"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
SearchUrl = SiteLink + "/browse.php?c40=1&c44=1&c48=1&c89=1&c46=1&c45=1&searchin=title&incldead=0&search={0}";
DownloadUrl = SiteLink + "/download.php?torrent={0}";

View File

@ -26,13 +26,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public BitHdtv(IIndexerManagerService i, Logger l) :
base(name: "BIT-HDTV",
description: "Home of high definition invites",
link: new Uri("https://www.bit-hdtv.com"),
rageid: true,
manager: i,
logger: l)
public BitHdtv(IIndexerManagerService i, Logger l)
: base(name: "BIT-HDTV",
description: "Home of high definition invites",
link: new Uri("https://www.bit-hdtv.com"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/takelogin.php";
SearchUrl = SiteLink + "/torrents.php?cat=0&search=";

View File

@ -52,13 +52,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public BitMeTV(IIndexerManagerService i, Logger l) :
base(name: "BitMeTV",
description: "TV Episode specialty tracker",
link: new Uri("http://www.bitmetv.org"),
rageid: true,
manager: i,
logger: l)
public BitMeTV(IIndexerManagerService i, Logger l)
: base(name: "BitMeTV",
description: "TV Episode specialty tracker",
link: new Uri("http://www.bitmetv.org"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/login.php";
LoginPost = SiteLink + "/takelogin.php";

View File

@ -45,13 +45,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public FrenchTorrentDb(IIndexerManagerService i, Logger l) :
base(name: "FrenchTorrentDb",
description: "One the biggest French Torrent Tracker",
link: new Uri("http://www.frenchtorrentdb.com/"),
rageid: true,
manager: i,
logger: l)
public FrenchTorrentDb(IIndexerManagerService i, Logger l)
: base(name: "FrenchTorrentDb",
description: "One the biggest French Torrent Tracker",
link: new Uri("http://www.frenchtorrentdb.com/"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
MainUrl = SiteLink + "?section=INDEX";
SearchUrl = SiteLink + "?section=TORRENTS&exact=1&name={0}&submit=GO";

View File

@ -29,13 +29,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public Freshon(IIndexerManagerService i, Logger l) :
base(name: "FreshOnTV",
description: "Our goal is to provide the latest stuff in the TV show domain",
link: new Uri("https://www.bit-hdtv.com"),
rageid: true,
manager: i,
logger: l)
public Freshon(IIndexerManagerService i, Logger l)
: base(name: "FreshOnTV",
description: "Our goal is to provide the latest stuff in the TV show domain",
link: new Uri("https://www.bit-hdtv.com"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/login.php";

View File

@ -26,13 +26,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public HDTorrents(IIndexerManagerService i, Logger l) :
base(name: "HD-Torrents",
description: "HD-Torrents is a private torrent website with HD torrents and strict rules on their content.",
link: new Uri("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
rageid: true,
manager: i,
logger: l)
public HDTorrents(IIndexerManagerService i, Logger l)
: base(name: "HD-Torrents",
description: "HD-Torrents is a private torrent website with HD torrents and strict rules on their content.",
link: new Uri("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
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
SearchUrl = SiteLink + "/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}";
LoginUrl = SiteLink + "/login.php";
@ -199,7 +199,7 @@ namespace Jackett.Indexers
}
catch (Exception ex)
{
OnParseError( results, ex);
OnParseError(results, ex);
}
}

View File

@ -17,7 +17,7 @@ namespace Jackett.Indexers
Uri SiteLink { get; }
bool RequiresRageIDLookupDisabled { get; }
TorznabCapabilities TorznabCaps { get; }
// Whether this indexer has been configured, verified and saved in the past and has the settings required for functioning
bool IsConfigured { get; }

View File

@ -23,13 +23,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public IPTorrents(IIndexerManagerService i, Logger l) :
base(name: "IPTorrents",
description: "Always a step ahead.",
link: new Uri("https://iptorrents.com"),
rageid: true,
manager: i,
logger: l)
public IPTorrents(IIndexerManagerService i, Logger l)
: base(name: "IPTorrents",
description: "Always a step ahead.",
link: new Uri("https://iptorrents.com"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
SearchUrl = SiteLink + "t?q=";
cookies = new CookieContainer();

View File

@ -18,7 +18,7 @@ namespace Jackett.Indexers
{
public class MoreThanTV : BaseIndexer, IIndexer
{
private readonly string LoginUrl ="";
private readonly string LoginUrl = "";
private readonly string SearchUrl = "";
private readonly string DownloadUrl = "";
private readonly string GuidUrl = "";
@ -30,13 +30,13 @@ namespace Jackett.Indexers
string cookieHeader;
int retries = 3;
public MoreThanTV(IIndexerManagerService i, Logger l) :
base(name: "MoreThanTV",
description: "ROMANIAN Private Torrent Tracker for TV / MOVIES, and the internal tracker for the release group DRACULA.",
link: new Uri("https://www.morethan.tv"),
rageid: true,
manager: i,
logger: l)
public MoreThanTV(IIndexerManagerService i, Logger l)
: base(name: "MoreThanTV",
description: "ROMANIAN Private Torrent Tracker for TV / MOVIES, and the internal tracker for the release group DRACULA.",
link: new Uri("https://www.morethan.tv"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/login.php";
SearchUrl = SiteLink + "/ajax.php?action=browse&searchstr=";

View File

@ -27,13 +27,13 @@ namespace Jackett.Indexers
HttpClient client;
public Rarbg(IIndexerManagerService i, Logger l) :
base(name: "RARBG",
description: "RARBG",
link: new Uri("https://rarbg.com"),
rageid: false,
manager: i,
logger: l)
public Rarbg(IIndexerManagerService i, Logger l)
: base(name: "RARBG",
description: "RARBG",
link: new Uri("https://rarbg.com"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
cookies = new CookieContainer();
handler = new HttpClientHandler

View File

@ -24,13 +24,13 @@ namespace Jackett.Indexers
HttpClient client;
string cookieHeader;
public SceneAccess(IIndexerManagerService i, Logger l) :
base(name: "SceneAccess",
description: "Your gateway to the scene",
link: new Uri("https://sceneaccess.eu"),
rageid: true,
manager: i,
logger: l)
public SceneAccess(IIndexerManagerService i, Logger l)
: base(name: "SceneAccess",
description: "Your gateway to the scene",
link: new Uri("https://sceneaccess.eu"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/login";
SearchUrl = SiteLink + "/{0}?method=1&c{1}=1&search={2}";

View File

@ -26,13 +26,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public SceneTime(IIndexerManagerService i, Logger l) :
base(name: "SceneTime",
description: "Always on time",
link: new Uri("https://www.scenetime.com"),
rageid: true,
manager: i,
logger: l)
public SceneTime(IIndexerManagerService i, Logger l)
: base(name: "SceneTime",
description: "Always on time",
link: new Uri("https://www.scenetime.com"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/takelogin.php";
SearchUrl = SiteLink + "/browse_API.php";

View File

@ -25,13 +25,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public ShowRSS(IIndexerManagerService i, Logger l) :
base(name: "ShowRSS",
description: "showRSS is a service that allows you to keep track of your favorite TV shows",
link: new Uri("http://showrss.info"),
rageid: true,
manager: i,
logger: l)
public ShowRSS(IIndexerManagerService i, Logger l)
: base(name: "ShowRSS",
description: "showRSS is a service that allows you to keep track of your favorite TV shows",
link: new Uri("http://showrss.info"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
searchAllUrl = SiteLink + "/feeds/all.rss";

View File

@ -22,20 +22,20 @@ namespace Jackett.Indexers
private readonly string LoginUrl = "";
private readonly string SearchUrl = "";
private readonly string SearchFormData = "c53=1&c49=1&c2=1&c52=1&c41=1&c50=1&c30=1&jxt=4&jxw=b";
private readonly string CommentsUrl ="";
private readonly string CommentsUrl = "";
private readonly string DownloadUrl = "";
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
public SpeedCD(IIndexerManagerService i, Logger l) :
base(name: "Speed.cd",
description: "Your home now!",
link: new Uri("http://speed.cd"),
rageid: true,
manager: i,
logger: l)
public SpeedCD(IIndexerManagerService i, Logger l)
: base(name: "Speed.cd",
description: "Your home now!",
link: new Uri("http://speed.cd"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/take_login.php";
SearchUrl = SiteLink + "/V3/API/API.php";
@ -138,7 +138,7 @@ namespace Jackett.Indexers
}
catch (Exception ex)
{
OnParseError(results, ex);
OnParseError(results, ex);
}
return releases.ToArray();
}

View File

@ -25,13 +25,13 @@ namespace Jackett.Indexers
private HttpClientHandler handler;
private HttpClient client;
public Strike(IIndexerManagerService i, Logger l) :
base(name: "Strike",
description: "Torrent search engine",
link: new Uri("https://getstrike.net"),
rageid: true,
manager: i,
logger: l)
public Strike(IIndexerManagerService i, Logger l)
: base(name: "Strike",
description: "Torrent search engine",
link: new Uri("https://getstrike.net"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
cookies = new CookieContainer();
handler = new HttpClientHandler

View File

@ -32,13 +32,13 @@ namespace Jackett.Indexers
string token = string.Empty;
DateTime lastTokenFetch = DateTime.MinValue;
public T411(IIndexerManagerService i, Logger l) :
base(name: "T411",
description: "French Torrent Tracker",
link: new Uri("http://www.t411.io"),
rageid: true,
manager: i,
logger: l)
public T411(IIndexerManagerService i, Logger l)
: base(name: "T411",
description: "French Torrent Tracker",
link: new Uri("http://www.t411.io"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
CommentsUrl = SiteLink + "/torrents/{0}";
IsConfigured = false;

View File

@ -26,13 +26,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public ThePirateBay(IIndexerManagerService i, Logger l) :
base(name: "The Pirate Bay",
description: "The worlds largest bittorrent indexer",
link: new Uri("https://thepiratebay.mn"),
rageid: true,
manager: i,
logger: l)
public ThePirateBay(IIndexerManagerService i, Logger l)
: base(name: "The Pirate Bay",
description: "The worlds largest bittorrent indexer",
link: new Uri("https://thepiratebay.mn"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
BaseUrl = SiteLink.ToString();
IsConfigured = false;
@ -165,7 +165,7 @@ namespace Jackett.Indexers
}
catch (Exception ex)
{
// OnResultParsingError(this, results, ex);
// OnResultParsingError(this, results, ex);
throw ex;
}
return releases.ToArray();

View File

@ -16,7 +16,7 @@ using System.Web;
namespace Jackett.Indexers
{
public class TorrentDay: BaseIndexer, IIndexer
public class TorrentDay : BaseIndexer, IIndexer
{
private readonly string StartPageUrl = "";
private readonly string LoginUrl = "";
@ -26,13 +26,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public TorrentDay(IIndexerManagerService i, Logger l) :
base(name: "TorrentDay",
description: "TorrentDay",
link: new Uri("https://torrentday.eu"),
rageid: true,
manager: i,
logger: l)
public TorrentDay(IIndexerManagerService i, Logger l)
: base(name: "TorrentDay",
description: "TorrentDay",
link: new Uri("https://torrentday.eu"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
StartPageUrl = SiteLink + "/login.php";
LoginUrl = SiteLink + "/tak3login.php";

View File

@ -18,20 +18,20 @@ namespace Jackett.Indexers
{
public class TorrentLeech : BaseIndexer, IIndexer
{
private readonly string LoginUrl ="";
private readonly string LoginUrl = "";
private readonly string SearchUrl = "";
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
public TorrentLeech(IIndexerManagerService i, Logger l) :
base(name: "TorrentLeech",
description: "This is what happens when you seed",
link: new Uri("http://www.torrentleech.org"),
rageid: true,
manager: i,
logger: l)
public TorrentLeech(IIndexerManagerService i, Logger l)
: base(name: "TorrentLeech",
description: "This is what happens when you seed",
link: new Uri("http://www.torrentleech.org"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/user/account/login/";
SearchUrl = SiteLink + "/torrents/browse/index/query/{0}/categories/2%2C26%2C27%2C32/orderby/added?";

View File

@ -18,20 +18,20 @@ namespace Jackett.Indexers
{
public class TorrentShack : BaseIndexer, IIndexer
{
private readonly string LoginUrl ="";
private readonly string LoginUrl = "";
private readonly string SearchUrl = "";
CookieContainer cookies;
HttpClientHandler handler;
HttpClient client;
public TorrentShack(IIndexerManagerService i, Logger l) :
base(name: "TorrentShack",
description: "TorrentShack",
link: new Uri("http://torrentshack.me"),
rageid: true,
manager: i,
logger: l)
public TorrentShack(IIndexerManagerService i, Logger l)
: base(name: "TorrentShack",
description: "TorrentShack",
link: new Uri("http://torrentshack.me"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
LoginUrl = SiteLink + "/login.php";
SearchUrl = SiteLink + "/torrents.php?searchstr={0}&release_type=both&searchtags=&tags_type=0&order_by=s3&order_way=desc&torrent_preset=all&filter_cat%5B600%5D=1&filter_cat%5B620%5D=1&filter_cat%5B700%5D=1&filter_cat%5B981%5D=1&filter_cat%5B980%5D=1";

View File

@ -24,13 +24,13 @@ namespace Jackett.Indexers
HttpClientHandler handler;
HttpClient client;
public Torrentz(IIndexerManagerService i, Logger l) :
base(name: "Torrentz",
description: "Torrentz is a meta-search engine and a Multisearch. This means we just search other search engines.",
link: new Uri("https://torrentz.eu"),
rageid: true,
manager: i,
logger: l)
public Torrentz(IIndexerManagerService i, Logger l)
: base(name: "Torrentz",
description: "Torrentz is a meta-search engine and a Multisearch. This means we just search other search engines.",
link: new Uri("https://torrentz.eu"),
caps: TorznabCapsUtil.CreateDefaultTorznabTVCaps(),
manager: i,
logger: l)
{
SearchUrl = SiteLink + "/feed_verifiedP?f={0}";

View File

@ -156,7 +156,9 @@
<Compile Include="Indexers\BaseIndexer.cs" />
<Compile Include="Indexers\BB.cs" />
<Compile Include="Indexers\SpeedCD.cs" />
<Compile Include="Models\TorznabCapabilities.cs" />
<Compile Include="Models\Config\ServerConfig.cs" />
<Compile Include="Models\TorznabCategory.cs" />
<Compile Include="Services\ProcessService.cs" />
<Compile Include="Services\SecuityService.cs" />
<Compile Include="Services\SerializeService.cs" />
@ -216,6 +218,7 @@
<Compile Include="CurlHelper.cs" />
<Compile Include="Indexers\AlphaRatio.cs" />
<Compile Include="Utils\StringUtil.cs" />
<Compile Include="Utils\TorznabCapsUtil.cs" />
<Compile Include="Utils\WebApiRootRedirectMiddleware.cs" />
<Compile Include="Utils\WebAPIRequestLogger.cs" />
<Compile Include="Utils\WebAPIToNLogTracer.cs" />

View File

@ -19,14 +19,23 @@ namespace Jackett.Models.Config
public string APIKey { get; set; }
public string AdminPassword { get; set; }
public string GetListenAddress(bool? external = null)
public string[] GetListenAddresses(bool? external = null)
{
if (external == null)
{
external = AllowExternal;
}
return "http://" + (external.Value ? "*" : "localhost") + ":" + Port + "/";
if (external.Value)
{
return new string[] { "http://*:" + Port + "/" };
}
else
{
return new string[] {
"http://127.0.0.1:" + Port + "/",
"http://localhost:" + Port + "/",
};
}
}
public string GenerateApi()

View File

@ -0,0 +1,70 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Jackett.Models
{
public class TorznabCapabilities
{
public bool SearchAvailable { get; set; }
public bool TVSearchAvailable { get; set; }
public bool SupportsTVRageSearch { get; set; }
public List<TorznabCategory> Categories { get; private set; }
public TorznabCapabilities()
{
Categories = new List<TorznabCategory>();
}
string SupportedTVSearchParams
{
get
{
var parameters = new List<string>() { "q", "season", "ep" };
if (SupportsTVRageSearch)
parameters.Add("rid");
return string.Join(",", parameters);
}
}
public string ToXml()
{
var xdoc = new XDocument(
new XDeclaration("1.0", "UTF-8", null),
new XElement("caps",
new XElement("searching",
new XElement("search",
new XAttribute("available", SearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", "q")
),
new XElement("tv-search",
new XAttribute("available", TVSearchAvailable ? "yes" : "no"),
new XAttribute("supportedParams", SupportedTVSearchParams)
)
),
new XElement("categories",
from c in Categories
select new XElement("category",
new XAttribute("id", c.ID),
new XAttribute("name", c.Name),
from sc in c.SubCategories
select new XElement("subcat",
new XAttribute("id", sc.ID),
new XAttribute("name", sc.Name)
)
)
)
)
);
return xdoc.Declaration.ToString() + Environment.NewLine + xdoc.ToString();
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett.Models
{
public class TorznabCategory
{
public string ID { get; set; }
public string Name { get; set; }
public List<TorznabCategory> SubCategories { get; private set; }
public TorznabCategory()
{
SubCategories = new List<TorznabCategory>();
}
}
}

View File

@ -18,7 +18,6 @@ namespace Jackett.Models
public int Limit { get; private set; }
public int Offset { get; private set; }
public int RageID { get; private set; }
public bool RageIDLookupEnabled { get; private set; }
public int Season { get; private set; }
public string Episode { get; private set; }
@ -73,8 +72,6 @@ namespace Jackett.Models
q.SanitizedSearchTerm = SanitizeSearchTerm(q.SearchTerm);
}
q.RageIDLookupEnabled = query["rid_enabled"] != "0";
if (query["cat"] != null)
{
q.Categories = query["cat"].Split(',');

View File

@ -109,22 +109,24 @@ namespace Jackett.Services
// Load indexers
indexerService.InitIndexers();
// Start the server
logger.Debug("Starting web server at " + config.GetListenAddress());
_server = WebApp.Start<Startup>(url: config.GetListenAddress());
logger.Debug("Starting web server at " + config.GetListenAddresses()[0]);
var startOptions = new StartOptions();
config.GetListenAddresses().ToList().ForEach(u => startOptions.Urls.Add(u));
_server = WebApp.Start<Startup>(startOptions);
logger.Debug("Web server started");
}
public void ReserveUrls(bool doInstall = true)
{
logger.Debug("Unreserving Urls");
RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(false)));
RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(true)));
config.GetListenAddresses(false).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u)));
config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u)));
if (doInstall)
{
logger.Debug("Reserving Urls");
RunNetSh(string.Format("http add urlacl {0} sddl=D:(A;;GX;;;S-1-1-0)", config.GetListenAddress()));
config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http add urlacl {0} sddl=D:(A;;GX;;;S-1-1-0)", u)));
logger.Debug("Urls reserved");
}
}

View File

@ -0,0 +1,27 @@
using Jackett.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Jackett.Utils
{
public static class TorznabCapsUtil
{
public static TorznabCapabilities CreateDefaultTorznabTVCaps()
{
var caps = new TorznabCapabilities();
caps.SearchAvailable = true;
caps.TVSearchAvailable = true;
caps.SupportsTVRageSearch = false;
caps.Categories.AddRange(new[] {
new TorznabCategory { ID = "5000", Name = "TV" },
new TorznabCategory { ID = "5030", Name = "TV/SD" },
new TorznabCategory { ID = "5040", Name = "TV/HD" }
});
return caps;
}
}
}