New: Add Slovak Language
This commit is contained in:
parent
f6e6bc98f7
commit
3477dfacd0
|
@ -298,6 +298,14 @@ namespace NzbDrone.Core.Test.ParserTests
|
||||||
result.First().Id.Should().Be(Language.Ukrainian.Id);
|
result.First().Id.Should().Be(Language.Ukrainian.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("Title.the.Series.2022.S02E22.Slovak.HDTV.XviD-LOL")]
|
||||||
|
[TestCase("Title.the.Series.2021.S01E11.HDTV.XviD.ENG.SK-LOL")]
|
||||||
|
public void should_parse_language_slovak(string postTitle)
|
||||||
|
{
|
||||||
|
var result = LanguageParser.ParseLanguage(postTitle);
|
||||||
|
result.Id.Should().Be(Language.Slovak.Id);
|
||||||
|
}
|
||||||
|
|
||||||
[TestCase("Title.the.Russian.Series.S01E07.Cold.Action.HDTV.XviD-Droned")]
|
[TestCase("Title.the.Russian.Series.S01E07.Cold.Action.HDTV.XviD-Droned")]
|
||||||
[TestCase("Title.the.Russian.Series.S01E07E08.Cold.Action.HDTV.XviD-Droned")]
|
[TestCase("Title.the.Russian.Series.S01E07E08.Cold.Action.HDTV.XviD-Droned")]
|
||||||
[TestCase("Title.the.Russian.Series.S01.1080p.WEBRip.DDP5.1.x264-Drone")]
|
[TestCase("Title.the.Russian.Series.S01.1080p.WEBRip.DDP5.1.x264-Drone")]
|
||||||
|
|
|
@ -101,6 +101,7 @@ namespace NzbDrone.Core.Languages
|
||||||
public static Language Bulgarian => new Language(28, "Bulgarian");
|
public static Language Bulgarian => new Language(28, "Bulgarian");
|
||||||
public static Language Malayalam => new Language(29, "Malayalam");
|
public static Language Malayalam => new Language(29, "Malayalam");
|
||||||
public static Language Ukrainian => new Language(30, "Ukrainian");
|
public static Language Ukrainian => new Language(30, "Ukrainian");
|
||||||
|
public static Language Slovak => new Language(31, "Slovak");
|
||||||
|
|
||||||
public static List<Language> All
|
public static List<Language> All
|
||||||
{
|
{
|
||||||
|
@ -138,7 +139,8 @@ namespace NzbDrone.Core.Languages
|
||||||
Hindi,
|
Hindi,
|
||||||
Bulgarian,
|
Bulgarian,
|
||||||
Malayalam,
|
Malayalam,
|
||||||
Ukrainian
|
Ukrainian,
|
||||||
|
Slovak
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace NzbDrone.Core.Parser
|
||||||
new IsoLanguage("bg", "", "bul", Language.Bulgarian),
|
new IsoLanguage("bg", "", "bul", Language.Bulgarian),
|
||||||
new IsoLanguage("ml", "", "mal", Language.Malayalam),
|
new IsoLanguage("ml", "", "mal", Language.Malayalam),
|
||||||
new IsoLanguage("uk", "", "ukr", Language.Ukrainian),
|
new IsoLanguage("uk", "", "ukr", Language.Ukrainian),
|
||||||
|
new IsoLanguage("sk", "", "slk", Language.Slovak)
|
||||||
};
|
};
|
||||||
|
|
||||||
public static IsoLanguage Find(string isoCode)
|
public static IsoLanguage Find(string isoCode)
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace NzbDrone.Core.Parser
|
||||||
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\b(?:ita|italian)\b)|(?<german>german\b|videomann|ger[. ]dub)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VF|VF2|VFF|VFQ|TRUEFRENCH)(?:\W|_))|(?<russian>\brus\b)|(?<hungarian>\b(?:HUNDUB|HUN)\b)|(?<hebrew>\bHebDub\b)|(?<polish>\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)|(?<bulgarian>\bbgaudio\b)|(?<spanish>\b(?:español|castellano)\b)|(?<ukrainian>\b(?:ukr)\b)",
|
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\b(?:ita|italian)\b)|(?<german>german\b|videomann|ger[. ]dub)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VF|VF2|VFF|VFQ|TRUEFRENCH)(?:\W|_))|(?<russian>\brus\b)|(?<hungarian>\b(?:HUNDUB|HUN)\b)|(?<hebrew>\bHebDub\b)|(?<polish>\b(?:PL\W?DUB|DUB\W?PL|LEK\W?PL|PL\W?LEK)\b)|(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)|(?<bulgarian>\bbgaudio\b)|(?<spanish>\b(?:español|castellano)\b)|(?<ukrainian>\b(?:ukr)\b)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
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))",
|
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)|(?<czech>\bCZ\b)|(?<polish>\bPL\b)|(?<bulgarian>\bBG\b)|(?<slovak>\bSK\b))(?:(?i)(?![\W|_|^]SUB))",
|
||||||
RegexOptions.Compiled);
|
RegexOptions.Compiled);
|
||||||
|
|
||||||
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})([-_. ](?<tags>full|forced|foreign|default|cc|psdh|sdh))*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?<iso_code>[a-z]{2,3})([-_. ](?<tags>full|forced|foreign|default|cc|psdh|sdh))*$", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||||
|
@ -156,6 +156,11 @@ namespace NzbDrone.Core.Parser
|
||||||
languages.Add(Language.Bulgarian);
|
languages.Add(Language.Bulgarian);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lowerTitle.Contains("slovak"))
|
||||||
|
{
|
||||||
|
languages.Add(Language.Slovak);
|
||||||
|
}
|
||||||
|
|
||||||
var regexLanguages = RegexLanguage(title);
|
var regexLanguages = RegexLanguage(title);
|
||||||
|
|
||||||
if (regexLanguages.Any())
|
if (regexLanguages.Any())
|
||||||
|
@ -257,6 +262,11 @@ namespace NzbDrone.Core.Parser
|
||||||
languages.Add(Language.Bulgarian);
|
languages.Add(Language.Bulgarian);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (caseSensitiveMatch.Groups["slovak"].Captures.Cast<Capture>().Any())
|
||||||
|
{
|
||||||
|
languages.Add(Language.Slovak);
|
||||||
|
}
|
||||||
|
|
||||||
// Case insensitive
|
// Case insensitive
|
||||||
var match = LanguageRegex.Match(title);
|
var match = LanguageRegex.Match(title);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue