本文整理汇总了C#中MediaBrowser.Controller.Entities.TV.Series.AddPerson方法的典型用法代码示例。如果您正苦于以下问题:C# Series.AddPerson方法的具体用法?C# Series.AddPerson怎么用?C# Series.AddPerson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaBrowser.Controller.Entities.TV.Series
的用法示例。
在下文中一共展示了Series.AddPerson方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchDataFromActorNode
/// <summary>
/// Fetches the data from actor node.
/// </summary>
/// <param name="series">The series.</param>
/// <param name="reader">The reader.</param>
private void FetchDataFromActorNode(Series series, XmlReader reader)
{
reader.MoveToContent();
var personInfo = new PersonInfo();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "Name":
{
personInfo.Name = (reader.ReadElementContentAsString() ?? string.Empty).Trim();
break;
}
case "Role":
{
personInfo.Role = (reader.ReadElementContentAsString() ?? string.Empty).Trim();
break;
}
case "SortOrder":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
int rval;
// int.TryParse is local aware, so it can be probamatic, force us culture
if (int.TryParse(val, NumberStyles.Integer, UsCulture, out rval))
{
personInfo.SortOrder = rval;
}
}
break;
}
default:
reader.Skip();
break;
}
}
}
personInfo.Type = PersonType.Actor;
if (!string.IsNullOrEmpty(personInfo.Name))
{
series.AddPerson(personInfo);
}
}
示例2: FetchActors
/// <summary>
/// Fetches the actors.
/// </summary>
/// <param name="series">The series.</param>
/// <param name="actorsDoc">The actors doc.</param>
/// <param name="seriesDoc">The seriesDoc.</param>
/// <returns>Task.</returns>
private void FetchActors(Series series, XmlDocument actorsDoc, XmlDocument seriesDoc)
{
var xmlNodeList = actorsDoc.SelectNodes("Actors/Actor");
if (xmlNodeList != null)
{
series.People.Clear();
foreach (XmlNode p in xmlNodeList)
{
string actorName = p.SafeGetString("Name");
string actorRole = p.SafeGetString("Role");
if (!string.IsNullOrWhiteSpace(actorName))
{
// Sometimes tvdb actors have leading spaces
series.AddPerson(new PersonInfo { Type = PersonType.Actor, Name = actorName.Trim(), Role = actorRole });
}
}
}
}
示例3: FetchDataFromActorNode
/// <summary>
/// Fetches the data from actor node.
/// </summary>
/// <param name="series">The series.</param>
/// <param name="reader">The reader.</param>
private void FetchDataFromActorNode(Series series, XmlReader reader)
{
reader.MoveToContent();
var personInfo = new PersonInfo();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "Name":
{
personInfo.Name = (reader.ReadElementContentAsString() ?? string.Empty).Trim();
break;
}
case "Role":
{
personInfo.Role = (reader.ReadElementContentAsString() ?? string.Empty).Trim();
break;
}
default:
reader.Skip();
break;
}
}
}
personInfo.Type = PersonType.Actor;
if (!string.IsNullOrEmpty(personInfo.Name))
{
series.AddPerson(personInfo);
}
}
示例4: FetchActors
/// <summary>
/// Fetches the actors.
/// </summary>
/// <param name="series">The series.</param>
/// <param name="actorsDoc">The actors doc.</param>
/// <param name="seriesDoc">The seriesDoc.</param>
/// <returns>Task.</returns>
private void FetchActors(Series series, XmlDocument actorsDoc, XmlDocument seriesDoc)
{
XmlNode actorsNode = null;
if (ConfigurationManager.Configuration.SaveLocalMeta)
{
//add to the main seriesDoc for saving
var seriesNode = seriesDoc.SelectSingleNode("//Series");
if (seriesNode != null)
{
actorsNode = seriesDoc.CreateNode(XmlNodeType.Element, "Persons", null);
seriesNode.AppendChild(actorsNode);
}
}
var xmlNodeList = actorsDoc.SelectNodes("Actors/Actor");
if (xmlNodeList != null)
{
series.People.Clear();
foreach (XmlNode p in xmlNodeList)
{
string actorName = p.SafeGetString("Name");
string actorRole = p.SafeGetString("Role");
if (!string.IsNullOrWhiteSpace(actorName))
{
series.AddPerson(new PersonInfo { Type = PersonType.Actor, Name = actorName, Role = actorRole });
if (ConfigurationManager.Configuration.SaveLocalMeta && actorsNode != null)
{
//create in main seriesDoc
var personNode = seriesDoc.CreateNode(XmlNodeType.Element, "Person", null);
foreach (XmlNode subNode in p.ChildNodes)
personNode.AppendChild(seriesDoc.ImportNode(subNode, true));
//need to add the type
var typeNode = seriesDoc.CreateNode(XmlNodeType.Element, "Type", null);
typeNode.InnerText = PersonType.Actor;
personNode.AppendChild(typeNode);
actorsNode.AppendChild(personNode);
}
}
}
}
}