mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04: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: 91ca81eca7d2c984a096a396cbd83d0111f41c9d Merged-by: Bond-009 <bond.009@outlook.com> Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
parent
69b07c9f31
commit
aabaf1a656
@ -1146,13 +1146,24 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
|
|
||||||
private static void MergePeople(IReadOnlyList<PersonInfo> source, IReadOnlyList<PersonInfo> target)
|
private static void MergePeople(IReadOnlyList<PersonInfo> source, IReadOnlyList<PersonInfo> target)
|
||||||
{
|
{
|
||||||
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);
|
||||||
var normalizedName = person.Name.RemoveDiacritics();
|
|
||||||
var personInSource = source.FirstOrDefault(i => string.Equals(i.Name.RemoveDiacritics(), normalizedName, StringComparison.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)
|
foreach (var providerId in personInSource.ProviderIds)
|
||||||
{
|
{
|
||||||
person.ProviderIds.TryAdd(providerId.Key, providerId.Value);
|
person.ProviderIds.TryAdd(providerId.Key, providerId.Value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user