rutracker: add option to append RUS to movies/tv shows titles (#14018)

This commit is contained in:
Bogdan
2023-02-14 23:06:34 +02:00
committed by GitHub
parent f78bc29140
commit bb7c97a590
2 changed files with 14 additions and 6 deletions

View File

@@ -1578,7 +1578,8 @@ namespace Jackett.Common.Indexers
category,
configData.StripRussianLetters.Value,
configData.MoveAllTagsToEndOfReleaseTitle.Value,
configData.MoveFirstTagsToEndOfReleaseTitle.Value
configData.MoveFirstTagsToEndOfReleaseTitle.Value,
configData.AddRussianToTitle.Value
),
Description = title,
Details = details,
@@ -1647,7 +1648,12 @@ namespace Jackett.Common.Indexers
private readonly Regex _tvTitleRusEpisodeOfRegex = new Regex(@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)\s*из\s*([\w?])", RegexOptions.Compiled | RegexOptions.IgnoreCase);
private readonly Regex _tvTitleRusEpisodeRegex = new Regex(@"(?:Серии|Эпизод|Выпуски)+\s*[:]*\s+(\d+(?:-\d+)?)", RegexOptions.Compiled | RegexOptions.IgnoreCase);
public string Parse(string title, ICollection<int> category, bool stripCyrillicLetters = true, bool moveAllTagsToEndOfReleaseTitle = false, bool moveFirstTagsToEndOfReleaseTitle = false)
public string Parse(string title,
ICollection<int> category,
bool stripCyrillicLetters = true,
bool moveAllTagsToEndOfReleaseTitle = false,
bool moveFirstTagsToEndOfReleaseTitle = false,
bool addRussianToTitle = false)
{
// https://www.fileformat.info/info/unicode/category/Pd/list.htm
title = Regex.Replace(title, @"\p{Pd}", "-", RegexOptions.Compiled | RegexOptions.IgnoreCase);
@@ -1676,12 +1682,12 @@ namespace Jackett.Common.Indexers
// Bluray quality fix: radarr parse Blu-ray Disc as Bluray-1080p but should be BR-DISK
title = Regex.Replace(title, @"\bBlu-ray Disc\b", "BR-DISK", RegexOptions.Compiled | RegexOptions.IgnoreCase);
// language fix: all rutracker releases contains russian track
if (title.IndexOf("rus", StringComparison.OrdinalIgnoreCase) < 0)
title += " rus";
}
// language fix: all rutracker releases contains russian track
if (addRussianToTitle && (IsAnyTvCategory(category) || IsAnyMovieCategory(category)) && !Regex.Match(title, "\bRUS\b", RegexOptions.IgnoreCase).Success)
title += " RUS";
if (stripCyrillicLetters)
title = _stripCyrillicRegex.Replace(title, string.Empty).Trim(' ', '-');

View File

@@ -7,6 +7,7 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke
{
public BoolConfigurationItem UseMagnetLinks { get; private set; }
public BoolConfigurationItem StripRussianLetters { get; private set; }
public BoolConfigurationItem AddRussianToTitle { get; private set; }
public DisplayInfoConfigurationItem MoveTagsInfo { get; private set; }
public BoolConfigurationItem MoveFirstTagsToEndOfReleaseTitle { get; private set; }
public BoolConfigurationItem MoveAllTagsToEndOfReleaseTitle { get; private set; }
@@ -16,6 +17,7 @@ namespace Jackett.Common.Models.IndexerConfig.Bespoke
{
UseMagnetLinks = new BoolConfigurationItem("Use Magnet Links") { Value = false };
StripRussianLetters = new BoolConfigurationItem("Strip Russian Letters") { Value = true };
AddRussianToTitle = new BoolConfigurationItem("Add RUS to end of all titles to improve language detection by Sonarr and Radarr. Will cause English-only results to be misidentified.") { Value = false };
MoveTagsInfo = new DisplayInfoConfigurationItem("Move Tags Info", "<b>About moving tags:</b> " +
"We define a tag as a part of the release title between round or square brackets. " +
"If the release title contains tags then these options will move those tags and their brackets to the end of the release title. " +