aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2022-12-19 20:13:48 +0100
committerGitHub <noreply@github.com>2022-12-19 20:13:48 +0100
commit760b7f8fca95b580ba3c9b77493c22b84e871eca (patch)
tree73bb3f1ef72d8dd837cbe1d131fa2c2a99287836 /Jellyfin.Api/Controllers
parentf20dee8e0d1160ff9e3fac127ebba66e6ecac5da (diff)
parent6481376b81c52af0b29eea997ce44de0de862ac8 (diff)
Merge pull request #8922 from Bond-009/distinctby
Use DistinctBy introduced in .NET 6
Diffstat (limited to 'Jellyfin.Api/Controllers')
-rw-r--r--Jellyfin.Api/Controllers/LibraryController.cs15
-rw-r--r--Jellyfin.Api/Controllers/MoviesController.cs6
2 files changed, 7 insertions, 14 deletions
diff --git a/Jellyfin.Api/Controllers/LibraryController.cs b/Jellyfin.Api/Controllers/LibraryController.cs
index ab20208302..196d509fbc 100644
--- a/Jellyfin.Api/Controllers/LibraryController.cs
+++ b/Jellyfin.Api/Controllers/LibraryController.cs
@@ -770,8 +770,7 @@ namespace Jellyfin.Api.Controllers
Name = i.Name,
DefaultEnabled = IsSaverEnabledByDefault(i.Name, types, isNewLibrary)
})
- .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
- .Select(x => x.First())
+ .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToArray();
result.MetadataReaders = plugins
@@ -781,8 +780,7 @@ namespace Jellyfin.Api.Controllers
Name = i.Name,
DefaultEnabled = true
})
- .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
- .Select(x => x.First())
+ .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToArray();
result.SubtitleFetchers = plugins
@@ -792,8 +790,7 @@ namespace Jellyfin.Api.Controllers
Name = i.Name,
DefaultEnabled = true
})
- .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
- .Select(x => x.First())
+ .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToArray();
var typeOptions = new List<LibraryTypeOptionsDto>();
@@ -814,8 +811,7 @@ namespace Jellyfin.Api.Controllers
Name = i.Name,
DefaultEnabled = IsMetadataFetcherEnabledByDefault(i.Name, type, isNewLibrary)
})
- .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
- .Select(x => x.First())
+ .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToArray(),
ImageFetchers = plugins
@@ -826,8 +822,7 @@ namespace Jellyfin.Api.Controllers
Name = i.Name,
DefaultEnabled = IsImageFetcherEnabledByDefault(i.Name, type, isNewLibrary)
})
- .GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
- .Select(x => x.First())
+ .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.ToArray(),
SupportedImageTypes = plugins
diff --git a/Jellyfin.Api/Controllers/MoviesController.cs b/Jellyfin.Api/Controllers/MoviesController.cs
index 03f864b4a7..3cf079362b 100644
--- a/Jellyfin.Api/Controllers/MoviesController.cs
+++ b/Jellyfin.Api/Controllers/MoviesController.cs
@@ -200,8 +200,7 @@ namespace Jellyfin.Api.Controllers
IsMovie = true,
EnableGroupByMetadataKey = true,
DtoOptions = dtoOptions
- }).GroupBy(i => i.GetProviderId(MediaBrowser.Model.Entities.MetadataProvider.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
- .Select(x => x.First())
+ }).DistinctBy(i => i.GetProviderId(MediaBrowser.Model.Entities.MetadataProvider.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
.Take(itemLimit)
.ToList();
@@ -240,8 +239,7 @@ namespace Jellyfin.Api.Controllers
IsMovie = true,
EnableGroupByMetadataKey = true,
DtoOptions = dtoOptions
- }).GroupBy(i => i.GetProviderId(MediaBrowser.Model.Entities.MetadataProvider.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
- .Select(x => x.First())
+ }).DistinctBy(i => i.GetProviderId(MediaBrowser.Model.Entities.MetadataProvider.Imdb) ?? Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture))
.Take(itemLimit)
.ToList();