2b1a915ead
Co-authored-by: Cody Robibero <cody@robibe.ro> (cherry picked from commit 8d1d9734381472b301deb0118bbb8da2a769a65e) Signed-off-by: crobibero <cody@robibe.ro>
27 lines
656 B
C#
27 lines
656 B
C#
#pragma warning disable CS1591
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Jellyfin.Extensions;
|
|
|
|
namespace MediaBrowser.Controller.Library
|
|
{
|
|
public static class NameExtensions
|
|
{
|
|
public static IEnumerable<string> DistinctNames(this IEnumerable<string> names)
|
|
=> names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase)
|
|
.Select(x => x.First());
|
|
|
|
private static string RemoveDiacritics(string? name)
|
|
{
|
|
if (name == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
return name.RemoveDiacritics();
|
|
}
|
|
}
|
|
}
|