diff --git a/README.md b/README.md index 0d87fcb34..e3f76e552 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/Jackett/Controllers/DownloadController.cs b/src/Jackett/Controllers/DownloadController.cs index 235abc255..a43fcb6ff 100644 --- a/src/Jackett/Controllers/DownloadController.cs +++ b/src/Jackett/Controllers/DownloadController.cs @@ -13,6 +13,7 @@ using System.Web.Http; namespace Jackett.Controllers { + [AllowAnonymous] public class DownloadController : ApiController { private Logger logger; diff --git a/src/Jackett/Engine.cs b/src/Jackett/Engine.cs index fb4506567..000484704 100644 --- a/src/Jackett/Engine.cs +++ b/src/Jackett/Engine.cs @@ -18,6 +18,11 @@ namespace Jackett static Engine() { + +#if DEBUG + TracingEnabled = true; +#endif + var builder = new ContainerBuilder(); builder.RegisterModule(); 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; } } diff --git a/src/Jackett/Indexers/AlphaRatio.cs b/src/Jackett/Indexers/AlphaRatio.cs index be2deeae2..8cf4eaf78 100644 --- a/src/Jackett/Indexers/AlphaRatio.cs +++ b/src/Jackett/Indexers/AlphaRatio.cs @@ -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="; diff --git a/src/Jackett/Indexers/AnimeBytes.cs b/src/Jackett/Indexers/AnimeBytes.cs index fe21b802f..b65fe26c7 100644 --- a/src/Jackett/Indexers/AnimeBytes.cs +++ b/src/Jackett/Indexers/AnimeBytes.cs @@ -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 PerformQuery(TorznabQuery query) diff --git a/src/Jackett/Indexers/BB.cs b/src/Jackett/Indexers/BB.cs index 2a7297f61..e23c56f82 100644 --- a/src/Jackett/Indexers/BB.cs +++ b/src/Jackett/Indexers/BB.cs @@ -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; } diff --git a/src/Jackett/Indexers/BaseIndexer.cs b/src/Jackett/Indexers/BaseIndexer.cs index 25a5874fe..68b17033f 100644 --- a/src/Jackett/Indexers/BaseIndexer.cs +++ b/src/Jackett/Indexers/BaseIndexer.cs @@ -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) diff --git a/src/Jackett/Indexers/BeyondHD.cs b/src/Jackett/Indexers/BeyondHD.cs index 7fca5cb92..b8e082d00 100644 --- a/src/Jackett/Indexers/BeyondHD.cs +++ b/src/Jackett/Indexers/BeyondHD.cs @@ -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}"; diff --git a/src/Jackett/Indexers/BitHdtv.cs b/src/Jackett/Indexers/BitHdtv.cs index 27ea5cbd5..76293c971 100644 --- a/src/Jackett/Indexers/BitHdtv.cs +++ b/src/Jackett/Indexers/BitHdtv.cs @@ -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="; diff --git a/src/Jackett/Indexers/BitMeTV.cs b/src/Jackett/Indexers/BitMeTV.cs index f5f08f209..eb53a887e 100644 --- a/src/Jackett/Indexers/BitMeTV.cs +++ b/src/Jackett/Indexers/BitMeTV.cs @@ -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"; diff --git a/src/Jackett/Indexers/FrenchTorrentDb.cs b/src/Jackett/Indexers/FrenchTorrentDb.cs index 1dead510b..128b0e674 100644 --- a/src/Jackett/Indexers/FrenchTorrentDb.cs +++ b/src/Jackett/Indexers/FrenchTorrentDb.cs @@ -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"; diff --git a/src/Jackett/Indexers/Freshon.cs b/src/Jackett/Indexers/Freshon.cs index 4b62bcff8..ca2a5ad03 100644 --- a/src/Jackett/Indexers/Freshon.cs +++ b/src/Jackett/Indexers/Freshon.cs @@ -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"; diff --git a/src/Jackett/Indexers/HDTorrents.cs b/src/Jackett/Indexers/HDTorrents.cs index 86ae5394c..73ccdb38e 100644 --- a/src/Jackett/Indexers/HDTorrents.cs +++ b/src/Jackett/Indexers/HDTorrents.cs @@ -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); } } diff --git a/src/Jackett/Indexers/IIndexer.cs b/src/Jackett/Indexers/IIndexer.cs index ea2844b3e..cf6ba4c74 100644 --- a/src/Jackett/Indexers/IIndexer.cs +++ b/src/Jackett/Indexers/IIndexer.cs @@ -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; } diff --git a/src/Jackett/Indexers/IPTorrents.cs b/src/Jackett/Indexers/IPTorrents.cs index d26c6ef65..23b26745a 100644 --- a/src/Jackett/Indexers/IPTorrents.cs +++ b/src/Jackett/Indexers/IPTorrents.cs @@ -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(); diff --git a/src/Jackett/Indexers/MoreThanTV.cs b/src/Jackett/Indexers/MoreThanTV.cs index 86136bffd..98c38c00f 100644 --- a/src/Jackett/Indexers/MoreThanTV.cs +++ b/src/Jackett/Indexers/MoreThanTV.cs @@ -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="; diff --git a/src/Jackett/Indexers/Rarbg.cs b/src/Jackett/Indexers/Rarbg.cs index 1ea5b5a1b..4d43927b1 100644 --- a/src/Jackett/Indexers/Rarbg.cs +++ b/src/Jackett/Indexers/Rarbg.cs @@ -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 diff --git a/src/Jackett/Indexers/SceneAccess.cs b/src/Jackett/Indexers/SceneAccess.cs index 799cfdd6b..0e065596c 100644 --- a/src/Jackett/Indexers/SceneAccess.cs +++ b/src/Jackett/Indexers/SceneAccess.cs @@ -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}"; diff --git a/src/Jackett/Indexers/SceneTime.cs b/src/Jackett/Indexers/SceneTime.cs index 1e26a6497..00f83bb51 100644 --- a/src/Jackett/Indexers/SceneTime.cs +++ b/src/Jackett/Indexers/SceneTime.cs @@ -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"; diff --git a/src/Jackett/Indexers/ShowRSS.cs b/src/Jackett/Indexers/ShowRSS.cs index c37f271ee..78ae0d230 100644 --- a/src/Jackett/Indexers/ShowRSS.cs +++ b/src/Jackett/Indexers/ShowRSS.cs @@ -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"; diff --git a/src/Jackett/Indexers/SpeedCD.cs b/src/Jackett/Indexers/SpeedCD.cs index 81f784e83..8122f66e9 100644 --- a/src/Jackett/Indexers/SpeedCD.cs +++ b/src/Jackett/Indexers/SpeedCD.cs @@ -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(); } diff --git a/src/Jackett/Indexers/Strike.cs b/src/Jackett/Indexers/Strike.cs index 33e7ec900..5c63476f2 100644 --- a/src/Jackett/Indexers/Strike.cs +++ b/src/Jackett/Indexers/Strike.cs @@ -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 diff --git a/src/Jackett/Indexers/T411.cs b/src/Jackett/Indexers/T411.cs index 605df001b..814753558 100644 --- a/src/Jackett/Indexers/T411.cs +++ b/src/Jackett/Indexers/T411.cs @@ -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; diff --git a/src/Jackett/Indexers/ThePirateBay.cs b/src/Jackett/Indexers/ThePirateBay.cs index a2b1df7f9..281df8382 100644 --- a/src/Jackett/Indexers/ThePirateBay.cs +++ b/src/Jackett/Indexers/ThePirateBay.cs @@ -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(); diff --git a/src/Jackett/Indexers/TorrentDay.cs b/src/Jackett/Indexers/TorrentDay.cs index e6bb3b685..ca4107c8d 100644 --- a/src/Jackett/Indexers/TorrentDay.cs +++ b/src/Jackett/Indexers/TorrentDay.cs @@ -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"; diff --git a/src/Jackett/Indexers/TorrentLeech.cs b/src/Jackett/Indexers/TorrentLeech.cs index cefd16987..eac781cc3 100644 --- a/src/Jackett/Indexers/TorrentLeech.cs +++ b/src/Jackett/Indexers/TorrentLeech.cs @@ -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?"; diff --git a/src/Jackett/Indexers/TorrentShack.cs b/src/Jackett/Indexers/TorrentShack.cs index 8444b7699..b466f7568 100644 --- a/src/Jackett/Indexers/TorrentShack.cs +++ b/src/Jackett/Indexers/TorrentShack.cs @@ -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"; diff --git a/src/Jackett/Indexers/Torrentz.cs b/src/Jackett/Indexers/Torrentz.cs index 47a968b95..1d54b0bf9 100644 --- a/src/Jackett/Indexers/Torrentz.cs +++ b/src/Jackett/Indexers/Torrentz.cs @@ -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}"; diff --git a/src/Jackett/Jackett.csproj b/src/Jackett/Jackett.csproj index b6419b08b..04dca9d65 100644 --- a/src/Jackett/Jackett.csproj +++ b/src/Jackett/Jackett.csproj @@ -156,7 +156,9 @@ + + @@ -216,6 +218,7 @@ + diff --git a/src/Jackett/Models/Config/ServerConfig.cs b/src/Jackett/Models/Config/ServerConfig.cs index 235924a40..58a221a5f 100644 --- a/src/Jackett/Models/Config/ServerConfig.cs +++ b/src/Jackett/Models/Config/ServerConfig.cs @@ -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() diff --git a/src/Jackett/Models/TorznabCapabilities.cs b/src/Jackett/Models/TorznabCapabilities.cs new file mode 100644 index 000000000..012ad8e57 --- /dev/null +++ b/src/Jackett/Models/TorznabCapabilities.cs @@ -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 Categories { get; private set; } + + public TorznabCapabilities() + { + Categories = new List(); + } + + string SupportedTVSearchParams + { + get + { + var parameters = new List() { "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(); + } + } +} diff --git a/src/Jackett/Models/TorznabCategory.cs b/src/Jackett/Models/TorznabCategory.cs new file mode 100644 index 000000000..53425c540 --- /dev/null +++ b/src/Jackett/Models/TorznabCategory.cs @@ -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 SubCategories { get; private set; } + + public TorznabCategory() + { + SubCategories = new List(); + } + } +} diff --git a/src/Jackett/Models/TorznabQuery.cs b/src/Jackett/Models/TorznabQuery.cs index c1e61d632..cbc3fdc75 100644 --- a/src/Jackett/Models/TorznabQuery.cs +++ b/src/Jackett/Models/TorznabQuery.cs @@ -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(','); diff --git a/src/Jackett/Services/ServerService.cs b/src/Jackett/Services/ServerService.cs index 004d99e4e..d406b1e77 100644 --- a/src/Jackett/Services/ServerService.cs +++ b/src/Jackett/Services/ServerService.cs @@ -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(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(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"); } } diff --git a/src/Jackett/Utils/TorznabCapsUtil.cs b/src/Jackett/Utils/TorznabCapsUtil.cs new file mode 100644 index 000000000..789d38236 --- /dev/null +++ b/src/Jackett/Utils/TorznabCapsUtil.cs @@ -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; + } + + } +}