Fixed: Ignore language in split episode title

pull/6556/head v4.0.2.1192
Mark McDowall 3 months ago committed by GitHub
parent 4c170d0452
commit b34e0f8259
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,23 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ParserTests
{
[TestFixture]
public class NormalizeEpisodeTitleFixture : CoreTest
{
[TestCase("Episode Title", "episode title")]
[TestCase("A.B,C;", "a b c")]
[TestCase("Episode Title", "episode title")]
[TestCase("French Title (1)", "french title")]
[TestCase("Series.Title.S01.Special.Episode.Title.720p.HDTV.x264-Sonarr", "episode title")]
[TestCase("Series.Title.S01E00.Episode.Title.720p.HDTV.x264-Sonarr", "episode title")]
public void should_normalize_episode_title(string input, string expected)
{
var result = Parser.Parser.NormalizeEpisodeTitle(input);
result.Should().Be(expected);
}
}
}

@ -6,7 +6,7 @@ using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.ParserTests
{
[TestFixture]
public class NormalizeTitleFixture : CoreTest
public class NormalizeSeriesTitleFixture : CoreTest
{
[TestCase("Series", "series")]
[TestCase("Series (2009)", "series2009")]

@ -541,6 +541,7 @@ namespace NzbDrone.Core.Parser
private static readonly Regex TitleComponentsRegex = new Regex(@"^(?:(?<title>.+?) \((?<title>.+?)\)|(?<title>.+?) \| (?<title>.+?))$",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex PartRegex = new Regex(@"\(\d+\)$", RegexOptions.Compiled);
private static readonly Regex PunctuationRegex = new Regex(@"[^\w\s]", RegexOptions.Compiled);
private static readonly Regex ArticleWordRegex = new Regex(@"^(a|an|the)\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SpecialEpisodeWordRegex = new Regex(@"\b(part|special|edition|christmas)\b\s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
@ -792,6 +793,7 @@ namespace NzbDrone.Core.Parser
// Disabled, Until we run into specific testcases for the removal of these words.
// title = SpecialEpisodeWordRegex.Replace(title, string.Empty);
title = PartRegex.Replace(title, "");
title = PunctuationRegex.Replace(title, " ");
title = DuplicateSpacesRegex.Replace(title, " ");

Loading…
Cancel
Save