Beispiel #1
0
 private void GetVideo_Click(object sender, RoutedEventArgs e)
 {
     DownloadList(new List <YoutubeEntry>(1)
     {
         YoutubeEntry.Create(_youtubeUrl.Uri)
     });
 }
        public void AddChild(YoutubeEntry video)
        {
            EntryThumbnailControl ctrl = new EntryThumbnailControl();

            ((IQueryUIObject)ctrl).LinkClicked += new DelegateLinkClicked(FeedControl_LinkClicked);

            ctrl.Inject(new SimpleFactory((RawYoutubeType)video));
            flowLayoutPanel1.Controls.Add(ctrl);
        }
 public override RawYoutubeType DoQuery()
 {
     YoutubeEntry empty = new YoutubeEntry(null);
     return (RawYoutubeType)empty.FromJson(
             YoutubeWeb.CallApiMethod(
                 YoutubeWeb.WebMethod.GET,
                 this,
                 null, false, YoutubeWeb.Data.Empty));
     //---
 }
Beispiel #4
0
        private void Browser_LoadCompleted(object sender, NavigationEventArgs e)
        {
            Url.Text = e.Uri.ToString();
            MixpanelTrack("Navigated", new { Url = e.Uri.ToString(), Guid = _settings.ApplicationConfiguration.Guid });
            _youtubeUrl = YoutubeUrl.Create(e.Uri);
            var doc = Browser.Document as IHTMLDocument3;;

            if (doc == null)
            {
                return;
            }
            var html = doc.documentElement.outerHTML;

            _youtubeEntry = YoutubeEntry.Create(e.Uri, html);
            Loading();
        }
Beispiel #5
0
        private static Profile upgradeXmlProfile(XmlNode a_profil, Profile a_profileObj)
        {
            XmlNodeList t_YTchannelsNodes = a_profil.SelectNodes("./YoutubeSetting/Channel");

            foreach (XmlNode t_channelNode in t_YTchannelsNodes)
            {
                try {
                    YoutubeEntry t_YTEntry = new YoutubeEntry();
                    t_YTEntry.Name      = (t_channelNode.SelectSingleNode("./Name")).InnerText;
                    t_YTEntry.Link      = (t_channelNode.SelectSingleNode("./Link")).InnerText;
                    t_YTEntry.Image     = t_channelNode.SelectSingleNode("./Image").InnerText;
                    t_YTEntry.ProfileID = a_profileObj.Id;

                    a_profileObj.YoutubeChannels.Add(t_YTEntry);
                } catch (Exception e) { }
            }

            XmlNodeList t_subredditsNodes = a_profil.SelectNodes("./RedditSetting/SubReddit");

            foreach (XmlNode t_SubRedditNode in t_subredditsNodes)
            {
                try {
                    RedditEntry t_RedditEntry = new RedditEntry();
                    t_RedditEntry.Name      = (t_SubRedditNode.SelectSingleNode("./Name")).InnerText;
                    t_RedditEntry.Link      = (t_SubRedditNode.SelectSingleNode("./Link")).InnerText;
                    t_RedditEntry.ProfileID = a_profileObj.Id;

                    a_profileObj.SubReddits.Add(t_RedditEntry);
                } catch (Exception e) { }
            }

            XmlNodeList t_TwitchChannelNodes = a_profil.SelectNodes("./TwitchSetting/Channel");

            foreach (XmlNode t_Node in t_TwitchChannelNodes)
            {
                try {
                    TwitchEntry t_TwitchEntry = new TwitchEntry();
                    t_TwitchEntry.Link      = t_Node.SelectSingleNode("./Link").InnerText;
                    t_TwitchEntry.Image     = t_Node.SelectSingleNode("./Image").InnerText;
                    t_TwitchEntry.ProfileID = a_profileObj.Id;

                    a_profileObj.TwitchLives.Add(t_TwitchEntry);
                } catch (Exception e) { }
            }

            return(a_profileObj);
        }
 public bool FillDownloadLists(DownloadLists lists)
 {
     try {
         lists.Entries.Clear();
         var listsEntry = GetDownloadLists() ?? new DownloadEntry();
         if (listsEntry.List != null && listsEntry.List.Count > 0)
         {
             foreach (var itemList in listsEntry.List)
             {
                 var youtubeEntries = new List <YoutubeEntry>();
                 var mediaType      = itemList.MediaType;
                 Uri uri;
                 var youtubeListEntry =
                     YoutubeEntry.Create(Uri.TryCreate(itemList.Url, UriKind.Absolute, out uri) ? uri : null);
                 youtubeListEntry.Title = itemList.Title;
                 SetExecutionStatus(youtubeListEntry, itemList);
                 youtubeListEntry.ThumbnailUrl = itemList.ThumbnailUrl;
                 foreach (var item in itemList.List)
                 {
                     var youtubeEntry = YoutubeEntry.Create(new Uri(item.Url), youtubeListEntry);
                     youtubeEntry.ThumbnailUrl = item.ThumbnailUrl;
                     youtubeEntry.Title        = item.Title;
                     SetExecutionStatus(youtubeEntry, item);
                     youtubeEntries.Add(youtubeEntry);
                 }
                 if (youtubeEntries.Count > 0)
                 {
                     lists.SoftAdd(youtubeEntries, mediaType);
                 }
             }
         }
         return(true);
     }
     catch {
         return(false);
     }
 }
        public void Inject(IFactory factory)
        {
            _video = (YoutubeEntry)factory[0];

            int duration = 0;
            int.TryParse((string)_video.MediaGroup.Duration, out duration);

            TimeSpan tmp = new TimeSpan(0, 0, duration);

            label1.Text = (tmp).ToString(@"d\.hh\:mm\:ss");
            linkLabel1.Text = (string)_video.Title;
            if (_video.Statistics.ViewCount == null)
            {
                label2.Text = "?";
            }
            else
            {
                label2.Text = _video.Statistics.ViewCount.ToString() + " views";
            }
            linkLabel2.Text = (string)_video.Author[0].Name;

            _currentImageIdx = 0;
            AskPhoto(0);
        }
 public YoutubeVideoInPlaylist(string videoId, YoutubeUserPlaylist playlist, YoutubeEntry raw)
     : base(videoId, raw)
 {
     _playlist = playlist;
 }
