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