1
0
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:
Bogdan
2025-05-27 17:55:51 +03:00
committed by Mark McDowall
parent bf34b43094
commit 4cb25228b6
3 changed files with 8 additions and 11 deletions

View File

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

View File

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

View File

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