mirror of
https://github.com/Sonarr/Sonarr
synced 2026-05-08 21:21:47 +02:00
Cleanup series title normalizer
This commit is contained in:
parent
bf34b43094
commit
4cb25228b6
3 changed files with 8 additions and 11 deletions
|
|
@ -24,6 +24,7 @@ public void should_use_precomputed_title(string title, int tvdbId, string expect
|
|||
[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 @@ public static string NormalizeEpisodeTitle(string title)
|
|||
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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue