Exemplo n.º 1
0
        public List <ArtMovie> GetVideoPage(int page)
        {
            List <ArtMovie> HegreVideos = new List <ArtMovie>();

            HtmlAgilityPack.HtmlDocument doc = hw.Load("http://hegre-art.com/films?films_page=" + page.ToString());

            var nodes = doc.DocumentNode.SelectNodes("//div[@class='item']");

            if (nodes == null)
            {
                return(HegreVideos);
            }
            foreach (var item in nodes)
            {
                var title       = item.SelectSingleNode("./div/a").Attributes["title"].Value.ToString().Trim();
                var link        = "http://www.hegre-art.com" + item.SelectSingleNode("./div/a").Attributes["href"].Value.ToString().Trim();
                var coverPicUrl = item.SelectSingleNode(".//div[@class='cover-links']/a[1]").Attributes["href"].Value.ToString().Trim();
                var boardPicUrl = item.SelectSingleNode(".//div[@class='cover-links']/a[2]").Attributes["href"].Value.ToString().Trim();


                ArtMovie m = new ArtMovie()
                {
                    Title      = title,
                    Url        = link,
                    Type       = "Videos",
                    CoverLink  = coverPicUrl,
                    CoverLink2 = boardPicUrl
                };

                if (this.IsDownloadCoverPicture)
                {
                    if (this.cp == null)
                    {
                        this.cp = new CoverProcessor("VideoHegreCovers");
                    }
                    m.CoverFile = cp.save(coverPicUrl, title + ".jpg");
                }
                if (this.IsDownloadExtraPicture)
                {
                    if (this.cp == null)
                    {
                        this.cp = new CoverProcessor("VideoHegreCovers");
                    }
                    m.CoverFile2 = cp.save(boardPicUrl, title + "_Board.jpg");
                }
                OnCompleteOneItem(m);
                HegreVideos.Add(m);
            }
            return(HegreVideos);
        }
Exemplo n.º 2
0
        /// <summary>
        /// show detail
        /// </summary>
        /// <param name="movie">if this param is null ,the show the currentindex Movie,else show the param movie</param>
        private void SetShowBox(ArtMovie movie)
        {
            try
            {
                if (movie == null)
                {
                    this.trackBar1.Maximum     = AllList.Count;
                    this.trackBar1.Minimum     = 1;
                    this.trackBar1.Value       = currentIndex + 1;
                    this.lbl_ViewProgress.Text = (currentIndex + 1) + "/" + AllList.Count;

                    var m = this.AllList[currentIndex];
                    this.lbl_desc.Text  = m.Description;
                    this.lbl_title.Text = m.Title;
                    this.lbl_type.Text  = m.Type;
                    if (!string.IsNullOrEmpty(m.CoverFile))
                    {
                        this.pictureBox1.Image = Image.FromFile(m.CoverFile);
                        this.pictureBox1.Tag   = m.CoverFile;
                    }
                }
                else
                {
                    this.trackBar1.Maximum     = AllList.Count;
                    this.trackBar1.Minimum     = 1;
                    this.trackBar1.Value       = AllList.Count;
                    this.lbl_ViewProgress.Text = this.trackBar1.Value + "/" + (AllList.Count + 1);
                    var m = movie;
                    this.lbl_desc.Text  = m.Description;
                    this.lbl_title.Text = m.Title;
                    this.lbl_type.Text  = m.Type;
                    if (!string.IsNullOrEmpty(m.CoverFile))
                    {
                        this.pictureBox1.Image = Image.FromFile(m.CoverFile);
                        this.pictureBox1.Tag   = m.CoverFile;
                    }
                }
            }
            catch (Exception err)
            {
            }
        }
