Apply review suggestions
This commit is contained in:
@@ -1137,6 +1137,8 @@ namespace MediaBrowser.Providers.Manager
|
||||
|
||||
if (!lockedFields.Contains(MetadataField.Cast))
|
||||
{
|
||||
RemoveInvalidProviderIds(sourceResult.People);
|
||||
|
||||
if (replaceData || targetResult.People is null || targetResult.People.Count == 0)
|
||||
{
|
||||
targetResult.People = sourceResult.People;
|
||||
@@ -1291,6 +1293,32 @@ namespace MediaBrowser.Providers.Manager
|
||||
}
|
||||
}
|
||||
|
||||
private static void RemoveInvalidProviderIds(IReadOnlyList<PersonInfo> people)
|
||||
{
|
||||
if (people is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var person in people)
|
||||
{
|
||||
if (person.ProviderIds is null || person.ProviderIds.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var invalidKeys = person.ProviderIds
|
||||
.Where(id => !ProviderIdsExtensions.IsValidProviderId(id.Key, id.Value))
|
||||
.Select(id => id.Key)
|
||||
.ToArray();
|
||||
|
||||
foreach (var key in invalidKeys)
|
||||
{
|
||||
person.ProviderIds.Remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void MergePeople(IReadOnlyList<PersonInfo> source, IReadOnlyList<PersonInfo> target)
|
||||
{
|
||||
var sourceByName = source.ToLookup(p => p.Name.RemoveDiacritics(), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
Reference in New Issue
Block a user