private async void FillEntriesUser(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var youtubeUrl = YoutubeUrl; var request = new MSYoutubeRequest(_settings); var uri = new Uri(String.Format("https://gdata.youtube.com/feeds/api/users/{0}/playlists?v=2", youtubeUrl.UserId)); var items = await request.GetAsync(YoutubeUrl, uri, onYoutubeLoading); if (items == null) return; Entries = new ObservableCollection<Feed>(); try { if (!String.IsNullOrEmpty(items.AuthorId)) { var favoritesEntry = new YoutubeEntry(this) { Title = "Favorite Videos", Uri = new Uri("http://www.youtube.com/playlist?list=FL" + items.AuthorId), }; Entries.Add(favoritesEntry); } foreach (var member in items.Entries) { var entry = new YoutubeEntry(this) { Title = member.Title, Uri = member.Uri, Description = member.Description }; Entries.Add(entry); } } catch { Entries.Clear(); } if (onEntriesReady != null) onEntriesReady(Entries); }
public void GetEntries(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading = null) { if(YoutubeUrl.Type == VideoUrlType.Channel || YoutubeUrl.ChannelId != "" || YoutubeUrl.FeedId != "") FillEntriesChannel(onEntriesReady, onYoutubeLoading); else if(YoutubeUrl.Type == VideoUrlType.User) FillEntriesUser(onEntriesReady, onYoutubeLoading); }
public void GetEntries(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading = null) { Task.Factory.StartNew(() => { if (YoutubeUrl.Type == VideoUrlType.Channel || YoutubeUrl.ChannelId != "" || YoutubeUrl.FeedId != "") { FillEntriesChannel(onEntriesReady, onYoutubeLoading); } else if (YoutubeUrl.Type == VideoUrlType.User) { FillEntriesUser(onEntriesReady, onYoutubeLoading); } }); }
private void FillEntriesChannel(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var url = ""; if (!String.IsNullOrEmpty(YoutubeUrl.ChannelId)) { url = "https://gdata.youtube.com/feeds/api/playlists/" + YoutubeUrl.ChannelId; } else if (!String.IsNullOrEmpty(YoutubeUrl.FeedId)) { url = String.Format("https://gdata.youtube.com/feeds/api/users/{0}/uploads", YoutubeUrl.FeedId); } if (url.Length <= 0) { return; } try { var request = new MSYoutubeRequest(_settings); var items = request.GetAsync(YoutubeUrl, new Uri(url), onYoutubeLoading); if (items == null) { Entries = new ObservableCollection <Feed>(); } else { if (String.IsNullOrEmpty(Title)) { Title = items.Title; } Entries = GetMembers(items); } } catch { Entries = new ObservableCollection <Feed>(); } if (onEntriesReady != null) { onEntriesReady(Entries); } }
private void FillEntriesUser(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var youtubeUrl = YoutubeUrl; var request = new MSYoutubeRequest(_settings); var uri = new Uri(String.Format("https://gdata.youtube.com/feeds/api/users/{0}/playlists?v=2", youtubeUrl.UserId)); var items = request.GetAsync(YoutubeUrl, uri, onYoutubeLoading); if (items == null) { return; } Entries = new ObservableCollection <Feed>(); try { if (!String.IsNullOrEmpty(items.AuthorId)) { var favoritesEntry = new YoutubeEntry(this) { Title = "Favorite Videos", Uri = new Uri("http://www.youtube.com/playlist?list=FL" + items.AuthorId) }; Entries.Add(favoritesEntry); } foreach (var member in items.Entries) { var entry = new YoutubeEntry(this) { Title = member.Title, Uri = member.Uri, Description = member.Description }; Entries.Add(entry); } } catch { Entries.Clear(); } if (onEntriesReady != null) { onEntriesReady(Entries); } }
private async void FillEntriesChannel(EntriesReady onEntriesReady, MSYoutubeLoading onYoutubeLoading) { var url = ""; if (!String.IsNullOrEmpty(YoutubeUrl.ChannelId)) url = "https://gdata.youtube.com/feeds/api/playlists/" + YoutubeUrl.ChannelId; else if (!String.IsNullOrEmpty(YoutubeUrl.FeedId)) url = String.Format("https://gdata.youtube.com/feeds/api/users/{0}/uploads", YoutubeUrl.FeedId); if (url.Length <= 0) return; try { var request = new MSYoutubeRequest(_settings); var items = await request.GetAsync(YoutubeUrl, new Uri(url), onYoutubeLoading); if (items == null) Entries = new ObservableCollection<Feed>(); else { if (String.IsNullOrEmpty(Title)) Title = items.Title; Entries = GetMembers(items); } } catch { Entries = new ObservableCollection<Feed>(); } if (onEntriesReady != null) onEntriesReady(Entries); }