예제 #1
0
        public void SubscriptionFeedConstructorTest()
        {
            Uri              uriBase  = null; // TODO: Initialize to an appropriate value
            IService         iService = null; // TODO: Initialize to an appropriate value
            SubscriptionFeed target   = new SubscriptionFeed(uriBase, iService);

            Assert.IsNotNull(target);
        }
예제 #2
0
        public void CreateFeedEntryTest()
        {
            Uri               uriBase  = null;                                    // TODO: Initialize to an appropriate value
            IService          iService = null;                                    // TODO: Initialize to an appropriate value
            SubscriptionFeed  target   = new SubscriptionFeed(uriBase, iService); // TODO: Initialize to an appropriate value
            SubscriptionEntry expected = target.CreateFeedEntry() as SubscriptionEntry;

            Assert.IsNotNull(expected);
        }
예제 #3
0
        public static void updateSubscriptions()
        {
            subUpdate++;
            Log <Youtube> .Debug("Update subscriptions tries = {0} - subscriptions.Count - {1}", subUpdate, Youtube.subscriptions.Count);

            if (Youtube.subscriptions.Count == 0 || subUpdate % 20 == 0)
            {
                Youtube.subscriptions.Clear();

                string       feedUrl = "http://gdata.youtube.com/feeds/api/users/default/subscriptions";
                YouTubeQuery query   = new YouTubeQuery(feedUrl);
                Log <Youtube> .Debug("feedUrl for subscriptions: {0}", feedUrl);

                SubscriptionFeed subFeed = null;
                string           url     = "http://www.youtube.com/user/{0}";
                try
                {
                    subFeed = service.GetSubscriptions(query);
                    if (subFeed.Entries.Count > 0)
                    {
                        foreach (SubscriptionEntry entry in subFeed.Entries)
                        {
                            YouTubeSubscriptionItem subscription =
                                new YouTubeSubscriptionItem(entry.UserName, String.Format(url, entry.UserName), entry.Title.Text);
                            Youtube.subscriptions.Add(subscription);
                        }
                    }
                    Log <Youtube> .Debug("Finished updating subscriptions");
                }
                catch (Exception e)
                {
                    Log <Youtube> .Error("Error getting subscriptions - {0}", e.Message);

                    Log <Youtube> .Debug(e.StackTrace);
                }
            }
        }