From b53a30a2671280f7f946944b06760e1b78e01182 Mon Sep 17 00:00:00 2001 From: Andy Simons Date: Sat, 10 Feb 2018 23:04:53 +0500 Subject: [PATCH] rutracker + nnmclub title parsing improvements (#2566) * newstudio - new ru semi-private tracker rutracker - add series parser rutor - global search without category + series parser * newstudio rus semi-private tracker * 999 -> 99 * remove old definition * - add newstudio tracker to the README - newstudio def: remove reduntal inputs - rutor def: revert setting usage into query * nnm-club: new russian semi-private tracker newstudo: fix quality naming * readme * fix quality naming * seasons parsing fix * fix * follow redirect on torrent file download * nnm-club + rutracker name parsing improvements * rutracker: add strip russian letters option --- src/Jackett.Common/Definitions/nnm-club.yml | 6 ++++-- src/Jackett.Common/Indexers/rutracker.cs | 12 ++++++++--- .../Bespoke/ConfigurationDataRutracker.cs | 20 +++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataRutracker.cs diff --git a/src/Jackett.Common/Definitions/nnm-club.yml b/src/Jackett.Common/Definitions/nnm-club.yml index 75bce8381..3a4fbe1e4 100644 --- a/src/Jackett.Common/Definitions/nnm-club.yml +++ b/src/Jackett.Common/Definitions/nnm-club.yml @@ -717,12 +717,14 @@ title: selector: a[href^="viewtopic.php?t="] > b filters: + - name: replace + args: ["Кураж-Бамбей", "kurazh"] + - name: re_replace + args: ["(\\([А-Яа-я\\W]+\\))|(^[А-Яа-я\\W\\d]+\\/ )|([а-яА-Я \\-]+,+)|([а-яА-Я]+)", ""] - name: re_replace args: ["\\b(\\d)\\b", "0$1"] - name: re_replace args: ["(\\([Сс]езон\\s+(\\d+).+[Сс]ери[ия]\\s+(?:(\\d+-*\\d*).*\\d+)*\\))", "(S$2E$3) RUS"] - - name: replace - args: ["Кураж-Бамбей", "kurazh"] - name: replace args: ["WEBDLRip", "WEBDL"] - name: replace diff --git a/src/Jackett.Common/Indexers/rutracker.cs b/src/Jackett.Common/Indexers/rutracker.cs index d661d130f..5c889a9cf 100644 --- a/src/Jackett.Common/Indexers/rutracker.cs +++ b/src/Jackett.Common/Indexers/rutracker.cs @@ -12,6 +12,7 @@ using Jackett.Utils.Clients; using Newtonsoft.Json.Linq; using NLog; using System.Text.RegularExpressions; +using Jackett.Models.IndexerConfig.Bespoke; namespace Jackett.Indexers { @@ -25,9 +26,9 @@ namespace Jackett.Indexers protected string cap_sid = null; protected string cap_code_field = null; - private new ConfigurationDataCaptchaLogin configData + private new ConfigurationDataRutracker configData { - get { return (ConfigurationDataCaptchaLogin)base.configData; } + get { return (ConfigurationDataRutracker)base.configData; } set { base.configData = value; } } @@ -40,7 +41,7 @@ namespace Jackett.Indexers client: wc, logger: l, p: ps, - configData: new ConfigurationDataCaptchaLogin()) + configData: new ConfigurationDataRutracker()) { Encoding = Encoding.GetEncoding("windows-1251"); Language = "ru-ru"; @@ -1587,6 +1588,11 @@ namespace Jackett.Indexers release.Title = title; } + else if (configData.StripRussianLetters.Value) + { + var regex = new Regex(@"(\([А-Яа-я\W]+\))|(^[А-Яа-я\W\d]+\/ )|([а-яА-Я \-]+,+)|([а-яА-Я]+)"); + release.Title = regex.Replace(release.Title, ""); + } releases.Add(release); } diff --git a/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataRutracker.cs b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataRutracker.cs new file mode 100644 index 000000000..8e21e501e --- /dev/null +++ b/src/Jackett.Common/Models/IndexerConfig/Bespoke/ConfigurationDataRutracker.cs @@ -0,0 +1,20 @@ +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Jackett.Models.IndexerConfig.Bespoke +{ + class ConfigurationDataRutracker : ConfigurationDataCaptchaLogin + { + public BoolItem StripRussianLetters { get; private set; } + + public ConfigurationDataRutracker() + : base() + { + StripRussianLetters = new BoolItem() { Name = "Strip Russian Letters", Value = true }; + } + } +}