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


C# Category.CategoryInformationPage方法代码示例

本文整理汇总了C#中Category.CategoryInformationPage方法的典型用法代码示例。如果您正苦于以下问题:C# Category.CategoryInformationPage方法的具体用法?C# Category.CategoryInformationPage怎么用?C# Category.CategoryInformationPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Category的用法示例。


在下文中一共展示了Category.CategoryInformationPage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadGeneralVideos

        /// <summary>
        /// Load the videos for the selected category - will only handle general category types
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public static List<VideoInfo> LoadGeneralVideos(Category parentCategory)
        {
            var doc = new XmlDocument();
            var result = new List<VideoInfo>();
            var path = "/brandLongFormInfo/allEpisodes/longFormEpisodeInfo"; // default the path for items without series

            doc.Load(parentCategory.CategoryInformationPage());

            if (!string.IsNullOrEmpty(parentCategory.SeriesId()))
            {
                path = "/brandLongFormInfo/allSeries/longFormSeriesInfo[seriesNumber='" + parentCategory.SeriesId() + "'] /episodes/longFormEpisodeInfo";
            }

            foreach (XmlNode node in doc.SelectNodes(path))
            {
                var item = new VideoInfo();
                item.Title = node.SelectSingleNodeText("title1") + (string.IsNullOrEmpty(node.SelectSingleNodeText("title2")) ? string.Empty : " - ") + node.SelectSingleNodeText("title2"); 
                item.Description = node.SelectSingleNodeText("synopsis");
                //item.ImageUrl = Properties.Resources._4OD_RootUrl + node.SelectSingleNodeText("pictureUrl");
                item.Thumb = node.SelectSingleNodeText("pictureUrl");

                DateTime airDate;

                if (DateTime.TryParse(node.SelectSingleNodeText("txTime"), out airDate))
                    item.Airdate = airDate.ToString("dd MMM yyyy");

                item.Other = doc.SelectSingleNodeText("/brandLongFormInfo/brandWst") + "~" + node.SelectSingleNodeText("requestId");
                result.Add(item);
            }

            return result;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:37,代码来源:_4ODVideoParser.cs

示例2: LoadProgrammeInfo

        /// <summary>
        /// Load the information about a program from its xml (basically we will load the series as new categories if there are any)
        /// If there are no series we'll basically just show the parent category again
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public static List<Category> LoadProgrammeInfo(Category parentCategory)
        {
            var doc = new XmlDocument();
            var result = new List<Category>();
            doc.Load(parentCategory.CategoryInformationPage());

            var seriesCount = doc.SelectSingleNode("/brandLongFormInfo/seriesCount");
            if (seriesCount == null) throw new OnlineVideosException("Unable to load 4OD series information from url " + parentCategory.CategoryInformationPage());

            var seriesNodes = doc.SelectNodes("/brandLongFormInfo/allSeries/longFormSeriesInfo/seriesNumber");

            if (seriesNodes == null || seriesNodes.Count == 0)
            {
                var categ = new Category();
                categ.Name = parentCategory.Name;
                categ.Description = parentCategory.Description;
                categ.Thumb = parentCategory.Thumb;
                categ.HasSubCategories = false;
                categ.Other = parentCategory.Other;
                categ.ParentCategory = parentCategory;
                result.Add(categ);
            }
            else
            {
                foreach (XmlNode series in seriesNodes) 
                {
                    var categ = new Category();
                    categ.Name = parentCategory.Name + " Series " + series.InnerText;
                    categ.Description = doc.SelectSingleNodeText("/brandLongFormInfo/synopsis", parentCategory.Description);
                    categ.Thumb = doc.SelectSingleNodeText("/brandLongFormInfo/imagePath", parentCategory.Thumb);//Properties.Resources._4OD_RootUrl + 
                    categ.HasSubCategories = false;
                    categ.Other = parentCategory.Other + "~" + series.InnerText;
                    categ.ParentCategory = parentCategory;
                    result.Add(categ);
                }
            }
            return result;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:44,代码来源:_4ODCategoryParser.cs

示例3: LoadCollectionVideos

        /// <summary>
        /// Load videos for the specified collection
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public static List<VideoInfo> LoadCollectionVideos(Category parentCategory)
        {
            var doc = new XmlDocument();
            var result = new List<VideoInfo>();
            var path = "/collectionInfo/longformEpisodes/simpleAssetInfo"; // default the path for collections

            doc.Load(parentCategory.CategoryInformationPage());

            foreach (XmlNode node in doc.SelectNodes(path))
            {
                var item = new VideoInfo();
                item.Title = node.SelectSingleNodeText("title1") + (string.IsNullOrEmpty(node.SelectSingleNodeText("title2")) ? string.Empty : " - ") + node.SelectSingleNodeText("title2");
                item.Description = node.SelectSingleNodeText("synopsis");
                //item.ImageUrl = Properties.Resources._4OD_RootUrl + node.SelectSingleNodeText("imagePath");
                item.Thumb = node.SelectSingleNodeText("imagePath");

                item.Other = MakeWebSafe(node.SelectSingleNodeText("brandTitle")) + "~" + node.SelectSingleNodeText("assetId");
                result.Add(item);
            }

            return result;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:27,代码来源:_4ODVideoParser.cs

示例4: LoadCatchUpVideos

        /// <summary>
        /// Load videos for the specified catch up category (day/channel)
        /// </summary>
        /// <param name="parentCategory"></param>
        /// <returns></returns>
        public static List<VideoInfo> LoadCatchUpVideos(Category parentCategory)
        {
            var doc = new HtmlDocument();
            var results = new List<VideoInfo>();
            var webRequest = (HttpWebRequest)WebRequest.Create(parentCategory.CategoryInformationPage());
            var webResponse = (HttpWebResponse)webRequest.GetResponse();

            if (webResponse.StatusCode != HttpStatusCode.OK)
                throw new OnlineVideosException("Unable to retrieve response for 4OD Catch Up Video from " + parentCategory.CategoryInformationPage() + ", received " + webResponse.StatusCode.ToString());

            doc.Load(webResponse.GetResponseStream());

            var node = doc.GetElementsByTagName("span").Where(x => x.GetAttribute("class").Contains("tx-" + parentCategory.CategoryId())).FirstOrDefault();

            if (node != null)
            {
                foreach (HtmlNode listItem in node.ParentNode.ParentNode.SelectSingleNode("ul").SelectNodes("li"))
                {
                    var item = new VideoInfo();
                    item.Title = listItem.GetNodeByClass("title").InnerText + (listItem.GetNodeByClass("series-info") == null ? string.Empty : " - " + listItem.GetNodeByClass("series-info").InnerText);
                    item.Description = listItem.GetNodeByClass("synopsis").InnerText;
                    item.Airdate = listItem.GetNodeByClass("txtime").InnerText;
                    //item.ImageUrl = Properties.Resources._4OD_RootUrl + listItem.SelectSingleNode("a/img").GetAttribute("src");
                    item.Thumb = listItem.SelectSingleNode("a/img").GetAttribute("src");
                    item.Other = MakeWebSafe(listItem.GetNodeByClass("title").InnerText) + "~" + listItem.SelectSingleNode("a").GetAttribute("href").Split('#')[1];
                    results.Add(item);
                }
            }

            return results;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:36,代码来源:_4ODVideoParser.cs


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