Skip to content

Commit 0761e27

Browse files
New: Parse ES as Spanish
1 parent 4f47bb3 commit 0761e27

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/NzbDrone.Core.Test/ParserTests/LanguageParserFixture.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public void should_parse_language_french_english(string postTitle)
7676
[TestCase("Movie Title (2016) [UHDRemux 2160p SDR] [Castellano DD 5.1 - Inglés DTS-HD MA 5.1 Subs]")]
7777
[TestCase("Movie Title 2022 [HDTV 720p][Cap.101][AC3 5.1 Castellano][www.pctnew.ORG]")]
7878
[TestCase("Movie Title 2022 [HDTV 720p][Cap.206][AC3 5.1 Español Castellano]")]
79+
[TestCase("Movie Title 2022 [Remux-1080p 8-bit h264 DTS-HD MA 2.0][ES.EN]-HiFi")]
80+
[TestCase("Movie Title 2022 [BDRemux 1080p AVC ES DTS-HD MA 5.1 Subs][HDO].mkv")]
81+
[TestCase("Movie.Name.2022.BluRay.1080p.H264.DTS[EN+ES].[EN+ES+IT]")]
7982
public void should_parse_language_spanish(string postTitle)
8083
{
8184
var result = Parser.Parser.ParseMovieTitle(postTitle, true);

src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public void should_parse_tmdb_id(string postTitle, int tmdbId)
258258
[TestCase("The.Good.German.2006.720p.HDTV.x264-TVP", Description = "The Good German is hardcoded not to match")]
259259
[TestCase("German.Lancers.2019.720p.BluRay.x264-UNiVERSUM", Description = "German at the beginning is never matched")]
260260
[TestCase("The.German.2019.720p.BluRay.x264-UNiVERSUM", Description = "The German is hardcoded not to match")]
261+
[TestCase("Movie Name (2016) BluRay 1080p DTS-ES AC3 x264-3Li", Description = "DTS-ES should not match ES (Spanish)")]
261262
public void should_not_parse_wrong_language_in_title(string postTitle)
262263
{
263264
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);

src/NzbDrone.Core/Parser/LanguageParser.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public static class LanguageParser
3939
private static readonly Regex CaseSensitiveLanguageRegex = new Regex(@"(?:(?i)(?<!SUB[\W|_|^]))(?:(?<lithuanian>\bLT\b)|
4040
(?<czech>\bCZ\b)|
4141
(?<polish>\bPL\b)|
42-
(?<bulgarian>\bBG\b))(?:(?i)(?![\W|_|^]SUB))|
43-
(?<slovak>\bSK\b)",
42+
(?<bulgarian>\bBG\b)|
43+
(?<slovak>\bSK\b)|
44+
(?<spanish>\b(?<!DTS[._ -])ES\b))(?:(?i)(?![\W|_|^]SUB))",
4445
RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace);
4546

4647
private static readonly Regex GermanDualLanguageRegex = new (@"(?<!WEB[-_. ]?)\bDL\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
@@ -261,6 +262,11 @@ public static List<Language> ParseLanguages(string title)
261262
{
262263
languages.Add(Language.Slovak);
263264
}
265+
266+
if (match.Groups["spanish"].Captures.Any())
267+
{
268+
languages.Add(Language.Spanish);
269+
}
264270
}
265271

266272
var matches = LanguageRegex.Matches(title);

0 commit comments

Comments
 (0)