jellyfin/MediaBrowser.Controller/Library/NameExtensions.cs

25 lines
642 B
C#
Raw Normal View History

using System;
2018-12-27 16:27:57 -07:00
using System.Collections.Generic;
2020-03-24 08:12:06 -07:00
using System.Linq;
2018-12-27 16:27:57 -07:00
using MediaBrowser.Controller.Extensions;
namespace MediaBrowser.Controller.Library
{
public static class NameExtensions
{
private static string RemoveDiacritics(string name)
{
if (name == null)
{
return string.Empty;
}
return name.RemoveDiacritics();
}
public static IEnumerable<string> DistinctNames(this IEnumerable<string> names)
2019-02-02 04:27:06 -07:00
=> names.GroupBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase)
.Select(x => x.First());
2018-12-27 16:27:57 -07:00
}
}