mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 08:19:38 +02:00
New: Add Latvian language
This commit is contained in:
parent
90d0d8bec8
commit
61979bff7a
@ -47,6 +47,8 @@ public class LanguageFixture : CoreTest
|
||||
new object[] { 32, Language.Ukrainian },
|
||||
new object[] { 33, Language.Persian },
|
||||
new object[] { 34, Language.Bengali },
|
||||
new object[] { 35, Language.Slovak },
|
||||
new object[] { 36, Language.Latvian },
|
||||
};
|
||||
|
||||
public static object[] ToIntCases =
|
||||
@ -88,6 +90,8 @@ public class LanguageFixture : CoreTest
|
||||
new object[] { Language.Ukrainian, 32 },
|
||||
new object[] { Language.Persian, 33 },
|
||||
new object[] { Language.Bengali, 34 },
|
||||
new object[] { Language.Slovak, 35 },
|
||||
new object[] { Language.Latvian, 36 },
|
||||
};
|
||||
|
||||
[Test]
|
||||
|
@ -368,6 +368,16 @@ public void should_parse_language_slovak(string postTitle)
|
||||
result.Languages.Should().BeEquivalentTo(Language.Slovak);
|
||||
}
|
||||
|
||||
[TestCase("Movie.Title.2022.LV.WEBRip.XviD-LOL")]
|
||||
[TestCase("Movie.Title.2022.lv.WEBRip.XviD-LOL")]
|
||||
[TestCase("Movie.Title.2022.LATVIAN.WEBRip.XviD-LOL")]
|
||||
[TestCase("Movie.Title.2022.Latvian.WEBRip.XviD-LOL")]
|
||||
public void should_parse_language_latvian(string postTitle)
|
||||
{
|
||||
var result = Parser.Parser.ParseMovieTitle(postTitle);
|
||||
result.Languages.Should().BeEquivalentTo(Language.Latvian);
|
||||
}
|
||||
|
||||
[TestCase("Movie.Title.en.sub")]
|
||||
[TestCase("Movie Title.eng.sub")]
|
||||
[TestCase("Movie.Title.eng.forced.sub")]
|
||||
|
@ -106,6 +106,7 @@ public override bool Equals(object obj)
|
||||
public static Language Persian => new Language(33, "Persian");
|
||||
public static Language Bengali => new Language(34, "Bengali");
|
||||
public static Language Slovak => new Language(35, "Slovak");
|
||||
public static Language Latvian => new Language(36, "Latvian");
|
||||
public static Language Any => new Language(-1, "Any");
|
||||
public static Language Original => new Language(-2, "Original");
|
||||
|
||||
@ -151,6 +152,7 @@ public static List<Language> All
|
||||
Persian,
|
||||
Bengali,
|
||||
Slovak,
|
||||
Latvian,
|
||||
Any,
|
||||
Original
|
||||
};
|
||||
|
@ -43,7 +43,8 @@ public static class IsoLanguages
|
||||
new IsoLanguage("fa", "", "fas", "Persian", Language.Persian),
|
||||
new IsoLanguage("be", "", "ben", "Bengali", Language.Bengali),
|
||||
new IsoLanguage("lt", "", "lit", "Lithuanian", Language.Lithuanian),
|
||||
new IsoLanguage("sk", "", "slk", "Slovak", Language.Slovak)
|
||||
new IsoLanguage("sk", "", "slk", "Slovak", Language.Slovak),
|
||||
new IsoLanguage("lv", "", "lav", "Latvian", Language.Latvian)
|
||||
};
|
||||
|
||||
public static IsoLanguage Find(string isoCode)
|
||||
|
@ -27,7 +27,8 @@ public static class LanguageParser
|
||||
(?<hebrew>\bHebDub\b)|
|
||||
(?<polish>\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|
|
||||
(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)|
|
||||
(?<ukrainian>(?:(?:\dx)?UKR))",
|
||||
(?<ukrainian>(?:(?:\dx)?UKR))|
|
||||
(?<latvian>\bLV\b)",
|
||||
RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)|
|
||||
@ -189,6 +190,11 @@ public static List<Language> ParseLanguages(string title)
|
||||
languages.Add(Language.Slovak);
|
||||
}
|
||||
|
||||
if (lowerTitle.Contains("latvian"))
|
||||
{
|
||||
languages.Add(Language.Latvian);
|
||||
}
|
||||
|
||||
// Case sensitive
|
||||
var caseSensitiveMatch = CaseSensitiveLanguageRegex.Match(title);
|
||||
|
||||
@ -295,6 +301,11 @@ public static List<Language> ParseLanguages(string title)
|
||||
{
|
||||
languages.Add(Language.Ukrainian);
|
||||
}
|
||||
|
||||
if (match.Groups["latvian"].Success)
|
||||
{
|
||||
languages.Add(Language.Latvian);
|
||||
}
|
||||
}
|
||||
|
||||
if (!languages.Any())
|
||||
|
Loading…
Reference in New Issue
Block a user