From 561993e30c61b20efd9bc5c70c940472fc135122 Mon Sep 17 00:00:00 2001 From: Qstick Date: Fri, 25 Nov 2022 19:16:29 -0600 Subject: [PATCH] Fixed: Parse multiple languages for two letter cases Fixes #7783 --- src/NzbDrone.Core/Parser/LanguageParser.cs | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index 133e21f1c..865732574 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; +using Microsoft.Extensions.FileSystemGlobbing; using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Common.Instrumentation; @@ -197,31 +198,34 @@ namespace NzbDrone.Core.Parser } // Case sensitive - var caseSensitiveMatch = CaseSensitiveLanguageRegex.Match(title); + var caseSensitiveMatchs = CaseSensitiveLanguageRegex.Matches(title); - if (caseSensitiveMatch.Groups["lithuanian"].Captures.Cast().Any()) + foreach (Match match in caseSensitiveMatchs) { - languages.Add(Language.Lithuanian); - } + if (match.Groups["lithuanian"].Captures.Cast().Any()) + { + languages.Add(Language.Lithuanian); + } - if (caseSensitiveMatch.Groups["czech"].Captures.Cast().Any()) - { - languages.Add(Language.Czech); - } + if (match.Groups["czech"].Captures.Cast().Any()) + { + languages.Add(Language.Czech); + } - if (caseSensitiveMatch.Groups["polish"].Captures.Cast().Any()) - { - languages.Add(Language.Polish); - } + if (match.Groups["polish"].Captures.Cast().Any()) + { + languages.Add(Language.Polish); + } - if (caseSensitiveMatch.Groups["bulgarian"].Captures.Cast().Any()) - { - languages.Add(Language.Bulgarian); - } + if (match.Groups["bulgarian"].Captures.Cast().Any()) + { + languages.Add(Language.Bulgarian); + } - if (caseSensitiveMatch.Groups["slovak"].Captures.Cast().Any()) - { - languages.Add(Language.Slovak); + if (match.Groups["slovak"].Captures.Cast().Any()) + { + languages.Add(Language.Slovak); + } } var matches = LanguageRegex.Matches(title);