The Free Software Media System - Server Backend & API
Make tvdb name normalizer unicode aware
Erik Rigtorp82e886514784
diff --git a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.csindex 5414715616..066d13eec6 100644--- a/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs+++ b/MediaBrowser.Providers/Plugins/TheTvdb/TvdbSeriesProvider.cs@@ -274,16 +274,6 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb.ToList();}- /// <summary>- /// The remove.- /// </summary>- const string remove = "\"'!`?";-- /// <summary>- /// The spacers.- /// </summary>- const string spacers = "/,.:;\\(){}[]+-_=–*"; // (there are two types of dashes, short and long)-/// <summary>/// Gets the name of the comparable./// </summary>@@ -293,33 +283,11 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb{name = name.ToLowerInvariant();name = name.Normalize(NormalizationForm.FormKD);- var sb = new StringBuilder();- foreach (var c in name)- {- if (c >= 0x2B0 && c <= 0x0333)- {- // skip char modifier and diacritics- }- else if (remove.IndexOf(c) > -1)- {- // skip chars we are removing- }- else if (spacers.IndexOf(c) > -1)- {- sb.Append(" ");- }- else if (c == '&')- {- sb.Append(" and ");- }- else- {- sb.Append(c);- }- }-- sb.Replace(", the", string.Empty).Replace("the ", " ").Replace(" the ", " ");- return Regex.Replace(sb.ToString().Trim(), @"\s+", " ");+ name = name.Replace(", the", string.Empty).Replace("the ", " ").Replace(" the ", " ");+ name = name.Replace("&", " and " );+ name = Regex.Replace(name, @"[\p{Lm}\p{Mn}]", string.Empty); // Remove diacritics, etc+ name = Regex.Replace(name, @"[\W\p{Pc}]+", " "); // Replace sequences of non-word characters and _ with " "+ return name.Trim();}private void MapSeriesToResult(MetadataResult<Series> result, TvDbSharper.Dto.Series tvdbSeries, string metadataLanguage)