|
@@ -1151,13 +1151,24 @@ namespace MediaBrowser.Providers.Manager
|
|
|
target = new List<PersonInfo>();
|
|
|
}
|
|
|
|
|
|
- foreach (var person in target)
|
|
|
+ var sourceByName = source.ToLookup(p => p.Name.RemoveDiacritics(), StringComparer.OrdinalIgnoreCase);
|
|
|
+ var targetByName = target.ToLookup(p => p.Name.RemoveDiacritics(), StringComparer.OrdinalIgnoreCase);
|
|
|
+
|
|
|
+ foreach (var name in targetByName.Select(g => g.Key))
|
|
|
{
|
|
|
- var normalizedName = person.Name.RemoveDiacritics();
|
|
|
- var personInSource = source.FirstOrDefault(i => string.Equals(i.Name.RemoveDiacritics(), normalizedName, StringComparison.OrdinalIgnoreCase));
|
|
|
+ var targetPeople = targetByName[name].ToArray();
|
|
|
+ var sourcePeople = sourceByName[name].ToArray();
|
|
|
|
|
|
- if (personInSource is not null)
|
|
|
+ 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);
|