New: Add Bulgarian Language

Fixes #4111
pull/5153/head
Qstick 4 years ago
parent e28bea14b3
commit 37c1b5b28c

@ -139,6 +139,15 @@ namespace NzbDrone.Core.Test.ParserTests
result.Languages.Should().BeEquivalentTo(Language.Thai);
}
[TestCase("Pulp.Fiction.1994.Bulgarian.1080p.XviD-LOL")]
[TestCase("Pulp.Fiction.1994.BGAUDIO.1080p.XviD-LOL")]
public void should_parse_language_bulgarian(string postTitle)
{
var result = Parser.Parser.ParseMovieTitle(postTitle, true);
result.Languages.Should().BeEquivalentTo(Language.Bulgarian);
}
[TestCase("Pulp.Fiction.1994.Polish.1080p.XviD-LOL")]
public void should_parse_language_polish(string postTitle)
{

@ -99,6 +99,7 @@ namespace NzbDrone.Core.Languages
public static Language Hindi => new Language(26, "Hindi");
public static Language Romanian => new Language(27, "Romanian");
public static Language Thai => new Language(28, "Thai");
public static Language Bulgarian => new Language(29, "Bulgarian");
public static Language Any => new Language(-1, "Any");
public static Language Original => new Language(-2, "Original");
@ -137,6 +138,7 @@ namespace NzbDrone.Core.Languages
Romanian,
Hindi,
Thai,
Bulgarian,
Any,
Original
};

@ -34,6 +34,7 @@ namespace NzbDrone.Core.Parser
new IsoLanguage("cs", "", "ces", "Czech", Language.Czech),
new IsoLanguage("hi", "", "hin", "Hindi", Language.Hindi),
new IsoLanguage("th", "", "tha", "Thai", Language.Thai),
new IsoLanguage("bg", "", "bul", "Bulgarian", Language.Bulgarian),
new IsoLanguage("ro", "", "ron", "Romanian", Language.Romanian)
};

@ -14,7 +14,7 @@ namespace NzbDrone.Core.Parser
{
private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(LanguageParser));
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_|^)(?<italian>\b(?:ita|italian)\b)|(?<german>\b(?:german|videomann|ger)\b)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VO|VFF|VFQ|VFI|VF2|TRUEFRENCH)(?:\W|_))|(?<russian>\brus\b)|(?<english>\beng\b)|(?<hungarian>\b(?:HUNDUB|HUN)\b)|(?<hebrew>\bHebDub\b)|(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)",
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_|^)(?<italian>\b(?:ita|italian)\b)|(?<german>\b(?:german|videomann|ger)\b)|(?<flemish>flemish)|(?<bulgarian>bgaudio)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VO|VFF|VFQ|VFI|VF2|TRUEFRENCH)(?:\W|_))|(?<russian>\brus\b)|(?<english>\beng\b)|(?<hungarian>\b(?:HUNDUB|HUN)\b)|(?<hebrew>\bHebDub\b)|(?<chinese>\[(?:CH[ST]|BIG5|GB)\]|简|繁|字幕)",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?<lithuanian>\bLT\b)|(?<czech>\bCZ\b)",
@ -92,6 +92,11 @@ namespace NzbDrone.Core.Parser
languages.Add(Language.Thai);
}
if (lowerTitle.Contains("bulgarian"))
{
languages.Add(Language.Bulgarian);
}
if (lowerTitle.Contains("polish"))
{
languages.Add(Language.Polish);
@ -189,6 +194,11 @@ namespace NzbDrone.Core.Parser
languages.Add(Language.English);
}
if (match.Groups["bulgarian"].Success)
{
languages.Add(Language.Bulgarian);
}
if (match.Groups["dutch"].Success)
{
languages.Add(Language.Dutch);

Loading…
Cancel
Save