diff --git a/README.md b/README.md index 284f32621..ef97333bb 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ Download in the [Releases page](https://github.com/zone117x/Jackett/releases) * [BIT-HDTV](https://www.bit-hdtv.com) * [BitMeTV](http://www.bitmetv.org/) * [Demonoid](http://www.demonoid.pw/) + * [FileList](http://filelist.ro/) * [FrenchTorrentDb](http://www.frenchtorrentdb.com/) * [Freshon](https://freshon.tv/) * [HD-Space](https://hd-space.org/) diff --git a/src/Jackett/CacheControlAttribute.cs b/src/Jackett/CacheControlAttribute.cs new file mode 100644 index 000000000..915d2f740 --- /dev/null +++ b/src/Jackett/CacheControlAttribute.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http.Filters; + +namespace Jackett +{ + public class JackettAPINoCacheAttribute : System.Web.Http.Filters.ActionFilterAttribute + { + public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) + { + actionExecutedContext.Response.Headers.CacheControl = new System.Net.Http.Headers.CacheControlHeaderValue() + { + NoStore = true, + Private = true + }; + + base.OnActionExecuted(actionExecutedContext); + } + } +} diff --git a/src/Jackett/Content/logos/filelist.png b/src/Jackett/Content/logos/filelist.png new file mode 100644 index 000000000..c271d9a35 Binary files /dev/null and b/src/Jackett/Content/logos/filelist.png differ diff --git a/src/Jackett/Controllers/AdminController.cs b/src/Jackett/Controllers/AdminController.cs index 5762c7a64..397c51295 100644 --- a/src/Jackett/Controllers/AdminController.cs +++ b/src/Jackett/Controllers/AdminController.cs @@ -28,6 +28,7 @@ namespace Jackett.Controllers { [RoutePrefix("admin")] [JackettAuthorized] + [JackettAPINoCache] public class AdminController : ApiController { private IConfigurationService config; diff --git a/src/Jackett/Controllers/BlackholeController.cs b/src/Jackett/Controllers/BlackholeController.cs index 88a4ecae1..a359d3cfc 100644 --- a/src/Jackett/Controllers/BlackholeController.cs +++ b/src/Jackett/Controllers/BlackholeController.cs @@ -16,6 +16,7 @@ using System.Web.Http; namespace Jackett.Controllers { [AllowAnonymous] + [JackettAPINoCache] public class BlackholeController : ApiController { private Logger logger; diff --git a/src/Jackett/Controllers/DownloadController.cs b/src/Jackett/Controllers/DownloadController.cs index f2266b60f..458d5e276 100644 --- a/src/Jackett/Controllers/DownloadController.cs +++ b/src/Jackett/Controllers/DownloadController.cs @@ -14,6 +14,7 @@ using System.Web.Http; namespace Jackett.Controllers { [AllowAnonymous] + [JackettAPINoCache] public class DownloadController : ApiController { private Logger logger; diff --git a/src/Jackett/Controllers/PotatoController.cs b/src/Jackett/Controllers/PotatoController.cs index 33b26caca..45a85bf10 100644 --- a/src/Jackett/Controllers/PotatoController.cs +++ b/src/Jackett/Controllers/PotatoController.cs @@ -19,6 +19,7 @@ using System.Web.Http; namespace Jackett.Controllers { [AllowAnonymous] + [JackettAPINoCache] public class PotatoController : ApiController { private IIndexerManagerService indexerService; diff --git a/src/Jackett/Controllers/TorznabController.cs b/src/Jackett/Controllers/TorznabController.cs index f161dd871..f13bfab8e 100644 --- a/src/Jackett/Controllers/TorznabController.cs +++ b/src/Jackett/Controllers/TorznabController.cs @@ -16,6 +16,7 @@ using System.Web.Http; namespace Jackett.Controllers { [AllowAnonymous] + [JackettAPINoCache] public class TorznabController : ApiController { private IIndexerManagerService indexerService; diff --git a/src/Jackett/Indexers/AlphaRatio.cs b/src/Jackett/Indexers/AlphaRatio.cs index 738cbdf97..be0b17b4b 100644 --- a/src/Jackett/Indexers/AlphaRatio.cs +++ b/src/Jackett/Indexers/AlphaRatio.cs @@ -44,9 +44,9 @@ namespace Jackett.Indexers AddCategoryMapping(10, TorznabCatType.XXX); AddCategoryMapping(20, TorznabCatType.XXX); AddCategoryMapping(12, TorznabCatType.PCGames); - AddCategoryMapping(13, TorznabCatType.GameXbox); - AddCategoryMapping(14, TorznabCatType.GamePS3); - AddCategoryMapping(15, TorznabCatType.GameWii); + AddCategoryMapping(13, TorznabCatType.ConsoleXbox); + AddCategoryMapping(14, TorznabCatType.ConsolePS3); + AddCategoryMapping(15, TorznabCatType.ConsoleWii); AddCategoryMapping(16, TorznabCatType.PC); AddCategoryMapping(17, TorznabCatType.PCMac); AddCategoryMapping(19, TorznabCatType.PCMobileOther); diff --git a/src/Jackett/Indexers/FileList.cs b/src/Jackett/Indexers/FileList.cs new file mode 100644 index 000000000..fc373632f --- /dev/null +++ b/src/Jackett/Indexers/FileList.cs @@ -0,0 +1,146 @@ +using CsQuery; +using Jackett.Models; +using Jackett.Services; +using Jackett.Utils; +using Jackett.Utils.Clients; +using Newtonsoft.Json.Linq; +using NLog; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Globalization; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using System.Web; +using Jackett.Models.IndexerConfig; + +namespace Jackett.Indexers +{ + public class FileList : BaseIndexer, IIndexer + { + string LoginUrl { get { return SiteLink + "takelogin.php"; } } + string BrowseUrl { get { return SiteLink + "browse.php"; } } + + new ConfigurationDataFileList configData + { + get { return (ConfigurationDataFileList)base.configData; } + set { base.configData = value; } + } + + public FileList(IIndexerManagerService i, IWebClient wc, Logger l, IProtectionService ps) + : base(name: "FileList", + description: "The best Romanian site.", + link: "http://filelist.ro/", + caps: TorznabUtil.CreateDefaultTorznabTVCaps(), + manager: i, + client: wc, + logger: l, + p: ps, + configData: new ConfigurationDataFileList()) + { + AddCategoryMapping(24, TorznabCatType.Anime); + AddCategoryMapping(11, TorznabCatType.Audio); + AddCategoryMapping(15, TorznabCatType.TV); + //AddCategoryMapping(18, TorznabCatType.); Other + AddCategoryMapping(16, TorznabCatType.TVDocs); + AddCategoryMapping(25, TorznabCatType.Movies3D); + AddCategoryMapping(20, TorznabCatType.MoviesBlueRay); + AddCategoryMapping(2, TorznabCatType.MoviesSD); + AddCategoryMapping(3, TorznabCatType.MoviesSD); //RO + AddCategoryMapping(4, TorznabCatType.MoviesHD); + AddCategoryMapping(19, TorznabCatType.MoviesHD); // RO + AddCategoryMapping(1, TorznabCatType.MoviesSD); + AddCategoryMapping(10, TorznabCatType.Consoles); + AddCategoryMapping(9, TorznabCatType.PCGames); + //AddCategoryMapping(17, TorznabCatType); Linux No cat + AddCategoryMapping(22, TorznabCatType.AppsMobile); //Apps/mobile + AddCategoryMapping(8, TorznabCatType.Apps); + AddCategoryMapping(21, TorznabCatType.TVHD); + AddCategoryMapping(23, TorznabCatType.TVSD); + AddCategoryMapping(13, TorznabCatType.TVSport); + AddCategoryMapping(14, TorznabCatType.TV); + AddCategoryMapping(12, TorznabCatType.AudioMusicVideos); + AddCategoryMapping(7, TorznabCatType.XXX); + } + + public async Task ApplyConfiguration(JToken configJson) + { + configData.LoadValuesFromJson(configJson); + var pairs = new Dictionary { + { "username", configData.Username.Value }, + { "password", configData.Password.Value } + }; + + var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, null, true, null, LoginUrl); + await ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("logout.php"), () => + { + CQ dom = result.Content; + var errorMessage = dom[".main"].Text().Trim(); + throw new ExceptionWithConfigData(errorMessage, configData); + }); + } + + public async Task> PerformQuery(TorznabQuery query) + { + var releases = new List(); + var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString(); + var searchUrl = BrowseUrl; + + if (!string.IsNullOrWhiteSpace(searchString)) + searchUrl += string.Format("?search={0}&cat=0&searchin=0&sort=0", HttpUtility.UrlEncode(searchString)); + + var response = await RequestStringWithCookiesAndRetry(searchUrl, null, BrowseUrl); + var results = response.Content; + try + { + CQ dom = results; + var rows = dom[".torrentrow"]; + foreach (var row in rows) + { + var release = new ReleaseInfo(); + var qRow = row.Cq(); + var qTitleLink = qRow.Find(".torrenttable:eq(1) a").First(); + release.Title = qRow.Find(".torrenttable:eq(1) a b").Text().Trim(); + release.Description = release.Title; + release.Guid = new Uri(SiteLink + qTitleLink.Attr("href")); + release.Comments = release.Guid; + + //22:05:3716/02/2013 + var dateStr = qRow.Find(".torrenttable:eq(5)").Text().Trim(); + release.PublishDate = DateTime.ParseExact(dateStr, "H:mm:ssdd/MM/yyyy", CultureInfo.InvariantCulture); + + var qLink = qRow.Find(".torrenttable:eq(2) a").First(); + release.Link = new Uri(SiteLink + qLink.Attr("href")); + + var sizeStr = qRow.Find(".torrenttable:eq(6)").Text().Trim(); + release.Size = ReleaseInfo.GetBytes(sizeStr); + + release.Seeders = ParseUtil.CoerceInt(qRow.Find(".torrenttable:eq(8)").Text().Trim()); + release.Peers = ParseUtil.CoerceInt(qRow.Find(".torrenttable:eq(9)").Text().Trim()) + release.Seeders; + + var cat = qRow.Find(".torrenttable:eq(0) a").First().Attr("href").Substring(15); + release.Category = MapTrackerCatToNewznab(cat); + + // Skip other + if (release.Category != 0) + { + // Skip Romanian releases + if ((cat == "3" || cat == "19") && !configData.IncludeRomanianReleases.Value) + continue; + + releases.Add(release); + } + } + } + catch (Exception ex) + { + OnParseError(results, ex); + } + + return releases; + } + } +} diff --git a/src/Jackett/Jackett.csproj b/src/Jackett/Jackett.csproj index aad1e0302..2671c5de8 100644 --- a/src/Jackett/Jackett.csproj +++ b/src/Jackett/Jackett.csproj @@ -172,6 +172,7 @@ + @@ -191,6 +192,7 @@ + @@ -214,6 +216,7 @@ + @@ -406,6 +409,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/src/Jackett/Models/IndexerConfig/ConfigurationDataFileList.cs b/src/Jackett/Models/IndexerConfig/ConfigurationDataFileList.cs new file mode 100644 index 000000000..db58b34d0 --- /dev/null +++ b/src/Jackett/Models/IndexerConfig/ConfigurationDataFileList.cs @@ -0,0 +1,22 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jackett.Models.IndexerConfig +{ + class ConfigurationDataFileList : ConfigurationDataBasicLogin + { + public BoolItem IncludeRomanianReleases { get; private set; } + public DisplayItem CatWarning { get; private set; } + + public ConfigurationDataFileList() + : base() + { + IncludeRomanianReleases = new BoolItem() { Name = "IncludeRomanianReleases", Value = false }; + CatWarning = new DisplayItem("When mapping TV ensure you add category 5000 in addition to 5030,5040.") { Name = "CatWarning" }; + } + } +} diff --git a/src/Jackett/Models/TorznabCatType.cs b/src/Jackett/Models/TorznabCatType.cs index f54d2c185..e498bd10f 100644 --- a/src/Jackett/Models/TorznabCatType.cs +++ b/src/Jackett/Models/TorznabCatType.cs @@ -12,27 +12,53 @@ namespace Jackett.Models static TorznabCatType() { - cats.Add(5000, "TV"); - cats.Add(5030, "TV/SD"); - cats.Add(5040, "TV/HD"); - cats.Add(5070, "TV/Anime"); - cats.Add(5080, "TV/Documentary"); - cats.Add(8000, "Books"); - cats.Add(8020, "Books/Comics"); - cats.Add(4000, "PC"); - cats.Add(4050, "PC/Games"); - cats.Add(3030, "Audio/Audiobook"); + cats.Add(1000, "Consoles"); + cats.Add(1010, "Consoles/DS"); + cats.Add(1020, "Consoles/PSP"); + cats.Add(1030, "Consoles/Wii"); + cats.Add(1040, "Consoles/Xbox"); + cats.Add(1050, "Consoles/360"); + cats.Add(1080, "Consoles/PS3"); + cats.Add(2000, "Movies"); + cats.Add(2010, "Movies/Foreign"); + cats.Add(2020, "Movies/Other"); cats.Add(2040, "Movies/HD"); cats.Add(2030, "Movies/SD"); - cats.Add(2010, "Movies/Foreign"); + cats.Add(2050, "Movies/3D"); + cats.Add(2060, "Movies/BluRay"); + cats.Add(3000, "Audio"); + cats.Add(3010, "Audio/Lossy"); + cats.Add(3020, "Audio/Video"); + cats.Add(3030, "Audio/Audiobook"); cats.Add(3040, "Audio/Lossless"); - cats.Add(3010, "Audio/MP3"); + + cats.Add(4000, "PC"); + cats.Add(4010, "PC/Apps"); + cats.Add(4020, "PC/ISO"); + cats.Add(4030, "PC/Mac"); + cats.Add(4040, "PC/Mobile"); + cats.Add(4050, "PC/Games"); + cats.Add(4060, "PC/Mobile/IOS"); + cats.Add(4070, "PC/Mobile/Android"); + + cats.Add(5000, "TV"); + cats.Add(5020, "TV/Foreign"); + cats.Add(5030, "TV/SD"); + cats.Add(5040, "TV/HD"); + cats.Add(5060, "TV/Sport"); + cats.Add(5070, "TV/Anime"); + cats.Add(5080, "TV/Documentary"); + cats.Add(6000, "XXX"); - cats.Add(6040, "XXX/x264"); cats.Add(6010, "XXX/DVD"); + cats.Add(6040, "XXX/x264"); cats.Add(6060, "XXX/Imageset"); + + cats.Add(8000, "Books"); + cats.Add(8010, "Books/Ebook"); + cats.Add(8020, "Books/Comics"); } public static bool QueryContainsParentCategory(int[] queryCats, int releaseCat) @@ -116,7 +142,7 @@ namespace Jackett.Models public static TorznabCategory EBooks { - get { return GetCat(7020); } + get { return GetCat(8020); } } public static TorznabCategory Comic @@ -126,7 +152,12 @@ namespace Jackett.Models public static TorznabCategory Apps { - get { return GetCat(4000); } + get { return GetCat(4010); } + } + + public static TorznabCategory AppsMobile + { + get { return GetCat(4040); } } public static TorznabCategory Movies @@ -156,12 +187,12 @@ namespace Jackett.Models public static TorznabCategory MoviesBlueRay { - get { return GetCat(2050); } + get { return GetCat(2060); } } public static TorznabCategory Movies3D { - get { return GetCat(2060); } + get { return GetCat(2050); } } public static TorznabCategory Audio @@ -184,6 +215,12 @@ namespace Jackett.Models get { return GetCat(3010); } } + + public static TorznabCategory AudioMusicVideos + { + get { return GetCat(3020); } + } + public static TorznabCategory XXX { get { return GetCat(6000); } @@ -244,32 +281,37 @@ namespace Jackett.Models get { return GetCat(4070); } } - public static TorznabCategory GameDNS + public static TorznabCategory Consoles + { + get { return GetCat(1000); } + } + + public static TorznabCategory ConsoleDS { get { return GetCat(1010); } } - public static TorznabCategory GamePSP + public static TorznabCategory ConsolePSP { get { return GetCat(1020); } } - public static TorznabCategory GameXbox + public static TorznabCategory ConsoleXbox { get { return GetCat(1040); } } - public static TorznabCategory GameXbox360 + public static TorznabCategory ConsoleXbox360 { get { return GetCat(1050); } } - public static TorznabCategory GameWii + public static TorznabCategory ConsoleWii { get { return GetCat(1030); } } - public static TorznabCategory GamePS3 + public static TorznabCategory ConsolePS3 { get { return GetCat(1080); } }