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


C# Category.RememberDiscoveredItems方法代码示例

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


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

示例1: DiscoverSubCategories


//.........这里部分代码省略.........
                                HtmlNode pDesc = enableDesc ? episode.SelectSingleNode(".//p[@class = 'synopsis']") : null;
                                parentCategory.SubCategories.Add(new RssLink()
                                {
                                    Name = season + (seqNum.Count() < 2 ? ("0" + seqNum) : seqNum) + " " + episode.SelectSingleNode("span[@class = 'episodeTitle']").InnerText,
                                    Url = episode.GetAttributeValue("data-episodeid", ""),
                                    ParentCategory = parentCategory,
                                    Thumb = parentCategory.Thumb,
                                    Description = pDesc != null ? pDesc.InnerText : "",
                                    HasSubCategories = false
                                });
                            }
                        }
                        #endregion

                        #region Netflix title
                        else
                        {
                            data = MyGetWebData(string.Format(netflixOrgEpisodes, apiRoot, (parentCategory as RssLink).Url, latestAuthUrl));
                            rgx = new Regex(@"({""title"":[^$]*)");
                            m = rgx.Match(data);
                            if (m.Success)
                            {
                                data = m.Groups[1].Value;

                                json = (JObject)JsonConvert.DeserializeObject(data);
                                foreach (JArray seasonArray in json["episodes"])
                                {
                                    foreach (JToken episode in seasonArray.Where(e => e["availableForED"] == null || e["availableForED"].Value<bool>()))
                                    {
                                        int e = (int)episode["episode"];
                                        int s = (int)episode["season"];
                                        RssLink cat = new RssLink()
                                        {
                                            Name = s + "x" + (e < 10 ? ("0" + e) : e.ToString()) + " " + (string)episode["title"],
                                            ParentCategory = parentCategory,
                                            Thumb = parentCategory.Thumb,
                                            HasSubCategories = false,
                                            Url = episode["episodeId"].ToString()
                                        };
                                        JToken stills = episode["stills"];
                                        if (stills != null && stills.Count() > 0)
                                        {
                                            cat.Thumb = stills.Last()["url"].Value<string>();
                                        }
                                        if (enableDesc)
                                        {
                                            cat.Description = episode["synopsis"].Value<string>();
                                        }
                                        parentCategory.SubCategories.Add(cat);
                                    }
                                }
                                parentCategory.SubCategories.Sort((c1, c2) => c1.Name.CompareTo(c2.Name));
                            }
                        #endregion
                        }
                    }
                    #endregion

                    #region Movies
                    else
                    {
                        parentCategory.SubCategories.Add(new RssLink() { Description = GetTitleDescription((parentCategory as RssLink).Url, parentCategory.GetTrackId()), Name = parentCategory.Name, Url = (parentCategory as RssLink).Url, Thumb = parentCategory.Thumb, ParentCategory = parentCategory, HasSubCategories = false });
                    }
                    #endregion
                }
            }


            #endregion

            #region Episodes
            else
            {
                string jsonData = MyGetWebData((parentCategory as RssLink).Url);
                JObject json = (JObject)JsonConvert.DeserializeObject(jsonData);
                string data = (string)json["html"];
                HtmlDocument doc = new HtmlDocument();
                doc.LoadHtml(data);
                HtmlNode docNode = doc.DocumentNode;
                HtmlNode episodes = docNode.SelectSingleNode("//ul[@class = 'episodeList']");
                foreach (HtmlNode episode in episodes.SelectNodes("li"))
                {
                    string seqNum = episode.SelectSingleNode("span[@class = 'seqNum']").InnerText;
                    HtmlNode pDesc = enableDesc ? episode.SelectSingleNode(".//p[@class = 'synopsis']") : null;
                    parentCategory.SubCategories.Add(new RssLink()
                    {
                        Name = parentCategory.Name.Replace("Season", "") + "x" + (seqNum.Count() < 2 ? ("0" + seqNum) : seqNum) + " " + episode.SelectSingleNode("span[@class = 'episodeTitle']").InnerText,
                        Url = episode.GetAttributeValue("data-episodeid", ""),
                        ParentCategory = parentCategory,
                        Thumb = parentCategory.Thumb,
                        Description = pDesc != null ? pDesc.InnerText : "",
                        HasSubCategories = false
                    });
                }
            }
            #endregion

            parentCategory.SubCategoriesDiscovered = parentCategory.RememberDiscoveredItems() && parentCategory.SubCategories.Count > 0;
            return parentCategory.SubCategories.Count;
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:101,代码来源:NetfilxWebUtil.cs


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