New: Add Additional Languages

Fixes #6257
Fixes #7967
Closes #7592
Reference #7788

Co-Authored-By: dtalens <6631832+dtalens@users.noreply.github.com>
This commit is contained in:
Qstick 2023-02-12 15:03:45 -06:00
parent fcf5984944
commit c6e91e028b
6 changed files with 56 additions and 4 deletions

View File

@ -49,7 +49,14 @@ namespace NzbDrone.Core.Test.Languages
new object[] { 34, Language.Bengali },
new object[] { 35, Language.Slovak },
new object[] { 36, Language.Latvian },
new object[] { 37, Language.SpanishLatino }
new object[] { 37, Language.SpanishLatino },
new object[] { 38, Language.Catalan },
new object[] { 39, Language.Croatian },
new object[] { 40, Language.Serbian },
new object[] { 41, Language.Bosnian },
new object[] { 42, Language.Estonian },
new object[] { 43, Language.Tamil },
new object[] { 44, Language.Indonesian }
};
public static object[] ToIntCases =
@ -93,7 +100,14 @@ namespace NzbDrone.Core.Test.Languages
new object[] { Language.Bengali, 34 },
new object[] { Language.Slovak, 35 },
new object[] { Language.Latvian, 36 },
new object[] { Language.SpanishLatino, 37 }
new object[] { Language.SpanishLatino, 37 },
new object[] { Language.Catalan, 38 },
new object[] { Language.Croatian, 39 },
new object[] { Language.Serbian, 40 },
new object[] { Language.Bosnian, 41 },
new object[] { Language.Estonian, 42 },
new object[] { Language.Tamil, 43 },
new object[] { Language.Indonesian, 44 }
};
[Test]

View File

@ -22,7 +22,6 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("enus")]
[TestCase("enusa")]
[TestCase("wo")]
[TestCase("ca-IT")]
[TestCase("fr-CA")]
public void unknown_or_invalid_code_should_return_null(string isoCode)
{

View File

@ -393,6 +393,14 @@ namespace NzbDrone.Core.Test.ParserTests
result.First().Id.Should().Be(Language.SpanishLatino.Id);
}
[TestCase("Movie.Title.1994.Catalan.1080p.XviD-LOL")]
public void should_parse_language_catalan(string postTitle)
{
var result = Parser.Parser.ParseMovieTitle(postTitle, true);
result.Languages.Should().BeEquivalentTo(Language.Catalan);
}
[TestCase("Movie.Title.en.sub")]
[TestCase("Movie Title.eng.sub")]
[TestCase("Movie.Title.eng.forced.sub")]

View File

@ -108,6 +108,13 @@ namespace NzbDrone.Core.Languages
public static Language Slovak => new Language(35, "Slovak");
public static Language Latvian => new Language(36, "Latvian");
public static Language SpanishLatino => new Language(37, "Spanish (Latino)");
public static Language Catalan => new Language(38, "Catalan");
public static Language Croatian => new Language(39, "Croatian");
public static Language Serbian => new Language(40, "Serbian");
public static Language Bosnian => new Language(41, "Bosnian");
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 Any => new Language(-1, "Any");
public static Language Original => new Language(-2, "Original");
@ -155,6 +162,13 @@ namespace NzbDrone.Core.Languages
Slovak,
Latvian,
SpanishLatino,
Catalan,
Croatian,
Serbian,
Bosnian,
Estonian,
Tamil,
Indonesian,
Any,
Original
};

View File

@ -45,7 +45,14 @@ namespace NzbDrone.Core.Parser
new IsoLanguage("lt", "", "lit", "Lithuanian", Language.Lithuanian),
new IsoLanguage("sk", "", "slk", "Slovak", Language.Slovak),
new IsoLanguage("lv", "", "lav", "Latvian", Language.Latvian),
new IsoLanguage("es", "mx", "spa", "Spanish (Latino)", Language.SpanishLatino)
new IsoLanguage("es", "mx", "spa", "Spanish (Latino)", Language.SpanishLatino),
new IsoLanguage("ca", "", "cat", "Catalan", Language.Catalan),
new IsoLanguage("hr", "", "hrv", "Croatian", Language.Croatian),
new IsoLanguage("sr", "", "srp", "Serbian", Language.Serbian),
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)
};
public static IsoLanguage Find(string isoCode)

View File

@ -202,6 +202,16 @@ namespace NzbDrone.Core.Parser
languages.Add(Language.SpanishLatino);
}
if (lowerTitle.Contains("catalan"))
{
languages.Add(Language.Catalan);
}
if (lowerTitle.Contains("tamil"))
{
languages.Add(Language.Tamil);
}
// Case sensitive
var caseSensitiveMatchs = CaseSensitiveLanguageRegex.Matches(title);