private List <VideoInfo> videoListFromVimeo(string url) { List <VideoInfo> result = new List <VideoInfo>(); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(AuthBase.BuildOAuthApiRequestUrl(url)); double totalVideos = Int32.Parse(xmlDoc.SelectSingleNode("//videos").Attributes["total"].Value); nPages = Convert.ToInt32(Math.Ceiling(totalVideos / pageSize)); XmlNodeList videoNodes = xmlDoc.SelectNodes("//videos/video"); foreach (XmlNode videoNode in videoNodes) { VideoInfo video = new VideoInfo(); video.Title = videoNode.SelectSingleNode("title").InnerText; video.Description = videoNode.SelectSingleNode("description").InnerText; video.VideoUrl = videoNode.SelectSingleNode("urls/url").InnerText; video.Thumb = getThumbUrl(videoNode.SelectNodes("thumbnails/thumbnail")); video.Length = TimeSpan.FromSeconds(Int32.Parse(videoNode.SelectSingleNode("duration").InnerText)).ToString(); string Airdate = videoNode.SelectSingleNode("upload_date").InnerText; if (!String.IsNullOrEmpty(Airdate)) { video.Length = video.Length + '|' + Translation.Instance.Airdate + ": " + Airdate; } result.Add(video); } return(result); }
public override int DiscoverDynamicCategories() { if (!useDynamicCategories) { Settings.DynamicCategoriesDiscovered = true; foreach (Category cat in Settings.Categories) { Match m = Regex.Match(((RssLink)cat).Url, @"http://vimeo.com/[^/]*/(?<kind>(channels|groups|albums)*)/"); if (m.Success) { cat.HasSubCategories = "channels".Equals(m.Groups["kind"].Value) || "groups".Equals(m.Groups["kind"].Value) || "albums".Equals(m.Groups["kind"].Value); } } return(0); } if (Settings.Categories == null) { Settings.Categories = new BindingList <Category>(); } string url = StandardAdvancedApiUrl + "?method=vimeo.categories.getall&page=0&per_page=50"; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(AuthBase.BuildOAuthApiRequestUrl(url)); Settings.DynamicCategoriesDiscovered = true; foreach (XmlNode categNode in xmlDoc.SelectNodes(@"//rsp/categories/category")) { RssLink cat = new RssLink(); XmlNode nd = categNode.SelectSingleNode("name"); if (nd != null) { cat.Name = nd.InnerText; } else { cat.Name = categNode.SelectSingleNode("title").InnerText; } cat.Url = categNode.SelectSingleNode("url").InnerText; cat.Other = categNode.Attributes["word"].Value; AddSubcats(cat, categNode); Settings.Categories.Add(cat); } ; return(Settings.Categories.Count); }
private int subcatsFromVimeo(Category parentCategory, string url, string key) { XmlDocument xmlDoc = new XmlDocument(); parentCategory.SubCategories = new List <Category>(); xmlDoc.Load(AuthBase.BuildOAuthApiRequestUrl(url)); XmlNodeList categNodes = xmlDoc.SelectNodes("//" + key + "/" + key.TrimEnd('s')); foreach (XmlNode categNode in categNodes) { RssLink cat = new RssLink(); XmlNode nd = categNode.SelectSingleNode("name"); if (nd != null) { cat.Name = nd.InnerText; } else { cat.Name = categNode.SelectSingleNode("title").InnerText; } nd = categNode.SelectSingleNode("description"); if (nd != null) { cat.Description = nd.InnerText; } cat.Url = categNode.SelectSingleNode("url").InnerText; nd = categNode.SelectSingleNode("logo_url"); if (nd != null) { cat.Thumb = nd.InnerText; } else { cat.Thumb = getThumbUrl(categNode.SelectNodes("//thumbnail")); } cat.ParentCategory = parentCategory; parentCategory.SubCategories.Add(cat); } parentCategory.SubCategoriesDiscovered = true; return(parentCategory.SubCategories.Count); }