mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 13:28:27 +01:00
Use DistinctBy introduced in .NET 6
This commit is contained in:
@@ -355,8 +355,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return PhysicalLocations
|
||||
.Where(i => !FileSystem.AreEqual(i, Path))
|
||||
.SelectMany(i => GetPhysicalParents(i, rootChildren))
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First());
|
||||
.DistinctBy(x => x.Id);
|
||||
}
|
||||
|
||||
private IEnumerable<Folder> GetPhysicalParents(string path, List<Folder> rootChildren)
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
// This depends on settings for that series
|
||||
// When this happens, remove the duplicate from season 0
|
||||
|
||||
return allEpisodes.GroupBy(i => i.Id).Select(x => x.First()).Reverse();
|
||||
return allEpisodes.DistinctBy(i => i.Id).Reverse();
|
||||
}
|
||||
|
||||
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
|
||||
|
||||
@@ -10,8 +10,7 @@ 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());
|
||||
=> names.DistinctBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
private static string RemoveDiacritics(string? name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user