From c3665e9fea1c73719b3763b8cc2fc7643263bae4 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sat, 4 Feb 2023 17:42:39 -0600 Subject: [PATCH] New: Spanish (Latino) languages Closes #7914 Closes #3467 Closes #6415 --- src/NzbDrone.Core.Test/Languages/LanguageFixture.cs | 2 ++ .../ParserTests/LanguageParserFixture.cs | 13 +++++++++++++ src/NzbDrone.Core/Languages/Language.cs | 2 ++ src/NzbDrone.Core/Parser/IsoLanguages.cs | 3 ++- src/NzbDrone.Core/Parser/LanguageParser.cs | 5 +++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/Languages/LanguageFixture.cs b/src/NzbDrone.Core.Test/Languages/LanguageFixture.cs index 6b7cd62a6..3824aec4f 100644 --- a/src/NzbDrone.Core.Test/Languages/LanguageFixture.cs +++ b/src/NzbDrone.Core.Test/Languages/LanguageFixture.cs @@ -49,6 +49,7 @@ 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 } }; public static object[] ToIntCases = @@ -92,6 +93,7 @@ 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 } }; [Test] diff --git a/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs index ab8564285..9d0ffddbc 100644 --- a/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs @@ -1,3 +1,4 @@ +using System.Linq; using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Languages; @@ -380,6 +381,18 @@ namespace NzbDrone.Core.Test.ParserTests result.Languages.Should().BeEquivalentTo(Language.Latvian); } + [TestCase("Movie.Title.2019.720p_Eng-Spa(Latino)_MovieClubMx")] + [TestCase("Movie.Title.1.WEB-DL.720p.Complete.Latino.YG")] + [TestCase("Movie.Title.1080p.WEB.H264.Latino.YG")] + [TestCase("Movie Title latino")] + [TestCase("Movie Title (Temporada 11 Completa) Audio Dual Ingles/Latino 1920x1080")] + [TestCase("Movie title 7x4 audio latino")] + public void should_parse_language_spanish_latino(string postTitle) + { + var result = LanguageParser.ParseLanguages(postTitle); + result.First().Id.Should().Be(Language.SpanishLatino.Id); + } + [TestCase("Movie.Title.en.sub")] [TestCase("Movie Title.eng.sub")] [TestCase("Movie.Title.eng.forced.sub")] diff --git a/src/NzbDrone.Core/Languages/Language.cs b/src/NzbDrone.Core/Languages/Language.cs index 37f01ab5e..b91422a36 100644 --- a/src/NzbDrone.Core/Languages/Language.cs +++ b/src/NzbDrone.Core/Languages/Language.cs @@ -107,6 +107,7 @@ namespace NzbDrone.Core.Languages 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 SpanishLatino => new Language(37, "Spanish (Latino)"); public static Language Any => new Language(-1, "Any"); public static Language Original => new Language(-2, "Original"); @@ -153,6 +154,7 @@ namespace NzbDrone.Core.Languages Bengali, Slovak, Latvian, + SpanishLatino, Any, Original }; diff --git a/src/NzbDrone.Core/Parser/IsoLanguages.cs b/src/NzbDrone.Core/Parser/IsoLanguages.cs index 72eb74ccd..705543a0f 100644 --- a/src/NzbDrone.Core/Parser/IsoLanguages.cs +++ b/src/NzbDrone.Core/Parser/IsoLanguages.cs @@ -44,7 +44,8 @@ namespace NzbDrone.Core.Parser new IsoLanguage("be", "", "ben", "Bengali", Language.Bengali), new IsoLanguage("lt", "", "lit", "Lithuanian", Language.Lithuanian), new IsoLanguage("sk", "", "slk", "Slovak", Language.Slovak), - new IsoLanguage("lv", "", "lav", "Latvian", Language.Latvian) + new IsoLanguage("lv", "", "lav", "Latvian", Language.Latvian), + new IsoLanguage("es", "mx", "spa", "Spanish (Latino)", Language.SpanishLatino) }; public static IsoLanguage Find(string isoCode) diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index 865732574..787b2a033 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -197,6 +197,11 @@ namespace NzbDrone.Core.Parser languages.Add(Language.Latvian); } + if (lowerTitle.Contains("latino")) + { + languages.Add(Language.SpanishLatino); + } + // Case sensitive var caseSensitiveMatchs = CaseSensitiveLanguageRegex.Matches(title);