Sorting for another show that starts with A

pull/4/head
Mark McDowall 10 years ago
parent cf0863a89d
commit a9171d44d9

@ -8,10 +8,11 @@ namespace NzbDrone.Core.Test.TvTests
[TestFixture]
public class SeriesTitleNormalizerFixture
{
[Test]
public void should_use_precomputed_title_for_a_to_z()
[TestCase("A to Z", 281588, "a to z")]
[TestCase("A. D. - The Trials & Triumph of the Early Church", 266757, "ad trials triumph early church")]
public void should_use_precomputed_title(string title, int tvdbId, string expected)
{
SeriesTitleNormalizer.Normalize("A to Z", 281588).Should().Be("a to z");
SeriesTitleNormalizer.Normalize(title, tvdbId).Should().Be(expected);
}
[TestCase("2 Broke Girls", "2 broke girls")]

@ -169,10 +169,9 @@ namespace NzbDrone.Core.Parser
private static readonly Regex WordDelimiterRegex = new Regex(@"(\s|\.|,|_|-|=|\|)+", RegexOptions.Compiled);
private static readonly Regex PunctuationRegex = new Regex(@"[^\w\s]", RegexOptions.Compiled);
private static readonly Regex CommonWordRegex = new Regex(@"\b(a|an|the|and|or|of)\b\s?",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SpecialEpisodeWordRegex = new Regex(@"\b(part|special|edition)\b\s?",
RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex CommonWordRegex = new Regex(@"\b(a|an|the|and|or|of)\b\s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex SpecialEpisodeWordRegex = new Regex(@"\b(part|special|edition)\b\s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex DuplicateSpacesRegex = new Regex(@"\s{2,}", RegexOptions.Compiled);
private static readonly Regex RequestInfoRegex = new Regex(@"\[.+?\]", RegexOptions.Compiled);
@ -347,6 +346,7 @@ namespace NzbDrone.Core.Parser
title = WordDelimiterRegex.Replace(title, " ");
title = PunctuationRegex.Replace(title, String.Empty);
title = CommonWordRegex.Replace(title, String.Empty);
title = DuplicateSpacesRegex.Replace(title, " ");
return title.Trim().ToLower();
}

@ -7,7 +7,8 @@ namespace NzbDrone.Core.Tv
{
private readonly static Dictionary<Int32, String> PreComputedTitles = new Dictionary<Int32, String>
{
{ 281588, "a to z" }
{ 281588, "a to z" },
{ 266757, "ad trials triumph early church" }
};
public static String Normalize(String title, Int32 tvdbId)

Loading…
Cancel
Save