From 07360524b929f08823b6965f8dd725368afa116a Mon Sep 17 00:00:00 2001 From: ThomasClemenceau Date: Mon, 23 Sep 2019 02:41:34 +0800 Subject: [PATCH] xthor: Add accent parameter. resolves #6025 (#6026) --- src/Jackett.Common/Indexers/Xthor.cs | 22 +++++++++++++++---- .../Bespoke/ConfigurationDataXthor.cs | 8 ++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/Jackett.Common/Indexers/Xthor.cs b/src/Jackett.Common/Indexers/Xthor.cs index a7924dd88..1e18f0fb0 100644 --- a/src/Jackett.Common/Indexers/Xthor.cs +++ b/src/Jackett.Common/Indexers/Xthor.cs @@ -80,7 +80,7 @@ namespace Jackett.Common.Indexers AddCategoryMapping(33, TorznabCatType.MoviesOther, "SPECTACLE"); AddCategoryMapping(31, TorznabCatType.MoviesOther, "ANIMATION"); AddCategoryMapping(9, TorznabCatType.MoviesOther, "VOSTFR"); - + // Series AddCategoryMapping(104, TorznabCatType.TVOTHER, "BLURAY"); AddCategoryMapping(13, TorznabCatType.TVOTHER, "PACK VF"); @@ -99,7 +99,7 @@ namespace Jackett.Common.Indexers // Music AddCategoryMapping(20, TorznabCatType.AudioVideo, "CONCERT"); - + // Books AddCategoryMapping(24, TorznabCatType.BooksEbook, "ENOOKS NOVEL"); AddCategoryMapping(96, TorznabCatType.BooksMagazines, "EBOOKS MAGAZINES"); @@ -223,9 +223,10 @@ namespace Jackett.Common.Indexers releases.AddRange(xthorResponse.torrents.Select(torrent => { //issue #3847 replace multi keyword - if(!string.IsNullOrEmpty(ReplaceMulti)){ + if (!string.IsNullOrEmpty(ReplaceMulti)) + { System.Text.RegularExpressions.Regex regex = new Regex("(?i)([\\.\\- ])MULTI([\\.\\- ])"); - torrent.name = regex.Replace(torrent.name, "$1"+ReplaceMulti+"$2"); + torrent.name = regex.Replace(torrent.name, "$1" + ReplaceMulti + "$2"); } var release = new ReleaseInfo @@ -367,6 +368,11 @@ namespace Jackett.Common.Indexers parameters.Add("freeleech", "1"); } + if (!string.IsNullOrEmpty(ConfigData.Accent.Value)) + { + parameters.Add("accent", ConfigData.Accent.Value); + } + // Building our query -- Cannot use GetQueryString due to UrlEncode (generating wrong category param) url += "?" + string.Join("&", parameters.AllKeys.Select(a => a + "=" + parameters[a])); @@ -631,6 +637,14 @@ namespace Jackett.Common.Indexers Output("Validated Setting -- PassKey (auth) => " + ConfigData.PassKey.Value); } + if (!string.IsNullOrEmpty(ConfigData.Accent.Value) && !string.Equals(ConfigData.Accent.Value, "1") && !string.Equals(ConfigData.Accent.Value, "2")) + { + throw new ExceptionWithConfigData("Only '1' or '2' are available in the Accent parameter.", ConfigData); + } + else + { + Output("Validated Setting -- Accent (audio) => " + ConfigData.Accent.Value); + } // Check Dev Cache Settings if (ConfigData.HardDriveCache.Value) { diff --git a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataXthor.cs b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataXthor.cs index 99e9af1c9..7d937ecb6 100644 --- a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataXthor.cs +++ b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataXthor.cs @@ -5,6 +5,7 @@ public DisplayItem CredentialsWarning { get; private set; } public StringItem PassKey { get; set; } public DisplayItem PagesWarning { get; private set; } + public StringItem Accent { get; set; } public BoolItem Freeleech { get; private set; } public StringItem ReplaceMulti { get; private set; } public BoolItem EnhancedAnime { get; private set; } @@ -18,7 +19,8 @@ { CredentialsWarning = new DisplayItem("Credentials Configuration (Private Tracker),

") { Name = "Credentials" }; PassKey = new StringItem { Name = "PassKey", Value = "" }; - PagesWarning = new DisplayItem("Preferences Configuration (Tweak your search settings),

") { Name = "Preferences" }; + Accent = new StringItem { Name = "Accent", Value = "" }; + PagesWarning = new DisplayItem("Preferences Configuration (Tweak your search settings),

") { Name = "Preferences" }; Freeleech = new BoolItem() { Name = "Freeleech Only (Optional)", Value = false }; ReplaceMulti = new StringItem() { Name = "Replace MULTI", Value = "MULTI.FRENCH" }; EnhancedAnime = new BoolItem() { Name = "Enhanced anime search", Value = false }; @@ -26,6 +28,6 @@ DevMode = new BoolItem { Name = "Enable DEV MODE (Developers ONLY)", Value = false }; HardDriveCache = new BoolItem { Name = "Enable HARD DRIVE CACHE (Developers ONLY)", Value = false }; HardDriveCacheKeepTime = new StringItem { Name = "Keep Cached files for (ms)", Value = "300000" }; - } + } } -} +} \ No newline at end of file