diff options
| author | Cody Robibero <cody@robibe.ro> | 2026-08-13 16:26:48 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-13 16:26:48 -0400 |
| commit | 12226d2212643eb0b4c71e3bca8aa148c34bb42a (patch) | |
| tree | 290c1b6f5522916ab1388ac77996d87c71ae35b7 | |
| parent | ae8723026d97b6d0f926638803edef338919b794 (diff) | |
| parent | 9220c2bd635e2fad7757f855abc3114d8e69d3ef (diff) | |
Merge pull request #17604 from theguymadmax/fix-FindArtists
Fix FindArtists
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs b/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs index 40300b7fa2..de112d7aa4 100644 --- a/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs +++ b/Jellyfin.Server.Implementations/Item/LinkedChildrenService.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Linq; using Jellyfin.Data.Enums; using Jellyfin.Database.Implementations; +using Jellyfin.Extensions; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Persistence; using Microsoft.EntityFrameworkCore; @@ -83,26 +84,27 @@ public class LinkedChildrenService : ILinkedChildrenService { using var dbContext = _dbProvider.CreateDbContext(); - var lowerNames = artistNames.Select(n => n.ToLowerInvariant()).ToArray(); + var cleanNames = artistNames.Select(n => (Original: n, Clean: n.GetCleanValue())).ToArray(); + var cleanValues = cleanNames.Select(x => x.Clean).ToArray(); + var artists = dbContext.BaseItems .AsNoTracking() .Where(e => e.Type == _itemTypeLookup.BaseItemKindNames[BaseItemKind.MusicArtist]!) - .Where(e => lowerNames.Contains(e.Name!.ToLower())) + .Where(e => cleanValues.Contains(e.CleanName)) .ToArray(); var lookup = artists - .GroupBy(e => e.Name!, StringComparer.OrdinalIgnoreCase) + .GroupBy(e => e.CleanName!) .ToDictionary( g => g.Key, - g => g.Select(f => _queryHelpers.DeserializeBaseItem(f)).Where(dto => dto is not null).Cast<MusicArtist>().ToArray(), - StringComparer.OrdinalIgnoreCase); + g => g.Select(f => _queryHelpers.DeserializeBaseItem(f)).Where(dto => dto is not null).Cast<MusicArtist>().ToArray()); - var result = new Dictionary<string, MusicArtist[]>(artistNames.Count); - foreach (var name in artistNames) + var result = new Dictionary<string, MusicArtist[]>(cleanNames.Length); + foreach (var (original, clean) in cleanNames) { - if (lookup.TryGetValue(name, out var artistArray)) + if (lookup.TryGetValue(clean, out var artistArray)) { - result[name] = artistArray; + result[original] = artistArray; } } |
