aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-11-19 22:47:29 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-11-19 22:47:29 -0500
commit6ee94ee1a245ef4809620c3f0c8d1d787c932581 (patch)
treeab4abd50f6d4e96ac38ffbac92a96fac723a31e1 /MediaBrowser.Controller/Entities
parentbce86c502206b016cc448afc1934101b852a1994 (diff)
store person sort order in xml
Diffstat (limited to 'MediaBrowser.Controller/Entities')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs18
1 files changed, 16 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 6b6719f013..b139cba9a3 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -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;
+ }
}
}