当前位置: 首页>>代码示例>>C#>>正文


C# Series.AddPerson方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:jscorrea,项目名称:MediaBrowser,代码行数:60,代码来源:TvdbSeriesProvider.cs

示例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 });
                    }
                }
            }
        }
开发者ID:squibber46,项目名称:MediaBrowser,代码行数:27,代码来源:RemoteSeriesProvider.cs

示例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);
            }
        }
开发者ID:Kampari,项目名称:MediaBrowser,代码行数:43,代码来源:RemoteSeriesProvider.cs

示例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);
                        }

                    }
                }
            }
        }
开发者ID:snap608,项目名称:MediaBrowser,代码行数:52,代码来源:RemoteSeriesProvider.cs


注:本文中的MediaBrowser.Controller.Entities.TV.Series.AddPerson方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。