From 58ae4417dfd84801f2320738045053db5bfdab1c Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 24 Feb 2019 12:26:20 -0500 Subject: [PATCH] Fixed: Cannot Add ITA or ITALIAN custom format (#3385) Fixes #3253 --- src/NzbDrone.Core.Test/CustomFormat/QualityTagFixture.cs | 4 +++- src/NzbDrone.Core/Parser/LanguageParser.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/CustomFormat/QualityTagFixture.cs b/src/NzbDrone.Core.Test/CustomFormat/QualityTagFixture.cs index 1e07a8230..4d8c965d3 100644 --- a/src/NzbDrone.Core.Test/CustomFormat/QualityTagFixture.cs +++ b/src/NzbDrone.Core.Test/CustomFormat/QualityTagFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Text.RegularExpressions; using FluentAssertions; using NUnit.Framework; @@ -23,6 +23,8 @@ public class QualityTagFixture : CoreTest [TestCase("S_WEBdL", TagType.Source, Source.WEBDL)] [TestCase("S_CAM", TagType.Source, Source.CAM)] [TestCase("L_English", TagType.Language, Language.English)] + [TestCase("L_Italian", TagType.Language, Language.Italian)] + [TestCase("L_iTa", TagType.Language, Language.Italian)] [TestCase("L_germaN", TagType.Language, Language.German)] [TestCase("E_Director", TagType.Edition, "director")] [TestCase("E_RX_Director('?s)?", TagType.Edition, "director('?s)?", TagModifier.Regex)] diff --git a/src/NzbDrone.Core/Parser/LanguageParser.cs b/src/NzbDrone.Core/Parser/LanguageParser.cs index a990ffab9..128db51c9 100644 --- a/src/NzbDrone.Core/Parser/LanguageParser.cs +++ b/src/NzbDrone.Core/Parser/LanguageParser.cs @@ -13,7 +13,7 @@ public static class LanguageParser { private static readonly Logger Logger = NzbDroneLogger.GetLogger(typeof(LanguageParser)); - private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?\b(?:ita|italian)\b)|(?german\b|videomann)|(?flemish)|(?greek)|(?(?:\W|_)(?:FR|VOSTFR|VO|VFF|VFQ|VF2|TRUEFRENCH)(?:\W|_))|(?\brus\b)|(?nl\W?subs?)|(?\b(?:HUNDUB|HUN)\b)|(?\bHebDub\b)|(?\b(?:CZ|SK)\b)", + private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_|^)(?\b(?:ita|italian)\b)|(?german\b|videomann)|(?flemish)|(?greek)|(?(?:\W|_)(?:FR|VOSTFR|VO|VFF|VFQ|VF2|TRUEFRENCH)(?:\W|_))|(?\brus\b)|(?nl\W?subs?)|(?\b(?:HUNDUB|HUN)\b)|(?\bHebDub\b)|(?\b(?:CZ|SK)\b)", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex SubtitleLanguageRegex = new Regex(".+?[-_. ](?[a-z]{2,3})(?:[-_. ]forced)?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);