store person sort order in xml

This commit is contained in:
Luke Pulverenti
2013-11-19 22:47:29 -05:00
parent bce86c5022
commit 6ee94ee1a2
3 changed files with 38 additions and 3 deletions

View File

@@ -1198,6 +1198,7 @@ namespace MediaBrowser.Controller.Entities
if (existing != null)
{
existing.Type = PersonType.GuestStar;
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
return;
}
}
@@ -1214,16 +1215,29 @@ namespace MediaBrowser.Controller.Entities
else
{
// Was there, if no role and we have one - fill it in
if (string.IsNullOrWhiteSpace(existing.Role) && !string.IsNullOrWhiteSpace(person.Role)) existing.Role = person.Role;
if (string.IsNullOrWhiteSpace(existing.Role) && !string.IsNullOrWhiteSpace(person.Role))
{
existing.Role = person.Role;
}
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
}
}
else
{
var existing = People.FirstOrDefault(p =>
string.Equals(p.Name, person.Name, StringComparison.OrdinalIgnoreCase) &&
string.Equals(p.Type, person.Type, StringComparison.OrdinalIgnoreCase));
// Check for dupes based on the combination of Name and Type
if (!People.Any(p => string.Equals(p.Name, person.Name, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Type, person.Type, StringComparison.OrdinalIgnoreCase)))
if (existing == null)
{
People.Add(person);
}
else
{
existing.SortOrder = person.SortOrder ?? existing.SortOrder;
}
}
}