mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-03-05 13:20:20 -05:00
Cleanup series title normalizer
This commit is contained in:
@@ -24,6 +24,7 @@ namespace NzbDrone.Core.Test.TvTests
|
||||
[TestCase("A.I.C.O. -Incarnation-", "aico incarnation")]
|
||||
[TestCase("A.D. The Bible Continues", "ad the bible continues")]
|
||||
[TestCase("A.P. Bio", "ap bio")]
|
||||
[TestCase("A-Team", "ateam")]
|
||||
[TestCase("The A-Team", "ateam")]
|
||||
[TestCase("And Just Like That", "and just like that")]
|
||||
public void should_normalize_title(string title, string expected)
|
||||
|
||||
@@ -900,8 +900,7 @@ namespace NzbDrone.Core.Parser
|
||||
title = PunctuationRegex.Replace(title, " ");
|
||||
title = DuplicateSpacesRegex.Replace(title, " ");
|
||||
|
||||
return title.Trim()
|
||||
.ToLower();
|
||||
return title.Trim().ToLower();
|
||||
}
|
||||
|
||||
public static string NormalizeTitle(string title)
|
||||
|
||||
@@ -4,19 +4,16 @@ namespace NzbDrone.Core.Tv
|
||||
{
|
||||
public static class SeriesTitleNormalizer
|
||||
{
|
||||
private static readonly Dictionary<int, string> PreComputedTitles = new Dictionary<int, string>
|
||||
{
|
||||
{ 281588, "a to z" },
|
||||
{ 289260, "ad bible continues" },
|
||||
{ 328534, "ap bio" },
|
||||
{ 77904, "ateam" }
|
||||
};
|
||||
private static readonly Dictionary<int, string> PreComputedTitles = new()
|
||||
{
|
||||
{ 281588, "a to z" },
|
||||
};
|
||||
|
||||
public static string Normalize(string title, int tvdbId)
|
||||
{
|
||||
if (PreComputedTitles.ContainsKey(tvdbId))
|
||||
if (PreComputedTitles.TryGetValue(tvdbId, out var value))
|
||||
{
|
||||
return PreComputedTitles[tvdbId];
|
||||
return value;
|
||||
}
|
||||
|
||||
return Parser.Parser.NormalizeTitle(title).ToLower();
|
||||
|
||||
Reference in New Issue
Block a user