Exemplo n.º 3
0
        public List <ArtMovie> GetAllUpdate(int p)
        {
            var html = wc.DownloadString("http://www.x-art.com/index.php?show=galleries&pref=items&page=" + p + "&catname=all&order=recent");

            string[]      sep      = new string[] { "<!--------------------------------------- ITEM -->", "<!--------------------------------------- finItem -->" };
            var           itemHtml = html.Split(sep, StringSplitOptions.RemoveEmptyEntries);
            List <string> item12   = new List <string>();

            for (int i = 0; i < itemHtml.Length; i++)
            {
                itemHtml[i] = itemHtml[i].Replace("\\n", "");
                itemHtml[i] = itemHtml[i].Replace("\\", "");
                itemHtml[i] = itemHtml[i].Trim();
                if (itemHtml[i] != "")
                {
                    item12.Add(itemHtml[i]);
                }
            }

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            List <ArtMovie> list             = new List <ArtMovie>();

            for (int i = 1; i < item12.Count - 1; i++)
            {
                doc.LoadHtml(item12[i]);

                var title = doc.DocumentNode.SelectSingleNode("//h1").InnerText;
                //var desc = item.SelectSingleNode(".//p").InnerText;

                var    descNullable = doc.DocumentNode.SelectSingleNode("//p");
                string desc         = "";
                if (descNullable != null)
                {
                    desc = descNullable.InnerText;
                }
                var linker = doc.DocumentNode.SelectSingleNode("//a").Attributes["href"].Value;
                var image  = doc.DocumentNode.SelectSingleNode("//img").Attributes[0].Value;
                System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("http://.*?jpg");
                var matches = reg.Matches(image);

                if (matches.Count > 0)
                {
                    image = matches[0].ToString();
                }
                var publishDate = doc.DocumentNode.SelectSingleNode("//h2").InnerText.Trim();
                var tpe         = doc.DocumentNode.SelectSingleNode("//h2[1]").InnerText.Trim();

                ArtMovie m = new ArtMovie()
                {
                    Title       = title,
                    Url         = linker,
                    Description = desc,
                    CoverLink   = image,
                    PublishDate = publishDate,
                    Type        = tpe
                };

                if (this._isNeedDownloadCover)
                {
                    if (this.cp == null)
                    {
                        this.cp = new CoverProcessor("Covers");
                    }
                    m.CoverFile = cp.save(image, title + ".jpg");
                }
                OnCompleteOneItem(m);
                list.Add(m);
            }
            return(list);
        }
Exemplo n.º 4
0
        public List <ArtMovie> GetPicturePage(int page)
        {
            List <ArtMovie> HegreGalleries = new List <ArtMovie>();

            HtmlAgilityPack.HtmlDocument doc = hw.Load("http://www.hegre-art.com/galleries?galleries_page=" + page.ToString());

            var nodes = doc.DocumentNode.SelectNodes("//div[@class='item']");

            if (nodes == null)
            {
                return(HegreGalleries);
            }
            foreach (var item in nodes)
            {
                var title = item.SelectSingleNode(".//h4").InnerText.Trim();
                title = title.Substring(title.IndexOf("\t\t\t\t\t\t")).Trim();
                string date;
                try
                {
                    date = item.SelectSingleNode(".//h4/small").InnerText.Trim();
                }
                catch
                {
                    date = "";
                }
                string link;
                try
                {
                    link = "http://www.hegre-art.com" + item.SelectSingleNode("./div/a").Attributes["href"].Value.ToString().Trim();
                }
                catch (Exception)
                {
                    link = "";
                }
                string coverPicURL;
                try
                {
                    coverPicURL = item.SelectSingleNode(".//div[@class='cover-links']/a[1]").Attributes["href"].Value.ToString().Trim();
                }
                catch
                {
                    coverPicURL = "";
                }
                string boardPicURL;
                try
                {
                    boardPicURL = item.SelectSingleNode(".//div[@class='cover-links']/a[2]").Attributes["href"].Value.ToString().Trim();
                }
                catch
                {
                    boardPicURL = "";
                }

                ArtMovie m = new ArtMovie()
                {
                    Title      = title,
                    Url        = link,
                    Type       = "Images",
                    CoverLink  = coverPicURL,
                    CoverLink2 = boardPicURL
                };

                if (this.IsDownloadCoverPicture)
                {
                    if (this.cp == null)
                    {
                        this.cp = new CoverProcessor("HegreCovers");
                    }
                    m.CoverFile = cp.save(coverPicURL, title + ".jpg");
                }
                if (this.IsDownloadExtraPicture)
                {
                    if (this.cp == null)
                    {
                        this.cp = new CoverProcessor("HegreCovers");
                    }
                    m.CoverFile2 = cp.save(boardPicURL, title + "_Board.jpg");
                }
                OnCompleteOneItem(m);
                HegreGalleries.Add(m);
            }
            return(HegreGalleries);
        }