Fixed: Parsing 'NL Subs' in addition to NLSub

pull/6/head
Mark McDowall 10 years ago
parent 889af78b26
commit 121ec0873b

@ -1,5 +1,3 @@
using System;
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Parser;
@ -42,6 +40,8 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("The.Trip.To.Italy.S02E01.720p.HDTV.x264-TLA", Language.English)]
[TestCase("Revolution S01E03 No Quarter 2012 WEB-DL 720p Nordic-philipo mkv", Language.Norwegian)]
[TestCase("Extant.S01E01.VOSTFR.HDTV.x264-RiDERS", Language.French)]
[TestCase("Constantine.2014.S01E01.WEBRiP.H264.AAC.5.1-NL.SUBS", Language.Dutch)]
[TestCase("Elementary - S02E16 - Kampfhaehne - mkv - by Videomann", Language.German)]
public void should_parse_language(string postTitle, Language language)
{
var result = Parser.Parser.ParseTitle(postTitle);

@ -144,7 +144,7 @@ namespace NzbDrone.Core.Parser
private static readonly Regex MultiPartCleanupRegex = new Regex(@"\(\d+\)$", RegexOptions.Compiled);
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\bita\b|italian)|(?<german>german\b)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?<russian>\brus\b)",
private static readonly Regex LanguageRegex = new Regex(@"(?:\W|_)(?<italian>\bita\b|italian)|(?<german>german\b|videomann)|(?<flemish>flemish)|(?<greek>greek)|(?<french>(?:\W|_)(?:FR|VOSTFR)(?:\W|_))|(?<russian>\brus\b)|(?<dutch>nl\W?subs?)",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex YearInTitleRegex = new Regex(@"^(?<title>.+?)(?:\W|_)?(?<year>\d{4})",
@ -527,9 +527,6 @@ namespace NzbDrone.Core.Parser
if (lowerTitle.Contains("dutch"))
return Language.Dutch;
if (lowerTitle.Contains("nlsub"))
return Language.Dutch;
if (lowerTitle.Contains("japanese"))
return Language.Japanese;
@ -589,6 +586,9 @@ namespace NzbDrone.Core.Parser
if (match.Groups["russian"].Success)
return Language.Russian;
if (match.Groups["dutch"].Success)
return Language.Dutch;
return Language.English;
}

Loading…
Cancel
Save