1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 18:02:44 +01:00

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

This commit is contained in:
Kalyan Chekuri 2023-05-25 17:49:36 +05:30 committed by Qstick
parent bbcd0b7861
commit af496fe701
6 changed files with 38 additions and 4 deletions

View File

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

View File

@ -44,5 +44,14 @@ public void should_not_return_portuguese(string isoCode)
var result = IsoLanguages.Find(isoCode);
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);
}
}
}

View File

@ -362,6 +362,15 @@ public void should_parse_language_bengali(string postTitle)
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.2019.1080p.HDTV.x265.iNTERNAL.SK-iCZi")]
[TestCase("Movie.Title.2018.SLOVAK.DUAL.2160p.UHD.BluRay.x265-iCZi")]

View File

@ -115,6 +115,7 @@ public override bool Equals(object obj)
public static Language Estonian => new Language(42, "Estonian");
public static Language Tamil => new Language(43, "Tamil");
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 Original => new Language(-2, "Original");
@ -169,6 +170,7 @@ public static List<Language> All
Estonian,
Tamil,
Indonesian,
Telugu,
Any,
Original
};

View File

@ -53,7 +53,8 @@ public static class IsoLanguages
new IsoLanguage("bs", "", "bos", "Bosnian", Language.Bosnian),
new IsoLanguage("et", "", "est", "Estonian", Language.Estonian),
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)

View File

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