当前位置: 首页>>代码示例>>C#>>正文


C# YouTubeRequest.Delete方法代码示例

本文整理汇总了C#中YouTubeRequest.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# YouTubeRequest.Delete方法的具体用法?C# YouTubeRequest.Delete怎么用?C# YouTubeRequest.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在YouTubeRequest的用法示例。


在下文中一共展示了YouTubeRequest.Delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: YouTubeRequestInsertTest

        /////////////////////////////////////////////////////////////////////////////


        //////////////////////////////////////////////////////////////////////
        /// <summary>runs a test on the YouTube Feed object</summary> 
        //////////////////////////////////////////////////////////////////////
        [Test] public void YouTubeRequestInsertTest()
        {
            Tracing.TraceMsg("Entering YouTubeRequestInsertTest");
            YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytClient, this.ytDevKey, this.ytUser, this.ytPwd);
            YouTubeRequest f = new YouTubeRequest(settings);

            Video v = new Video(); 
            v.Title = "Sample upload";
            v.Description = "This is a test with and & in it";

            MediaCategory category = new MediaCategory("Nonprofit");
            category.Attributes["scheme"] = YouTubeService.DefaultCategory;
            v.Tags.Add(category);
            v.Keywords = "math"; 
            v.YouTubeEntry.MediaSource = new MediaFileSource(this.resourcePath + "test_movie.mov", "video/quicktime");

            Video newVideo = f.Upload(this.ytUser, v); 

            newVideo.Title = "This test upload will soon be deleted";
            Video updatedVideo = f.Update(newVideo);

            Assert.AreEqual(updatedVideo.Description, newVideo.Description, "Description should be equal");
            Assert.AreEqual(updatedVideo.Keywords, newVideo.Keywords, "Keywords should be equal");

            newVideo.YouTubeEntry.MediaSource = new MediaFileSource(this.resourcePath + "test.mp4", "video/mp4");
            Video last = f.Update(updatedVideo);
            f.Delete(last);
        }
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:34,代码来源:youtubetest.cs

示例2: YouTubeSubscriptionsTest

        public void YouTubeSubscriptionsTest()
        {
            Tracing.TraceMsg("Entering YouTubeSubscriptionsTest");
            string playlistID = "4A3A73D5172EB90A";

            YouTubeRequestSettings settings = new YouTubeRequestSettings(this.ApplicationName, this.ytClient, this.ytDevKey, this.ytUser, this.ytPwd);
            // settings.PageSize = 15;
            YouTubeRequest f = new YouTubeRequest(settings);

            // this returns the server default answer
            Feed<Subscription> feed = f.GetSubscriptionsFeed(null);

            foreach (Subscription s in feed.Entries)
            {
                Assert.IsTrue(s.PlaylistId != null, "There should be a PlaylistId");
                Assert.IsTrue(s.PlaylistTitle != null, "There should be a PlaylistTitle");
                if (s.PlaylistId == playlistID)
                {
                    f.Delete(s);
                }
            }

            Subscription sub = new Subscription();
            sub.Type = SubscriptionEntry.SubscriptionType.playlist;
            sub.PlaylistId = playlistID;

            f.Insert(feed, sub);


            // this returns the server default answer
            feed = f.GetSubscriptionsFeed(null);
            List<Subscription> list = new List<Subscription>();

            foreach (Subscription s in feed.Entries)
            {
                Assert.IsTrue(s.PlaylistId != null, "There should be a PlaylistId");
                Assert.IsTrue(s.PlaylistTitle != null, "There should be a PlaylistTitle");

                if (s.PlaylistId == playlistID)
                {
                    list.Add(s);
                }
            }

            Assert.IsTrue(list.Count > 0, "There should be one subscription matching");

            foreach (Subscription s in list)
            {
                f.Delete(s);
            }

            foreach (Subscription s in feed.Entries)
            {
                Assert.IsTrue(s.PlaylistId != null, "There should be a PlaylistId");
                Assert.IsTrue(s.PlaylistTitle != null, "There should be a PlaylistTitle");
                Assert.IsFalse(s.PlaylistId == playlistID, "They should be gone");
            }
        }
开发者ID:yodiz,项目名称:Avega.ContactSynchronizer,代码行数:58,代码来源:youtubetest.cs

示例3: YouTubeAccessControlTest

        public void YouTubeAccessControlTest() {
            Tracing.TraceMsg("Entering YouTubeAccessControlTest");

            YouTubeRequestSettings settings = new YouTubeRequestSettings("NETUnittests", this.ytDevKey, this.ytUser, this.ytPwd);
            YouTubeRequest f = new YouTubeRequest(settings);

            Video v = new Video();
            v.Title = "Sample upload";
            v.Description = "This is a test with different access control values";

            MediaCategory category = new MediaCategory("Nonprofit");
            category.Attributes["scheme"] = YouTubeService.DefaultCategory;
            v.Tags.Add(category);
            v.Keywords = "math";
            v.YouTubeEntry.MediaSource = new MediaFileSource(Path.Combine(this.resourcePath, "test_movie.mov"), "video/quicktime");

            v.YouTubeEntry.AccessControls.Add(new YtAccessControl(YtAccessControl.RateAction, YtAccessControl.DeniedPermission));
            v.YouTubeEntry.AccessControls.Add(new YtAccessControl(YtAccessControl.CommentAction, YtAccessControl.ModeratedPermission));

            Video newVideo = f.Upload(this.ytUser, v);
            ExtensionCollection<YtAccessControl> acl = newVideo.YouTubeEntry.AccessControls;
            for (int i = 0; i < acl.Count; i++) {
                YtAccessControl ac = acl[i];
                switch (ac.Action) {
                    case YtAccessControl.RateAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.DeniedPermission, "Rating should be denied");
                        break;
                    case YtAccessControl.CommentAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.ModeratedPermission, "Comments should be moderated");
                        break;
                    case YtAccessControl.CommentVoteAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.AllowedPermission, "Comment rating should be allowed");
                        break;
                    case YtAccessControl.VideoRespondAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.ModeratedPermission, "Video responses should be moderated");
                        break;
                    case YtAccessControl.ListAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.AllowedPermission, "Video listing should be allowed");
                        break;
                    case YtAccessControl.EmbedAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.AllowedPermission, "Video embed should be allowed");
                        break;
                    case YtAccessControl.SyndicateAction:
                        Assert.AreEqual(ac.Permission, YtAccessControl.AllowedPermission, "Video syndicate should be allowed");
                        break;
                }
            }

            f.Delete(newVideo);
        }
