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


C# Category.GetTrackId方法代码示例

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


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

示例2: GetContextMenuEntries

 public override List<ContextMenuEntry> GetContextMenuEntries(Category selectedCategory, VideoInfo selectedItem)
 {
     List<ContextMenuEntry> result = new List<ContextMenuEntry>();
     if (enableAddRemoveMylist && selectedItem == null && selectedCategory.IsTitleState())
     {
         try
         {
             if (!string.IsNullOrEmpty(selectedCategory.GetTrackId()))
             {
                 string data = MyGetWebData(string.Format(bobUrl, ShaktiApi, BuildId, (selectedCategory as RssLink).Url, selectedCategory.GetTrackId(), latestAuthUrl));
                 JObject json = (JObject)JsonConvert.DeserializeObject(data);
                 if (json["isMovie"].Value<bool>() || json["isShow"].Value<bool>())
                 {
                     bool inPlayList = json["inPlayList"].Value<bool>();
                     ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (inPlayList ? "Remove from " : "Add to ") + "My List" };
                     result.Add(entry);
                 }
             }
         }
         catch { }
     }
     if (enableAddRemoveMylist && selectedItem != null && selectedItem.Other is SerializableDictionary<string,string>)
     {
         try
         {
             SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>;
             if (other.ContainsKey("TrackId") && other.ContainsKey("VideoId"))
             {
                 string data = MyGetWebData(string.Format(bobUrl, ShaktiApi, BuildId, other["VideoId"], other["TrackId"], latestAuthUrl));
                 JObject json = (JObject)JsonConvert.DeserializeObject(data);
                 if (json["isMovie"].Value<bool>() || json["isShow"].Value<bool>())
                 {
                     bool inPlayList = json["inPlayList"].Value<bool>();
                     ContextMenuEntry entry = new ContextMenuEntry() { DisplayText = (inPlayList ? "Remove from " : "Add to ") + "My List" };
                     result.Add(entry);
                 }
             }
         }
         catch { }
     }
     return result;
 }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:42,代码来源:NetfilxWebUtil.cs

示例3: ExecuteContextMenuEntry

        public override ContextMenuExecutionResult ExecuteContextMenuEntry(Category selectedCategory, VideoInfo selectedItem, ContextMenuEntry choice)
        {
            if (choice.DisplayText == "Add to My List")
            {
                ContextMenuExecutionResult result = new ContextMenuExecutionResult();
                //private string addRemoveMyListUrl = @"{0}/{1}/playlistop";
                //private string addRemoveMyListPostData = @"{""operation"":""{0}"",""videoId"":{1},""trackId"":{2},""authURL"":""{3}""}";

                string videoId;
                string trackId;
                string title;
                if (selectedItem == null)
                {
                    videoId = (selectedCategory as RssLink).Url;
                    trackId = selectedCategory.GetTrackId();
                    title = selectedCategory.Name;
                }
                else
                {
                    SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>;
                    videoId = other["VideoId"];
                    trackId = other["TrackId"];
                    title = selectedItem.Title;
                }
                GetWebData(string.Format(addRemoveMyListUrl, ShaktiApi, BuildId),
                    string.Format(addRemoveMyListPostData, addMyListOperation, videoId, trackId, latestAuthUrl),
                    cc, userAgent: UserAgent);
                result.RefreshCurrentItems = true;
                result.ExecutionResultMessage = title + " added to My List";
                return result;
            }
            if (choice.DisplayText == "Remove from My List")
            {
                string videoId;
                string trackId;
                string title;
                if (selectedItem == null)
                {
                    videoId = (selectedCategory as RssLink).Url;
                    trackId = selectedCategory.GetTrackId();
                    title = selectedCategory.Name;
                }
                else
                {
                    SerializableDictionary<string, string> other = selectedItem.Other as SerializableDictionary<string, string>;
                    videoId = other["VideoId"];
                    trackId = other["TrackId"];
                    title = selectedItem.Title;
                }
                ContextMenuExecutionResult result = new ContextMenuExecutionResult();
                GetWebData(string.Format(addRemoveMyListUrl, ShaktiApi, BuildId),
                    string.Format(addRemoveMyListPostData, removeMyListOperation, videoId, trackId, latestAuthUrl),
                    cc, userAgent: UserAgent);
                result.RefreshCurrentItems = true;
                result.ExecutionResultMessage = title + " removed from My List";
                return result;
            }
            return base.ExecuteContextMenuEntry(selectedCategory, selectedItem, choice);
        }
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:59,代码来源:NetfilxWebUtil.cs


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