mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 06:17:14 -04:00
update people handling during metadata refresh
This commit is contained in:
parent
9212ffb528
commit
84f76ba3de
@ -4,6 +4,8 @@ using MediaBrowser.Controller.Providers;
|
|||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using MediaBrowser.Controller.Extensions;
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.Manager
|
namespace MediaBrowser.Providers.Manager
|
||||||
{
|
{
|
||||||
@ -122,6 +124,11 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
if (replaceData || targetResult.People == null || targetResult.People.Count == 0)
|
if (replaceData || targetResult.People == null || targetResult.People.Count == 0)
|
||||||
{
|
{
|
||||||
targetResult.People = sourceResult.People;
|
targetResult.People = sourceResult.People;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (targetResult.People != null && sourceResult.People != null)
|
||||||
|
{
|
||||||
|
MergePeople(sourceResult.People, targetResult.People);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,6 +212,31 @@ namespace MediaBrowser.Providers.Manager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void MergePeople(List<PersonInfo> source, List<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));
|
||||||
|
|
||||||
|
if (personInSource != null)
|
||||||
|
{
|
||||||
|
foreach (var providerId in personInSource.ProviderIds)
|
||||||
|
{
|
||||||
|
if (!person.ProviderIds.ContainsKey(providerId.Key))
|
||||||
|
{
|
||||||
|
person.ProviderIds[providerId.Key] = providerId.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(person.ImageUrl))
|
||||||
|
{
|
||||||
|
person.ImageUrl = personInSource.ImageUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void MergeMetadataSettings(BaseItem source,
|
public static void MergeMetadataSettings(BaseItem source,
|
||||||
BaseItem target)
|
BaseItem target)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user