public void Parse(Feed<Video> videoFeed, VideoList videoList) { foreach (Video video in videoFeed.Entries) { string id = video.VideoId; string title = video.Title; if (video.Thumbnails != null && video.Thumbnails.Count > 0) { foreach (MediaContent mediaContent in video.Contents) { if ("5".Equals(mediaContent.Format)) { if ("120".Equals(video.Thumbnails[0].Width) && "90".Equals(video.Thumbnails[0].Height)) { VideoItem videoItem = new VideoItem(id, title, ProviderEnum.YouTube); videoItem.ThumbnailImageURL = video.Thumbnails[0].Url; videoItem.ThumbnailImageWidth = video.Thumbnails[0].Width; videoItem.ThumbnailImageHeight = video.Thumbnails[0].Height; videoList.AddVideo(videoItem); } } } } } }
public void AddVideo(VideoItem newVideo) { VideoItem video = GetVideo(newVideo.ID); if (video == null) { Add(newVideo); } }
public int CompareTo(VideoItem item2, VideoItemComparerEnum sortBy) { switch (sortBy) { case VideoItemComparerEnum.ID: return ID.CompareTo(item2.ID); case VideoItemComparerEnum.Title: return Title.CompareTo(item2.Title); default: return ID.CompareTo(item2.ID); } }