Beispiel #9
0
 private void GetList_Click(object sender, RoutedEventArgs e)
 {
     YoutubeEntry.Create(_youtubeUrl.Uri).GetEntries(DownloadList);
 }
 public YoutubeVideo(string videoId, YoutubeEntry raw)
     : base(videoId, raw)
 {
 }
Beispiel #11
0
        public static void saveProfile(List <YoutubeChannel> a_yts, List <TwitchLive> a_twitchs, List <SubReddit> a_reddits, string a_ProfileName, Profile a_ProfileActu)
        {
            Profile t_profile = new Profile();

            t_profile.Name = a_ProfileName;

            foreach (YoutubeChannel t_yts in a_yts)
            {
                try {
                    if (t_yts.ChannelLink == "https://www.youtube.com/feeds/videos.xml?user=NAME")
                    {
                        continue;
                    }
                    YoutubeEntry t_YTEntry = new YoutubeEntry();
                    t_YTEntry.Id        = t_yts.id;
                    t_YTEntry.Name      = t_yts.ChannelName;
                    t_YTEntry.Link      = t_yts.ChannelLink;
                    t_YTEntry.Image     = t_yts.ChannelImageLink;
                    t_YTEntry.ProfileID = a_ProfileActu.Id;

                    t_profile.YoutubeChannels.Add(t_YTEntry);
                } catch (Exception e) { }
            }


            foreach (SubReddit t_reddits in a_reddits)
            {
                try {
                    if (t_reddits.SubRedditLink == "https://www.reddit.com/r/NAME/.rss")
                    {
                        continue;
                    }
                    RedditEntry t_RedditEntry = new RedditEntry();
                    t_RedditEntry.Id        = t_reddits.id;
                    t_RedditEntry.Name      = t_reddits.SubRedditName;
                    t_RedditEntry.Link      = t_reddits.SubRedditLink;
                    t_RedditEntry.ProfileID = a_ProfileActu.Id;

                    t_profile.SubReddits.Add(t_RedditEntry);
                } catch (Exception e) { }
            }

            foreach (TwitchLive t_twitchs in a_twitchs)
            {
                try {
                    if (t_twitchs.Link == null)
                    {
                        continue;
                    }
                    TwitchEntry t_TwitchEntry = new TwitchEntry();
                    t_TwitchEntry.Id        = t_twitchs.id;
                    t_TwitchEntry.Link      = t_twitchs.Link;
                    t_TwitchEntry.Image     = t_twitchs.Thumbnail.UriSource.ToString();
                    t_TwitchEntry.ProfileID = a_ProfileActu.Id;

                    t_profile.TwitchLives.Add(t_TwitchEntry);
                } catch (Exception e) { }
            }

            saveProfile(t_profile, a_ProfileActu);
        }