public void YouTubePlaylistBatchTest() { Tracing.TraceMsg("Entering YouTubePlaylistBatchTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd); YouTubeRequest f = new YouTubeRequest(settings); // GetVideoFeed get's you a users video feed Feed <Playlist> feed = f.GetPlaylistsFeed(null); // this will get you just the first 25 playlists. List <Playlist> list = new List <Playlist>(); int i = 0; foreach (Playlist p in feed.Entries) { list.Add(p); // add everything you want to do here... } Feed <PlayListMember> videos = f.GetPlaylist(list[0]); List <PlayListMember> lvideo = new List <PlayListMember>(); foreach (PlayListMember v in videos.Entries) { lvideo.Add(v); // add everything you want to do here... } List <PlayListMember> batch = new List <PlayListMember>(); PlayListMember toBatch = new PlayListMember(); toBatch.Id = lvideo[1].Id; toBatch.VideoId = lvideo[1].VideoId; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "NEWGUY"; toBatch.BatchData.Type = GDataBatchOperationType.insert; batch.Add(toBatch); toBatch = lvideo[1]; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "DELETEGUY"; toBatch.BatchData.Type = GDataBatchOperationType.delete; batch.Add(toBatch); toBatch = lvideo[0]; toBatch.Position = 1; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "UPDATEGUY"; toBatch.BatchData.Type = GDataBatchOperationType.update; batch.Add(toBatch); Feed <PlayListMember> updatedVideos = f.Batch(batch, videos); foreach (Video v in updatedVideos.Entries) { Assert.IsTrue(v.BatchData.Status.Code < 300, "one batch operation failed: " + v.BatchData.Status.Reason); } }
public void CreatePlaylist() { Playlist playlistBlueprint = new Playlist(); playlistBlueprint.Title = _playlistName; playlistBlueprint.Summary = _playlistSummary; Playlist playlist; try { playlist = _request.Insert(new Uri("http://gdata.youtube.com/feeds/api/users/default/playlists"), playlistBlueprint); } catch (InvalidCredentialsException) { throw new InvalidLoginInfoException(); } foreach (var query in _queryList) { YouTubeQuery ytQuery = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); //ytQuery.OrderBy = "viewCount"; ytQuery.Query = query; ytQuery.SafeSearch = YouTubeQuery.SafeSearchValues.None; Feed <Video> results = _request.Get <Video>(ytQuery); Video firstVideo = results.Entries.ToList()[0]; PlayListMember playlistMember = new PlayListMember(); playlistMember.VideoId = firstVideo.VideoId; _request.AddToPlaylist(playlist, playlistMember); } int idIndex = playlist.Id.IndexOf("playlist:"); string id = playlist.Id.Substring(idIndex + "playlist:".Length); PlaylistUrl = "https://www.youtube.com/playlist?list=" + id; }
protected override void OnShowContextMenu() { if (listControl == null || listControl.SelectedListItem == null) { return; } GUIListItem selectedItem = listControl.SelectedListItem; YouTubeEntry videoEntry = selectedItem.MusicTag as YouTubeEntry; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) { return; } dlg.Reset(); dlg.SetHeading(498); // menu if (Youtube2MP.player.CurrentSong > -1 || Youtube2MP.temp_player.CurrentSong > -1) { dlg.Add(Translation.PlayNext); } dlg.Add(Translation.ShowPreviousWindow); dlg.Add(Translation.Fullscreen); if (videoEntry != null) { dlg.Add(Translation.AddPlaylist); dlg.Add(Translation.AddAllPlaylist); dlg.Add(Translation.Info); if (Youtube2MP.service.Credentials != null) { dlg.Add(Translation.AddFavorites); dlg.Add(Translation.AddWatchLater); } } dlg.DoModal(GetID); if (dlg.SelectedId == -1) { return; } if (dlg.SelectedLabelText == Translation.ShowPreviousWindow) { GUIWindowManager.ShowPreviousWindow(); } else if (dlg.SelectedLabelText == Translation.Fullscreen) { g_Player.ShowFullScreenWindow(); } else if (dlg.SelectedLabelText == Translation.AddPlaylist) { VideoInfo inf = SelectQuality(videoEntry); if (inf.Quality != VideoQuality.Unknow) { AddItemToPlayList(selectedItem, inf); } } else if (dlg.SelectedLabelText == Translation.AddAllPlaylist) { VideoInfo inf = SelectQuality(videoEntry); inf.Items = new Dictionary <string, string>(); if (inf.Quality != VideoQuality.Unknow) { GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS); if (dlgProgress != null) { dlgProgress.Reset(); dlgProgress.SetHeading(Translation.AddAllPlaylist); dlgProgress.SetLine(1, ""); dlgProgress.SetLine(2, ""); dlgProgress.SetPercentage(0); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); dlgProgress.StartModal(GetID); } int i = 0; for (int j = 0; j < listControl.Count; j++) { GUIListItem item = listControl[j]; if (dlgProgress != null) { double pr = ((double)i / (double)listControl.Count) * 100; dlgProgress.SetLine(1, item.Label); dlgProgress.SetLine(2, i.ToString() + "/" + listControl.Count.ToString()); dlgProgress.SetPercentage((int)pr); dlgProgress.Progress(); if (dlgProgress.IsCanceled) { break; } } i++; AddItemToPlayList(item, new VideoInfo(inf)); } if (dlgProgress != null) { dlgProgress.Close(); } } } else if (dlg.SelectedLabelText == Translation.AddFavorites) { try { Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreateFavoritesUri(null)), videoEntry); } catch (Exception) { Err_message(Translation.WrongRequestWrongUser); } } else if (dlg.SelectedLabelText == Translation.AddWatchLater) { PlayListMember pm = new PlayListMember(); pm.Id = videoEntry.VideoId; Youtube2MP.request.Insert(new Uri("https://gdata.youtube.com/feeds/api/users/default/watch_later"), pm); } else if (dlg.SelectedLabelText == Translation.Info) { YoutubeGuiInfoEx scr = (YoutubeGuiInfoEx)GUIWindowManager.GetWindow(29053); scr.YouTubeEntry = videoEntry; //if (entry!=null) //{ // ArtistItem artistItem=ent //} GUIWindowManager.ActivateWindow(29053); } else if (dlg.SelectedLabelText == Translation.PlayNext) { PlayNext(videoEntry); } }
/// <summary> /// Called when [show context menu]. /// </summary> protected override void OnShowContextMenu() { GUIListItem selectedItem = listControl.SelectedListItem; string artistName = string.Empty; YouTubeEntry videoEntry; LocalFileStruct file = selectedItem.MusicTag as LocalFileStruct; SiteItemEntry entry = selectedItem.MusicTag as SiteItemEntry; if (file != null) { Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + file.VideoId); Video video = Youtube2MP.request.Retrieve<Video>(videoEntryUrl); videoEntry = video.YouTubeEntry; } else { videoEntry = selectedItem.MusicTag as YouTubeEntry; if (videoEntry == null) { if (entry != null) { GenericListItemCollections genericListItem = Youtube2MP.GetList(entry); if (entry.Provider == "VideoItem" && genericListItem.Items.Count > 0) { videoEntry = genericListItem.Items[0].Tag as YouTubeEntry; } } } if (videoEntry == null) return; Uri videoEntryUrl = new Uri("http://gdata.youtube.com/feeds/api/videos/" + Youtube2MP.GetVideoId(videoEntry)); Video video = Youtube2MP.request.Retrieve<Video>(videoEntryUrl); videoEntry = video.YouTubeEntry; } if (videoEntry == null) return; artistName = ArtistManager.Instance.GetArtistName(videoEntry.Title.Text); ArtistItem artistItem = GetArtist(videoEntry); GUIDialogMenu dlg = (GUIDialogMenu) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_MENU); if (dlg == null) return; dlg.Reset(); dlg.SetHeading(Translation.ContextMenu); // menu if (Youtube2MP.player.CurrentSong > -1 || Youtube2MP.temp_player.CurrentSong > -1) dlg.Add(Translation.PlayNext); dlg.Add(Translation.Info); dlg.Add(Translation.RelatedVideos); dlg.Add(Translation.VideoResponses); dlg.Add(string.Format(Translation.AllVideosFromUser, videoEntry.Authors[0].Name)); dlg.Add(Translation.AddPlaylist); dlg.Add(Translation.AddAllPlaylist); if (Youtube2MP.service.Credentials != null) { dlg.Add(Translation.AddFavorites); dlg.Add(Translation.AddWatchLater); } dlg.Add(Translation.Options); dlg.Add(Translation.DownloadVideo); if (!string.IsNullOrEmpty(artistName) && !string.IsNullOrEmpty(ArtistManager.Instance.GetArtistsByName(artistName).Name)) dlg.Add(string.Format(Translation.AllMusicVideosFrom, artistName)); if (!string.IsNullOrEmpty(artistItem.Id)) dlg.Add(Translation.SimilarArtists); dlg.DoModal(GetID); if (dlg.SelectedId == -1) return; if (dlg.SelectedLabelText == Translation.RelatedVideos) { if (videoEntry.RelatedVideosUri != null) { YouTubeQuery query = new YouTubeQuery(videoEntry.RelatedVideosUri.Content); YouTubeFeed vidr = service.Query(query); if (vidr.Entries.Count > 0) { SaveListState(true); addVideos(vidr, false, query); UpdateGui(); } else { Err_message(Translation.NoItemWasFound); } } } else if (dlg.SelectedLabelText == Translation.VideoResponses) { if (videoEntry.VideoResponsesUri != null) { YouTubeQuery query = new YouTubeQuery(videoEntry.VideoResponsesUri.Content); YouTubeFeed vidr = service.Query(query); if (vidr.Entries.Count > 0) { SaveListState(true); addVideos(vidr, false, query); UpdateGui(); } else { Err_message(Translation.NoVideoResponse); } } } else if (dlg.SelectedLabelText == string.Format(Translation.AllVideosFromUser, videoEntry.Authors[0].Name)) { SiteItemEntry newentry = new SiteItemEntry {Provider = new UserVideos().Name}; newentry.SetValue("id", videoEntry.Authors[0].Name); addVideos(Youtube2MP.GetList(newentry), true); } else if (dlg.SelectedLabelText == Translation.AddPlaylist) { VideoInfo inf = SelectQuality(videoEntry); if (inf.Quality != VideoQuality.Unknow) { AddItemToPlayList(selectedItem, inf); } } else if (dlg.SelectedLabelText == Translation.AddAllPlaylist) { VideoInfo inf = SelectQuality(videoEntry); inf.Items = new Dictionary<string, string>(); if (inf.Quality != VideoQuality.Unknow) { GUIDialogProgress dlgProgress = (GUIDialogProgress) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_PROGRESS); if (dlgProgress != null) { dlgProgress.Reset(); dlgProgress.SetHeading(Translation.AddAllPlaylist); dlgProgress.SetLine(1, ""); dlgProgress.SetLine(2, ""); dlgProgress.SetPercentage(0); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); dlgProgress.StartModal(GetID); } int i = 0; for (int j = 0; j < listControl.Count; j++) { GUIListItem item = listControl[j]; if (dlgProgress != null) { double pr = ((double) i/(double) listControl.Count)*100; dlgProgress.SetLine(1, item.Label); dlgProgress.SetLine(2, i.ToString() + "/" + listControl.Count.ToString()); dlgProgress.SetPercentage((int) pr); dlgProgress.Progress(); if (dlgProgress.IsCanceled) break; } i++; AddItemToPlayList(item, new VideoInfo(inf)); } if (dlgProgress != null) dlgProgress.Close(); } } else if (dlg.SelectedLabelText == Translation.AddFavorites) { try { service.Insert(new Uri(YouTubeQuery.CreateFavoritesUri(null)), videoEntry); } catch (Exception) { Err_message(Translation.WrongRequestWrongUser); } } else if (dlg.SelectedLabelText == Translation.AddWatchLater) { PlayListMember pm = new PlayListMember(); pm.Id = videoEntry.VideoId; Youtube2MP.request.Insert(new Uri("https://gdata.youtube.com/feeds/api/users/default/watch_later"), pm); } else if (dlg.SelectedLabelText == Translation.Options) { DoOptions(); } else if (dlg.SelectedLabelText == Translation.DownloadVideo) { LocalFileStruct fil = Youtube2MP._settings.LocalFile.Get(Youtube2MP.GetVideoId(videoEntry)); if (fil != null && File.Exists(fil.LocalFile)) { Err_message(Translation.ItemAlreadyDownloaded); } else { if (VideoDownloader.IsBusy) { Err_message(Translation.AnotherDonwnloadProgress); dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS); if (dlgProgress != null) { dlgProgress.Reset(); dlgProgress.SetHeading(Translation.DownloadProgress); dlgProgress.SetLine(1, ""); dlgProgress.SetLine(2, ""); dlgProgress.SetPercentage(0); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); dlgProgress.DoModal(GetID); } } else { VideoInfo inf = SelectQuality(videoEntry); string streamurl = Youtube2MP.StreamPlaybackUrl(videoEntry, inf); VideoDownloader.AsyncDownload(streamurl, Youtube2MP._settings.DownloadFolder + "\\" + Utils.MakeFileName(Utils.GetFilename(videoEntry.Title.Text + "{" + Youtube2MP.GetVideoId(videoEntry) + "}")) + Path.GetExtension(streamurl) + ".___"); GUIPropertyManager.SetProperty("#Youtube.fm.IsDownloading", "true"); GUIPropertyManager.SetProperty("#Youtube.fm.Download.Progress", "0"); GUIPropertyManager.SetProperty("#Youtube.fm.Download.Item", videoEntry.Title.Text); DatabaseProvider.InstanInstance.Save(videoEntry); VideoDownloader.Entry = videoEntry; } } } else if (dlg.SelectedLabelText == string.Format(Translation.AllMusicVideosFrom, artistName)) { addVideos(ArtistManager.Instance.Grabber.GetArtistVideosIds(ArtistManager.Instance.GetArtistName(videoEntry)), true); } else if (dlg.SelectedLabelText == Translation.Info) { YoutubeGuiInfoEx scr = (YoutubeGuiInfoEx) GUIWindowManager.GetWindow(29053); scr.YouTubeEntry = videoEntry; //if (entry!=null) //{ // ArtistItem artistItem=ent //} GUIWindowManager.ActivateWindow(29053); } else if (dlg.SelectedLabelText == Translation.PlayNext) { PlayNext(videoEntry); } else if (dlg.SelectedLabelText == Translation.SimilarArtists) { List<ArtistItem> similarartist = new List<ArtistItem>(); similarartist = ArtistManager.Instance.Grabber.GetSimilarArtists(ArtistManager.Instance.GetArtistName(videoEntry)); GenericListItemCollections res = new GenericListItemCollections(); foreach (ArtistItem item in similarartist) { SiteItemEntry newentry = new SiteItemEntry(); newentry.Provider = "Artists"; newentry.SetValue("letter", "false"); newentry.SetValue("id", item.Id); newentry.SetValue("name", item.Name); res.ItemType = ItemType.Artist; try { GenericListItem listItem = new GenericListItem() { Title = item.Name, LogoUrl = string.IsNullOrEmpty(item.Img_url.Trim()) ? "@" : item.Img_url, IsFolder = true, DefaultImage = "defaultArtistBig.png", Tag = newentry }; res.Items.Add(listItem); } catch (Exception exception) { } } res.Title = "Artists/Similar/" + artistItem.Name; addVideos(res, true); } }
public void YouTubePlaylistBatchTest() { Tracing.TraceMsg("Entering YouTubePlaylistBatchTest"); YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytClient, this.ytDevKey, this.ytUser, this.ytPwd); YouTubeRequest f = new YouTubeRequest(settings); // GetVideoFeed get's you a users video feed Feed<Playlist> feed = f.GetPlaylistsFeed(null); // this will get you just the first 25 playlists. List<Playlist> list = new List<Playlist>(); int i = 0; foreach (Playlist p in feed.Entries) { list.Add(p); // add everything you want to do here... } Feed<PlayListMember> videos = f.GetPlaylist(list[0]); List<PlayListMember> lvideo = new List<PlayListMember>(); foreach (PlayListMember v in videos.Entries) { lvideo.Add(v); // add everything you want to do here... } List<PlayListMember> batch = new List<PlayListMember>(); PlayListMember toBatch = new PlayListMember(); toBatch.Id = lvideo[1].Id; toBatch.VideoId = lvideo[1].VideoId; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "NEWGUY"; toBatch.BatchData.Type = GDataBatchOperationType.insert; batch.Add(toBatch); toBatch = lvideo[1]; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "DELETEGUY"; toBatch.BatchData.Type = GDataBatchOperationType.delete; batch.Add(toBatch); toBatch = lvideo[0]; toBatch.Position = 1; toBatch.BatchData = new GDataBatchEntryData(); toBatch.BatchData.Id = "UPDATEGUY"; toBatch.BatchData.Type = GDataBatchOperationType.update; batch.Add(toBatch); Feed<PlayListMember> updatedVideos = f.Batch(batch, videos); foreach (Video v in updatedVideos.Entries) { Assert.IsTrue(v.BatchData.Status.Code < 300, "one batch operation failed: " + v.BatchData.Status.Reason); } }
void SavePlayList() { if (Youtube2MP.service.Credentials == null) { Err_message(Translation.WrongUser); return; } VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); // display an virtual keyboard if (null == keyboard) return; keyboard.Reset(); keyboard.Text = playlistname; keyboard.DoModal(GetID); if (keyboard.IsConfirmed) { // input confirmed -- execute the search playlistname = keyboard.Text; if (playlistname == Translation.WatchLater) { Err_message("Saving Watch Later not supported !"); return; } PlaylistsFeed userPlaylists; YouTubeQuery query = new YouTubeQuery(YouTubeQuery.CreatePlaylistsUri(null)); try { userPlaylists = Youtube2MP.service.GetPlaylists(query); } catch (GDataRequestException exception) { if (exception.InnerException != null) Err_message(exception.InnerException.Message); else Err_message(exception.Message); return; } PlayList playList = Youtube2MP.player.GetPlaylist(_playlistType); if (playlistname != Translation.WatchLater) { foreach (PlaylistsEntry entry in userPlaylists.Entries) { if (entry.Title.Text == playlistname) { entry.Delete(); } } } else { YouTubeQuery playlistQuery = new YouTubeQuery("https://gdata.youtube.com/feeds/api/users/default/watch_later"); YouTubeFeed playlistFeed = null; int start = 1; do { playlistQuery.StartIndex = start; playlistQuery.NumberToRetrieve = 50; playlistFeed = Youtube2MP.service.Query(playlistQuery); foreach (YouTubeEntry playlistEntry in playlistFeed.Entries) { playlistEntry.Delete(); } start += 50; } while (playlistFeed.TotalResults > start - 1); //Youtube2MP.service.Delete(new Uri("https://gdata.youtube.com/feeds/api/users/default/watch_later")); } GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS); if (dlgProgress != null) { dlgProgress.Reset(); dlgProgress.SetHeading(Translation.PlaylistSavingProgress); dlgProgress.SetLine(1, ""); dlgProgress.SetLine(2, ""); dlgProgress.SetPercentage(0); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); dlgProgress.StartModal(GetID); } int notsaved = 0; Playlist pl = new Playlist(); pl.Title = playlistname; pl.Summary = Translation.PlaylistSummary; pl =Youtube2MP.request.Insert(new Uri(YouTubeQuery.CreatePlaylistsUri(null)), pl); int i = 1; foreach (PlayListItem playitem in playList) { VideoInfo info = (VideoInfo)playitem.MusicTag; YouTubeEntry videoEntry = info.Entry; PlayListMember pm = new PlayListMember(); // Insert <id> or <videoid> for video here pm.Id = videoEntry.VideoId; if (IsVideoUsable(videoEntry)) try { if (playlistname != Translation.WatchLater) { Youtube2MP.request.AddToPlaylist(pl, pm); } else { Youtube2MP.service.Insert(new Uri("https://gdata.youtube.com/feeds/api/users/default/watch_later"), videoEntry); } } catch (Exception ex) { Thread.Sleep(2000); notsaved++; playitem.Type = PlayListItem.PlayListItemType.Unknown; } else { notsaved++; playitem.Type = PlayListItem.PlayListItemType.Unknown; } if (i % 10 == 0) Thread.Sleep(1000); if (dlgProgress != null) { double pr = ((double)i / (double)playList.Count) * 100; dlgProgress.SetLine(1, videoEntry.Title.Text); dlgProgress.SetLine(2, i.ToString() + "/" + playList.Count.ToString() + "( skipped " + notsaved.ToString() + ")"); dlgProgress.SetPercentage((int) pr); dlgProgress.Progress(); } i++; } if (dlgProgress != null) dlgProgress.Close(); if (notsaved > 0) Err_message(Translation.SomePlaylistItemNotSaved); LoadDirectory(string.Empty); } }
protected override void OnShowContextMenu() { if (listControl == null || listControl.SelectedListItem == null) return; GUIListItem selectedItem = listControl.SelectedListItem; YouTubeEntry videoEntry = selectedItem.MusicTag as YouTubeEntry; GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg == null) return; dlg.Reset(); dlg.SetHeading(498); // menu if (Youtube2MP.player.CurrentSong > -1 || Youtube2MP.temp_player.CurrentSong > -1) dlg.Add(Translation.PlayNext); dlg.Add(Translation.ShowPreviousWindow); dlg.Add(Translation.Fullscreen); if (videoEntry != null) { dlg.Add(Translation.AddPlaylist); dlg.Add(Translation.AddAllPlaylist); dlg.Add(Translation.Info); if (Youtube2MP.service.Credentials != null) { dlg.Add(Translation.AddFavorites); dlg.Add(Translation.AddWatchLater); } } dlg.DoModal(GetID); if (dlg.SelectedId == -1) return; if (dlg.SelectedLabelText == Translation.ShowPreviousWindow) { GUIWindowManager.ShowPreviousWindow(); } else if (dlg.SelectedLabelText == Translation.Fullscreen) { g_Player.ShowFullScreenWindow(); } else if (dlg.SelectedLabelText == Translation.AddPlaylist) { VideoInfo inf = SelectQuality(videoEntry); if (inf.Quality != VideoQuality.Unknow) { AddItemToPlayList(selectedItem, inf); } } else if (dlg.SelectedLabelText == Translation.AddAllPlaylist) { VideoInfo inf = SelectQuality(videoEntry); inf.Items = new Dictionary<string, string>(); if (inf.Quality != VideoQuality.Unknow) { GUIDialogProgress dlgProgress = (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS); if (dlgProgress != null) { dlgProgress.Reset(); dlgProgress.SetHeading(Translation.AddAllPlaylist); dlgProgress.SetLine(1, ""); dlgProgress.SetLine(2, ""); dlgProgress.SetPercentage(0); dlgProgress.Progress(); dlgProgress.ShowProgressBar(true); dlgProgress.StartModal(GetID); } int i = 0; for (int j = 0; j < listControl.Count; j++) { GUIListItem item = listControl[j]; if (dlgProgress != null) { double pr = ((double)i / (double)listControl.Count) * 100; dlgProgress.SetLine(1, item.Label); dlgProgress.SetLine(2, i.ToString() + "/" + listControl.Count.ToString()); dlgProgress.SetPercentage((int)pr); dlgProgress.Progress(); if (dlgProgress.IsCanceled) break; } i++; AddItemToPlayList(item, new VideoInfo(inf)); } if (dlgProgress != null) dlgProgress.Close(); } } else if (dlg.SelectedLabelText == Translation.AddFavorites) { try { Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreateFavoritesUri(null)), videoEntry); } catch (Exception) { Err_message(Translation.WrongRequestWrongUser); } } else if (dlg.SelectedLabelText == Translation.AddWatchLater) { PlayListMember pm = new PlayListMember(); pm.Id = videoEntry.VideoId; Youtube2MP.request.Insert(new Uri("https://gdata.youtube.com/feeds/api/users/default/watch_later"), pm); } else if (dlg.SelectedLabelText == Translation.Info) { YoutubeGuiInfoEx scr = (YoutubeGuiInfoEx)GUIWindowManager.GetWindow(29053); scr.YouTubeEntry = videoEntry; //if (entry!=null) //{ // ArtistItem artistItem=ent //} GUIWindowManager.ActivateWindow(29053); } else if (dlg.SelectedLabelText == Translation.PlayNext) { PlayNext(videoEntry); } }