1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-30 19:56:54 +00:00

Sorting for another show that starts with A

This commit is contained in:
Mark McDowall 2014-12-12 15:49:32 -08:00
parent cf0863a89d
commit a9171d44d9
3 changed files with 10 additions and 8 deletions

View file

@ -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")]

View file

@ -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();
}

View file

@ -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)