added new language "Telugu" for filtering releases and testcases.

pull/8611/head
Kalyan Chekuri 2 years ago committed by Qstick
parent bbcd0b7861
commit af496fe701

@ -56,7 +56,8 @@ namespace NzbDrone.Core.Test.Languages
new object[] { 41, Language.Bosnian }, new object[] { 41, Language.Bosnian },
new object[] { 42, Language.Estonian }, new object[] { 42, Language.Estonian },
new object[] { 43, Language.Tamil }, new object[] { 43, Language.Tamil },
new object[] { 44, Language.Indonesian } new object[] { 44, Language.Indonesian },
new object[] { 45, Language.Telugu }
}; };
public static object[] ToIntCases = public static object[] ToIntCases =
@ -107,7 +108,8 @@ namespace NzbDrone.Core.Test.Languages
new object[] { Language.Bosnian, 41 }, new object[] { Language.Bosnian, 41 },
new object[] { Language.Estonian, 42 }, new object[] { Language.Estonian, 42 },
new object[] { Language.Tamil, 43 }, new object[] { Language.Tamil, 43 },
new object[] { Language.Indonesian, 44 } new object[] { Language.Indonesian, 44 },
new object[] { Language.Telugu, 45 }
}; };
[Test] [Test]

@ -44,5 +44,14 @@ namespace NzbDrone.Core.Test.ParserTests
var result = IsoLanguages.Find(isoCode); var result = IsoLanguages.Find(isoCode);
result.Should().Be(null); result.Should().Be(null);
} }
[TestCase("te")]
[TestCase("tel")]
[TestCase("te-IN")]
public void should_return_telugu(string isoCode)
{
var result = IsoLanguages.Find(isoCode);
result.Language.Should().Be(Language.Telugu);
}
} }
} }

@ -362,6 +362,15 @@ namespace NzbDrone.Core.Test.ParserTests
result.Languages.Should().BeEquivalentTo(Language.Bengali); result.Languages.Should().BeEquivalentTo(Language.Bengali);
} }
[TestCase("Movie Title (2018) Telugu DVDScr X264 AAC 700 MB")]
[TestCase("Movie.Title.2022.Tel.WEBRip.x264-VXT")]
[TestCase("Movie Title (2019) Proper HDRip - 720p - x264 - HQ Line Auds - [Telugu + Tamil + Hindi + English] - 1.1GB")]
public void should_parse_language_telugu(string postTitle)
{
var result = Parser.Parser.ParseMovieTitle(postTitle);
result.Languages.Should().Contain(Language.Telugu);
}
[TestCase("Movie.Title.1994.HDTV.x264.SK-iCZi")] [TestCase("Movie.Title.1994.HDTV.x264.SK-iCZi")]
[TestCase("Movie.Title.2019.1080p.HDTV.x265.iNTERNAL.SK-iCZi")] [TestCase("Movie.Title.2019.1080p.HDTV.x265.iNTERNAL.SK-iCZi")]
[TestCase("Movie.Title.2018.SLOVAK.DUAL.2160p.UHD.BluRay.x265-iCZi")] [TestCase("Movie.Title.2018.SLOVAK.DUAL.2160p.UHD.BluRay.x265-iCZi")]

@ -115,6 +115,7 @@ namespace NzbDrone.Core.Languages
public static Language Estonian => new Language(42, "Estonian"); public static Language Estonian => new Language(42, "Estonian");
public static Language Tamil => new Language(43, "Tamil"); public static Language Tamil => new Language(43, "Tamil");
public static Language Indonesian => new Language(44, "Indonesian"); public static Language Indonesian => new Language(44, "Indonesian");
public static Language Telugu => new Language(45, "Telugu");
public static Language Any => new Language(-1, "Any"); public static Language Any => new Language(-1, "Any");
public static Language Original => new Language(-2, "Original"); public static Language Original => new Language(-2, "Original");
@ -169,6 +170,7 @@ namespace NzbDrone.Core.Languages
Estonian, Estonian,
Tamil, Tamil,
Indonesian, Indonesian,
Telugu,
Any, Any,
Original Original
}; };

@ -53,7 +53,8 @@ namespace NzbDrone.Core.Parser
new IsoLanguage("bs", "", "bos", "Bosnian", Language.Bosnian), new IsoLanguage("bs", "", "bos", "Bosnian", Language.Bosnian),
new IsoLanguage("et", "", "est", "Estonian", Language.Estonian), new IsoLanguage("et", "", "est", "Estonian", Language.Estonian),
new IsoLanguage("ta", "", "tam", "Tamil", Language.Tamil), new IsoLanguage("ta", "", "tam", "Tamil", Language.Tamil),
new IsoLanguage("id", "", "ind", "Indonesian", Language.Indonesian) new IsoLanguage("id", "", "ind", "Indonesian", Language.Indonesian),
new IsoLanguage("te", "", "tel", "Telugu", Language.Telugu)
}; };
public static IsoLanguage Find(string isoCode) public static IsoLanguage Find(string isoCode)

@ -30,7 +30,8 @@ namespace NzbDrone.Core.Parser
(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|||)| (?<chinese>\[(?:CH[ST]|BIG5|GB)\]|||)|
(?<ukrainian>(?:(?:\dx)?UKR))| (?<ukrainian>(?:(?:\dx)?UKR))|
(?<spanish>\b(?:español|castellano)\b)| (?<spanish>\b(?:español|castellano)\b)|
(?<latvian>\bLV\b)", (?<latvian>\bLV\b)|
(?<telugu>\btel\b)",
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace); RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)| private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)|
@ -212,6 +213,11 @@ namespace NzbDrone.Core.Parser
languages.Add(Language.Tamil); languages.Add(Language.Tamil);
} }
if (lowerTitle.Contains("telugu"))
{
languages.Add(Language.Telugu);
}
// Case sensitive // Case sensitive
var caseSensitiveMatchs = CaseSensitiveLanguageRegex.Matches(title); var caseSensitiveMatchs = CaseSensitiveLanguageRegex.Matches(title);
@ -336,6 +342,11 @@ namespace NzbDrone.Core.Parser
{ {
languages.Add(Language.Romanian); languages.Add(Language.Romanian);
} }
if (match.Groups["telugu"].Success)
{
languages.Add(Language.Telugu);
}
} }
if (!languages.Any()) if (!languages.Any())

Loading…
Cancel
Save