2020-08-22 21:56:24 +02:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-13 21:01:16 +01:00
|
|
|
using System;
|
2018-12-28 00:27:57 +01:00
|
|
|
using System.Collections.Generic;
|
2020-03-24 16:12:06 +01:00
|
|
|
using System.Linq;
|
2018-12-28 00:27:57 +01:00
|
|
|
using MediaBrowser.Controller.Extensions;
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Library
|
|
|
|
{
|
|
|
|
public static class NameExtensions
|
|
|
|
{
|
2021-03-10 08:20:02 +01:00
|
|
|
public static IEnumerable<string> DistinctNames(this IEnumerable<string> names)
|
|
|
|
=> names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase)
|
|
|
|
.Select(x => x.First());
|
|
|
|
|
2020-09-20 14:02:41 +02:00
|
|
|
private static string RemoveDiacritics(string? name)
|
2018-12-28 00:27:57 +01:00
|
|
|
{
|
|
|
|
if (name == null)
|
|
|
|
{
|
|
|
|
return string.Empty;
|
|
|
|
}
|
|
|
|
|
|
|
|
return name.RemoveDiacritics();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|