Merge pull request #1704 from nvllsvm/fix_replace_multiple_spaces

Fix replace multiple spaces
This commit is contained in:
Anthony Lavado 2019-09-02 01:33:14 -04:00 committed by GitHub
commit 852e5e29ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Net;
@ -312,14 +313,7 @@ namespace MediaBrowser.Providers.TV.TheTVDB
}
sb.Replace(", the", string.Empty).Replace("the ", " ").Replace(" the ", " ");
int prevLength;
do
{
prevLength = sb.Length;
sb.Replace(" ", " ");
} while (name.Length != prevLength);
return sb.ToString().Trim();
return Regex.Replace(sb.ToString().Trim(), @"\s+", " ");
}
private void MapSeriesToResult(MetadataResult<Series> result, TvDbSharper.Dto.Series tvdbSeries, string metadataLanguage)