开发者ID:saeedesmaeili,项目名称:google-gdata,代码行数:50,代码来源:youtubetest.cs

示例4: YouTubeSubscriptionsTest

        public void YouTubeSubscriptionsTest() {
            Tracing.TraceMsg("Entering YouTubeSubscriptionsTest");
            string channelUsername = "GoogleDevelopers";

            YouTubeRequestSettings settings = new YouTubeRequestSettings(this.ApplicationName, this.ytDevKey, this.ytUser, this.ytPwd);
            YouTubeRequest f = new YouTubeRequest(settings);

            // this returns the server default answer
            Feed<Subscription> feed = f.GetSubscriptionsFeed(null);

            foreach (Subscription s in feed.Entries) {
                if (!string.IsNullOrEmpty(s.UserName) && s.UserName == channelUsername) {
                    f.Delete(s);
                }
            }

            Subscription sub = new Subscription();
            sub.Type = SubscriptionEntry.SubscriptionType.channel;
            sub.UserName = "GoogleDevelopers";

            f.Insert(feed, sub);

            // this returns the server default answer
            feed = f.GetSubscriptionsFeed(null);
            List<Subscription> list = new List<Subscription>();

            foreach (Subscription s in feed.Entries) {
                if (!string.IsNullOrEmpty(s.UserName) && s.UserName == channelUsername) {
                    list.Add(s);
                }
            }

            Assert.IsTrue(list.Count > 0, "There should be one subscription matching");

            foreach (Subscription s in list) {
                f.Delete(s);
            }

            feed = f.GetSubscriptionsFeed(null);
            int iCount = 0;

            foreach (Subscription s in feed.Entries) {
                iCount++;
            }

            Assert.IsTrue(iCount == 0, "There should be no subscriptions in the feed");
        }
开发者ID:saeedesmaeili,项目名称:google-gdata,代码行数:47,代码来源:youtubetest.cs

示例5: Remove

        public void Remove(string uploader, string videoID)
        {
            YouTubeRequestSettings settings = new YouTubeRequestSettings("ControlTower", knt_devkey, knt_hadi, knt_hsifresi);
            bool s = true;
            string vidid = "";
            try
            {
                YouTubeRequest request = new YouTubeRequest(settings);
                Uri uri = new Uri(String.Format("http://gdata.YouTube.com/feeds/api/users/{0}/uploads/{1}", uploader, videoID));
                Video a = request.Retrieve<Video>(uri);
                request.Delete(a);
                vidid = a.VideoId;
            }
            catch
            {
                s = false;
            }
            if (s)
                AppendText(richTextBox1, Color.Chocolate, " Silindi: " + videoID + " " + DateTime.Now.ToString());


        }
开发者ID:voyl,项目名称:myprojects,代码行数:22,代码来源:Form1.cs

示例6: btnDelete_Click

        private void btnDelete_Click(object sender, EventArgs e)
        {
            //Should delete work on local files, or let the user do that manually?
            if (MessageBox.Show("WARNING: Deleting this file will delete it locally!", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes && listVideosView.FocusedItem.SubItems.Count > 1)
            {
                YouTubeRequestSettings settings = new YouTubeRequestSettings("Deprecated", key, Youtube_Uploader.Properties.Settings.Default.UsernameYT, Youtube_Uploader.Properties.Settings.Default.PasswordYT);
                YouTubeRequest request = new YouTubeRequest(settings);
                Uri videoEntryUrl = new Uri(String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads/{1}", TrimEmail(Youtube_Uploader.Properties.Settings.Default.UsernameYT), listVideosView.FocusedItem.SubItems[2].Text));
                Video video = request.Retrieve<Video>(videoEntryUrl);
                request.Delete(video);

                VideoFilename.RemoveAt(VideoId.IndexOf(video.VideoId));
                VideoStatus.RemoveAt(VideoId.IndexOf(video.VideoId));
                VideoId.RemoveAt(VideoId.IndexOf(video.VideoId));

                File.Delete(includeTextBox.Text + "\\" + textBox_UploadFile.Text);

                drawVideoList();
            }
        }
开发者ID:BECKLESPINAX,项目名称:YouTube-Uploader,代码行数:20,代码来源:MainForm.cs

示例7: Remove

 public void Remove(Video video)
 {
     YouTubeRequestSettings settings = new YouTubeRequestSettings("zohaan", "AI39si49oz87UsNqVvW32H5Ve3eJkrdPnctL0Q8kfbpGoqBpowKskuoYSC9iW_6_EVlxzXUpa0oPjZgHTYtXrEfTShULt3d1Dw", "[email protected]", "6528yayla");
     YouTubeRequest request = new YouTubeRequest(settings);
     request.Delete(video);
 }
开发者ID:voyl,项目名称:myprojects,代码行数:6,代码来源:Form1.cs


注:本文中的YouTubeRequest.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。