get people info during media refresh

This commit is contained in:
Luke Pulverenti
2016-01-21 13:50:43 -05:00
parent 410f1333e4
commit 5cd032d86b
5 changed files with 126 additions and 8 deletions

View File

@@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Entities
if (existing != null)
{
existing.Type = PersonType.GuestStar;
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
MergeExisting(existing, person);
return;
}
}
@@ -67,7 +67,7 @@ namespace MediaBrowser.Controller.Entities
existing.Role = person.Role;
}
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
MergeExisting(existing, person);
}
}
else
@@ -83,11 +83,22 @@ namespace MediaBrowser.Controller.Entities
}
else
{
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
MergeExisting(existing, person);
}
}
}
private static void MergeExisting(PersonInfo existing, PersonInfo person)
{
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
existing.ImageUrl = person.ImageUrl ?? existing.ImageUrl;
foreach (var id in person.ProviderIds)
{
existing.SetProviderId(id.Key, id.Value);
}
}
public static bool ContainsPerson(List<PersonInfo> people, string name)
{
if (string.IsNullOrWhiteSpace(name))

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities
{
@@ -106,8 +107,13 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// This is the small Person stub that is attached to BaseItems
/// </summary>
public class PersonInfo
public class PersonInfo : IHasProviderIds
{
public PersonInfo()
{
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
public Guid ItemId { get; set; }
/// <summary>
@@ -132,6 +138,10 @@ namespace MediaBrowser.Controller.Entities
/// <value>The sort order.</value>
public int? SortOrder { get; set; }
public string ImageUrl { get; set; }
public Dictionary<string, string> ProviderIds { get; set; }
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
/// </summary>