mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 15:48:03 +00:00
Backport pull request #13720 from jellyfin/release-10.10.z
Fix regression where "Search for missing metadata" not handling cast having multiple roles
Original-merge: 91ca81eca7
Merged-by: Bond-009 <bond.009@outlook.com>
Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
@@ -1146,13 +1146,24 @@ namespace MediaBrowser.Providers.Manager
|
||||
|
||||
private static void MergePeople(IReadOnlyList<PersonInfo> source, IReadOnlyList<PersonInfo> target)
|
||||
{
|
||||
foreach (var person in target)
|
||||
{
|
||||
var normalizedName = person.Name.RemoveDiacritics();
|
||||
var personInSource = source.FirstOrDefault(i => string.Equals(i.Name.RemoveDiacritics(), normalizedName, StringComparison.OrdinalIgnoreCase));
|
||||
var sourceByName = source.ToLookup(p => p.Name.RemoveDiacritics(), StringComparer.OrdinalIgnoreCase);
|
||||
var targetByName = target.ToLookup(p => p.Name.RemoveDiacritics(), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
if (personInSource is not null)
|
||||
foreach (var name in targetByName.Select(g => g.Key))
|
||||
{
|
||||
var targetPeople = targetByName[name].ToArray();
|
||||
var sourcePeople = sourceByName[name].ToArray();
|
||||
|
||||
if (sourcePeople.Length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < targetPeople.Length; i++)
|
||||
{
|
||||
var person = targetPeople[i];
|
||||
var personInSource = i < sourcePeople.Length ? sourcePeople[i] : sourcePeople[0];
|
||||
|
||||
foreach (var providerId in personInSource.ProviderIds)
|
||||
{
|
||||
person.ProviderIds.TryAdd(providerId.Key, providerId.Value);
|
||||
|
||||
Reference in New Issue
Block a user