예제 #1
0
 public void FeedLinkTest()
 {
     PlaylistsEntry target = new PlaylistsEntry(); // TODO: Initialize to an appropriate value
     string expected =  "secret text string";
     string actual;
     target.Content.Src =  new AtomUri(expected);
     actual = target.Content.Src.Content;
     Assert.AreEqual(expected, actual);
 }
 public void FeedLinkTest()
 {
     PlaylistsEntry target = new PlaylistsEntry(); // TODO: Initialize to an appropriate value
     FeedLink expected =  new FeedLink();
     FeedLink actual;
     target.FeedLink = expected;
     actual = target.FeedLink;
     Assert.AreEqual(expected, actual);
 }
        void SavePlayList()
        {
            string strNewFileName = string.Empty;
            VirtualKeyboard keyboard;
            // display an virtual keyboard
            if (Youtube2MP._settings.UseSMSStyleKeyBoard)
            {
                keyboard = (SmsStyledKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_SMS_KEYBOARD);
            }
            else
            {
                keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
            }
            if (null == keyboard) return;
            keyboard.Reset();
            keyboard.Text = strNewFileName;
            keyboard.DoModal(GetID);
            if (keyboard.IsConfirmed)
            {
                // input confirmed -- execute the search
                strNewFileName = keyboard.Text;
                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);
                foreach (PlaylistsEntry entry in userPlaylists.Entries)
                {
                    if (entry.Title.Text == strNewFileName)
                    {
                        entry.Delete();
                    }
                }

                //Playlist pl = new Playlist();
                //pl.Title = strNewFileName;
                //pl.Summary = "Created or modified in MediaPortal";
                //Playlist createdPlaylist = Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreatePlaylistsUri(null)), pl);

                //PlaylistsEntry newPlaylist = new PlaylistsEntry();
                //newPlaylist.Title.Text = strNewFileName;
                ////newPlaylist.Description = "Created or modified in MediaPortal";
                //newPlaylist.Summary.Text = "Created or modified in MediaPortal";
                //PlaylistsEntry createdPlaylist = (PlaylistsEntry)Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreatePlaylistsUri(null)), newPlaylist);
                //Playlist pl = new Playlist();

                //YouTubeQuery query1 = new YouTubeQuery(YouTubeQuery.CreatePlaylistsUri(null));
                //PlaylistsFeed userPlaylists1 = Youtube2MP.service.GetPlaylists(query1);

                //foreach (PlaylistsEntry entry in userPlaylists1.Entries)
                //{
                //    if (entry.Title.Text == strNewFileName)
                //    {
                //        pl = (Playlist)entry;
                //    }
                //}

                //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;
                //  Youtube2MP.request.AddToPlaylist(pl, pm);
                //}

                PlaylistsEntry newPlaylist = new PlaylistsEntry();
                newPlaylist.Title.Text = strNewFileName;
                //newPlaylist.Description = "Created or modified in MediaPortal";
                newPlaylist.Summary.Text = "Created or modified in MediaPortal";
                PlaylistsEntry createdPlaylist = (PlaylistsEntry)Youtube2MP.service.Insert(new Uri(YouTubeQuery.CreatePlaylistsUri(null)), newPlaylist);

                foreach (PlayListItem playitem in playList)
                {
                    //playitem.MusicTag
                    //string videoEntryUrl = "http://gdata.youtube.com/feeds/api/videos/ADos_xW4_J0";
                    VideoInfo info = (VideoInfo)playitem.MusicTag;
                    YouTubeEntry videoEntry = info.Entry;
                    PlaylistEntry newPlaylistEntry = new PlaylistEntry();
                    newPlaylistEntry.Id = videoEntry.Id;
                    PlaylistEntry createdPlaylistEntry = (PlaylistEntry)Youtube2MP.service.Insert(new Uri(createdPlaylist.Content.Src.Content), newPlaylistEntry);
                }

            }
        }
예제 #4
0
 public void PlaylistsEntryConstructorTest()
 {
     PlaylistsEntry target = new PlaylistsEntry();
     Assert.IsNotNull(target);
     Assert.IsNull(target.Content.Src);
     Assert.IsNull(target.Summary.Text);
 }
예제 #5
0
 public void DescriptionTest()
 {
     PlaylistsEntry target = new PlaylistsEntry(); // TODO: Initialize to an appropriate value
     string expected = "secret text string"; // TODO: Initialize to an appropriate value
     string actual;
     target.Summary.Text = expected;
     actual = target.Summary.Text;
     Assert.AreEqual(expected, actual);
 }
 public void PlaylistsEntryConstructorTest()
 {
     PlaylistsEntry target = new PlaylistsEntry();
     Assert.IsNotNull(target);
     Assert.IsNull(target.FeedLink);
     Assert.IsNull(target.Description);
 }