From f8b8afdaa2223cd66230902ff5a3629f972dbaf9 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sun, 7 Feb 2021 19:28:46 +0100 Subject: [PATCH] New: Added Arabic language --- .../ParserTests/LanguageParserFixture.cs | 7 +++++++ src/NzbDrone.Core/Languages/Language.cs | 6 ++++-- src/NzbDrone.Core/Parser/IsoLanguages.cs | 3 ++- src/NzbDrone.Core/Parser/LanguageParser.cs | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs index 2f76662eb..5812988c2 100644 --- a/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs @@ -232,6 +232,13 @@ namespace NzbDrone.Core.Test.ParserTests result.Language.Id.Should().Be(Language.Czech.Id); } + [TestCase("Antinormal.S01.ARABIC.COMPLETE.720p.NF.WEBRip.x264-PTV")] + public void should_parse_language_arabic(string postTitle) + { + var result = Parser.Parser.ParseTitle(postTitle); + result.Language.Id.Should().Be(Language.Arabic.Id); + } + [TestCase("Russian.Puppets.S01E07.Cold.Action.HDTV.XviD-Droned")] [TestCase("Russian.Puppets.S01E07E08.Cold.Action.HDTV.XviD-Droned")] [TestCase("Russian.Puppets.S01.1080p.WEBRip.DDP5.1.x264-Drone")] diff --git a/src/NzbDrone.Core/Languages/Language.cs b/src/NzbDrone.Core/Languages/Language.cs index 26bf463a3..8acbe471d 100644 --- a/src/NzbDrone.Core/Languages/Language.cs +++ b/src/NzbDrone.Core/Languages/Language.cs @@ -81,8 +81,9 @@ namespace NzbDrone.Core.Languages public static Language Hebrew { get { return new Language(23, "Hebrew"); } } public static Language Lithuanian { get { return new Language(24, "Lithuanian"); } } public static Language Czech { get { return new Language(25, "Czech"); } } + public static Language Arabic { get { return new Language(26, "Arabic"); } } + - public static List All { get @@ -114,7 +115,8 @@ namespace NzbDrone.Core.Languages Hungarian, Hebrew, Lithuanian, - Czech + Czech, + Arabic }; } } diff --git a/src/NzbDrone.Core/Parser/IsoLanguages.cs b/src/NzbDrone.Core/Parser/IsoLanguages.cs index bb9908295..f9c32cdcc 100644 --- a/src/NzbDrone.Core/Parser/IsoLanguages.cs +++ b/src/NzbDrone.Core/Parser/IsoLanguages.cs @@ -33,7 +33,8 @@ namespace NzbDrone.Core.Parser new IsoLanguage("hu", "hun", Language.Hungarian), new IsoLanguage("he", "heb", Language.Hebrew), new IsoLanguage("lt", "lit", Language.Lithuanian), - new IsoLanguage("cs", "ces", Language.Czech) + new IsoLanguage("cs", "ces", Language.Czech), + new IsoLanguage("ar", "ara", Language.Arabic) }; public static IsoLanguage Find(string isoCode) diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index 9b5ba021a..84ab52561 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -93,6 +93,9 @@ namespace NzbDrone.Core.Parser if (lowerTitle.Contains("hebrew")) return Language.Hebrew; + if (lowerTitle.Contains("arabic")) + return Language.Arabic; + var regexLanguage = RegexLanguage(title); if (regexLanguage != Language.Unknown)