mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 16:29:41 +02:00
New: Add Slovak Language
This commit is contained in:
parent
c1f538ed97
commit
b549fddf95
@ -342,6 +342,16 @@ public void should_parse_language_bengali(string postTitle)
|
||||
result.Languages.Should().BeEquivalentTo(Language.Bengali);
|
||||
}
|
||||
|
||||
[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")]
|
||||
[TestCase("Movie.Title.1990.SLOVAK.HDTV.x264-iCZi")]
|
||||
public void should_parse_language_slovak(string postTitle)
|
||||
{
|
||||
var result = Parser.Parser.ParseMovieTitle(postTitle);
|
||||
result.Languages.Should().BeEquivalentTo(Language.Slovak);
|
||||
}
|
||||
|
||||
[TestCase("Movie.Title.en.sub")]
|
||||
[TestCase("Movie Title.eng.sub")]
|
||||
[TestCase("Movie.Title.eng.forced.sub")]
|
||||
|
@ -105,6 +105,7 @@ public override bool Equals(object obj)
|
||||
public static Language Ukrainian => new Language(32, "Ukrainian");
|
||||
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 Any => new Language(-1, "Any");
|
||||
public static Language Original => new Language(-2, "Original");
|
||||
|
||||
@ -149,6 +150,7 @@ public static List<Language> All
|
||||
Ukrainian,
|
||||
Persian,
|
||||
Bengali,
|
||||
Slovak,
|
||||
Any,
|
||||
Original
|
||||
};
|
||||
|
@ -42,7 +42,8 @@ public static class IsoLanguages
|
||||
new IsoLanguage("uk", "", "ukr", "Ukrainian", Language.Ukrainian),
|
||||
new IsoLanguage("fa", "", "fas", "Persian", Language.Persian),
|
||||
new IsoLanguage("be", "", "ben", "Bengali", Language.Bengali),
|
||||
new IsoLanguage("lt", "", "lit", "Lithuanian", Language.Lithuanian)
|
||||
new IsoLanguage("lt", "", "lit", "Lithuanian", Language.Lithuanian),
|
||||
new IsoLanguage("sk", "", "slk", "Slovak", Language.Slovak)
|
||||
};
|
||||
|
||||
public static IsoLanguage Find(string isoCode)
|
||||
|
@ -32,7 +32,8 @@ public static class LanguageParser
|
||||
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)|
|
||||
(?<czech>\bCZ\b)|
|
||||
(?<polish>\bPL\b)|
|
||||
(?<bulgarian>\bBG\b))(?:(?i)(?![\W|_|^]SUB))",
|
||||
(?<bulgarian>\bBG\b))(?:(?i)(?![\W|_|^]SUB))|
|
||||
(?<slovak>\bSK\b)",
|
||||
RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
|
||||
|
||||
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})(?:[-_. ]forced)?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
@ -182,6 +183,11 @@ public static List<Language> ParseLanguages(string title)
|
||||
languages.Add(Language.Bengali);
|
||||
}
|
||||
|
||||
if (lowerTitle.Contains("slovak"))
|
||||
{
|
||||
languages.Add(Language.Slovak);
|
||||
}
|
||||
|
||||
// Case sensitive
|
||||
var caseSensitiveMatch = CaseSensitiveLanguageRegex.Match(title);
|
||||
|
||||
@ -205,6 +211,11 @@ public static List<Language> ParseLanguages(string title)
|
||||
languages.Add(Language.Bulgarian);
|
||||
}
|
||||
|
||||
if (caseSensitiveMatch.Groups["slovak"].Captures.Cast<Capture>().Any())
|
||||
{
|
||||
languages.Add(Language.Slovak);
|
||||
}
|
||||
|
||||
var matches = LanguageRegex.Matches(title);
|
||||
|
||||
foreach (Match match in matches)
|
||||
|
Loading…
Reference in New Issue
Block a user