mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
store person sort order in xml
This commit is contained in:
parent
bce86c5022
commit
6ee94ee1a2
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1075,6 +1075,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
var names = new List<string>();
|
||||
var type = "Actor"; // If type is not specified assume actor
|
||||
var role = string.Empty;
|
||||
int? sortOrder = null;
|
||||
|
||||
reader.MoveToContent();
|
||||
|
||||
@ -1109,6 +1110,20 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "SortOrder":
|
||||
{
|
||||
var val = reader.ReadElementContentAsString();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(val))
|
||||
{
|
||||
int intVal;
|
||||
if (int.TryParse(val, NumberStyles.Integer, _usCulture, out intVal))
|
||||
{
|
||||
sortOrder = intVal;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
reader.Skip();
|
||||
@ -1117,7 +1132,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
}
|
||||
}
|
||||
|
||||
return names.Select(n => new PersonInfo { Name = n.Trim(), Role = role, Type = type });
|
||||
return names.Select(n => new PersonInfo { Name = n.Trim(), Role = role, Type = type, SortOrder = sortOrder });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -463,6 +463,12 @@ namespace MediaBrowser.Providers.Savers
|
||||
builder.Append("<Name>" + SecurityElement.Escape(person.Name) + "</Name>");
|
||||
builder.Append("<Type>" + SecurityElement.Escape(person.Type) + "</Type>");
|
||||
builder.Append("<Role>" + SecurityElement.Escape(person.Role) + "</Role>");
|
||||
|
||||
if (person.SortOrder.HasValue)
|
||||
{
|
||||
builder.Append("<SortOrder>" + SecurityElement.Escape(person.SortOrder.Value.ToString(UsCulture)) + "</SortOrder>");
|
||||
}
|
||||
|
||||
builder.Append("</Person>");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user