Beispiel #1
0
        public static string GetMovieDramaUrl(MovieUrlKuaib b, Class cls)
        {
            if (b == null)
            {
                return("");
            }

            MovieInfo movie = MovieInfoView.GetModelByID(b.MovieID.ToS());

            string result = "";


            string sitrurl = "/Movie/";


            result = string.Format("{0}{1}/{2}/Kuaib/{3}{4}",
                                   sitrurl,
                                   cls.ClassForder,
                                   TitleFilter(movie.Title.Replace("/", "_")),
                                   b.Id,
                                   BasePage.SystemSetting.ExtName
                                   );
            result = Regex.Replace(result, "[/]{2,}", "/");
            result = result.Replace(":", "_");
            result = result.Replace(">", "");
            result = result.Replace("<", "");
            result = result.Replace("*", "");
            result = result.Replace("?", "");
            result = result.Replace("|", "_");
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 内容页
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Class"></param>
        protected void Content(string Name, string Class)
        {
            MovieInfo mv = MovieInfoView.Find(string.Format("StandardTitle=N'{0}' and ClassName=N'{1}'", Name, Class));

            Response.Clear();
            Response.Write(CreateContentPage(mv, MovieInfoView.GetClass(mv)));
        }
Beispiel #3
0
        /// <summary>
        /// 从source文件中分析剧集
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public List <Drama> CollectDramas(string source, int Movieid)
        {
            MovieInfo mv = MovieInfoView.GetModelByID(Movieid.ToS());

            var result = new List <Drama>();

            source = source.UrlDecode().AsciiToNative();

            List <string> tmp = new List <string>();
            Match         m   = new Regex("((bdhd://)|(qvod://)).*?((.rmvb)|(.rm)|(.avi)|(.mp4)|(.asf)|(.wmv))+").Match(source);

            while (m.Success)
            {
                string str = m.Groups["0"].Value;
                tmp.Add(str);
                m = m.NextMatch();
            }

            foreach (string str in tmp)
            {
                try
                {
                    result.Add(new Drama()
                    {
                        Title = str.Split('|')[2].GetMatchGroup("[0-9]+").Groups[0].Value.IsNull(str.Split('|')[2].ToLower().Replace(".rmvb", "").Replace(".rm", "").Replace(".avi", "").Replace(".mp4", "").Replace(".asf", "").Replace(".wmv", "").Replace(" ", "").Replace(".", "")),
                        Url   = str,
                        Type  = str.StartsWith("bdhd") ? "baidu" : "qvod"
                    });
                }
                catch { }
            }


            return(result);
        }
Beispiel #4
0
        /// <summary>
        /// 百度
        /// </summary>
        /// <param name="id"></param>
        protected void Baidu(int id)
        {
            MovieUrlBaidu b = MovieUrlBaiduView.GetModelByID(id.ToS());

            Response.Clear();
            Response.Write(CreateDramapage(b, MovieInfoView.GetClass(b)));
        }
Beispiel #5
0
        /// <summary>
        /// 单集列表
        /// </summary>
        /// <param name="id"></param>
        protected void Drama(int id)
        {
            MovieDrama d = MovieDramaView.GetModelByID(id.ToS());

            Response.Clear();
            Response.Write(CreateDramapage(d, MovieInfoView.GetClass(d)));
        }
Beispiel #6
0
        /// <summary>
        /// 获取演员列表
        /// </summary>
        /// <param name="top"></param>
        /// <param name="m_where"></param>
        /// <param name="templatestring"></param>
        /// <returns></returns>
        public static string getactorlist(string cutstring, string m_where, string top, string templatestring)
        {
            StringBuilder sb      = new StringBuilder();
            var           movies  = MovieInfoView.GetModelList(m_where);
            List <string> results = new List <string>();

            var actors = movies.GroupBy(p => p.Actors).OrderByDescending(p => p.Count()).Take(top.ToInt32(10));

            foreach (var actor in actors)
            {
                string[] acts = actor.Key.Split('/', ':', ',');
                foreach (string str in acts)
                {
                    results.Add(str);
                }
            }

            //分组处理最终结果
            var al_result = results.GroupBy(p => p.ToString()).OrderByDescending(p => p.Count());

            foreach (var str in al_result)
            {
                string tmp = templatestring;
                tmp = tmp.Replace("{name}", str.Key.ToS());
                tmp = tmp.Replace("{fname}", str.Key.ToS().CutString(cutstring.ToInt32(100)));
                sb.AppendLine(tmp);
            }
            return(sb.ToS());
        }
Beispiel #7
0
        /// <summary>
        /// 快播
        /// </summary>
        /// <param name="id"></param>
        protected void Kuaib(int id)
        {
            MovieUrlKuaib k = MovieUrlKuaibView.GetModelByID(id.ToS());

            Response.Clear();
            Response.Write(CreateDramapage(k, MovieInfoView.GetClass(k)));
        }
Beispiel #8
0
        protected void LoadInfo()
        {
            ddl_Class.DataSource     = NewsAction.NewsClass.Where(p => p.ModelID == 6).ToList();
            ddl_Class.DataTextField  = "ClassName";
            ddl_Class.DataValueField = "ID";
            ddl_Class.DataBind();

            ddl_Class.SelectedValue = cls.ToS();

            int id = WS.RequestInt("id");

            MovieInfo mi = MovieInfoView.GetModelByID(id.ToS());

            txt_Title.Text           = mi.Title;
            txt_Director.Text        = mi.Director;
            txt_Actors.Text          = mi.Actors;
            txt_Tags.Text            = mi.Tags;
            txt_Location.Text        = mi.Location;
            txt_PublicYear.Text      = mi.PublicYear;
            txt_Intro.Text           = mi.Intro;
            FCKeditor1.Value         = mi.Info;
            chk_IsMovie.Checked      = mi.IsMove;
            img_Movieface.ImageUrl   = mi.FaceImage;
            rbl_Status.SelectedValue = mi.Status.ToS();
            chk_Enable.Checked       = mi.Enable;
        }
Beispiel #9
0
        /// <summary>
        /// 生成电影页面
        /// </summary>
        /// <param name="id"></param>
        protected void CreateMoviePage(int id)
        {
            MovieInfo m = MovieInfoView.GetModelByID(id.ToS());
            if (m.Id > 0)
            {
                Class c = MovieInfoView.GetClass(m);
                Voodoo.Basement.CreatePage.CreateContentPage(m, c);

                var Dramas = MovieDramaView.GetModelList(string.Format("movieid={0}", id));
                var Baidus = MovieUrlBaiduView.GetModelList(string.Format("movieid={0}", id));
                var Kuaibos = MovieUrlKuaibView.GetModelList(string.Format("movieid={0}", id));

                foreach (var d in Dramas)
                {
                    Voodoo.Basement.CreatePage.CreateDramapage(d, c);
                }
                foreach (var d in Baidus)
                {
                    Voodoo.Basement.CreatePage.CreateDramapage(d, c);
                }
                foreach (var d in Kuaibos)
                {
                    Voodoo.Basement.CreatePage.CreateDramapage(d, c);
                }

                Response.Write("电影" + m.Title + "完成");
            }
            else
            {
                Response.Write("不存在");
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var chapters = BookChapterView.GetModelList("enable=1 order by UpdateTime desc", 500);
            var items    = new List <Voodoo.other.SEO.RssItem>();

            foreach (var chapter in chapters)
            {
                items.Add(new Voodoo.other.SEO.RssItem()
                {
                    Title       = chapter.BookTitle + "-" + chapter.Title,
                    PutTime     = chapter.UpdateTime,
                    Link        = SystemSetting.SiteUrl + GetBookChapterUrl(chapter, BookView.GetClass(chapter)),
                    Description = chapter.BookTitle + "Update to chapter:" + chapter.Title + ", from chanel" + chapter.ClassName
                });
            }

            var movies = MovieInfoView.GetModelList();

            foreach (var m in movies)
            {
                items.Add(new Voodoo.other.SEO.RssItem()
                {
                    Title       = m.Title,
                    PutTime     = m.UpdateTime,
                    Link        = SystemSetting.SiteUrl + GetMovieUrl(m, MovieInfoView.GetClass(m)),// GetBookChapterUrl(chapter, BookView.GetClass(chapter)),
                    Description = m.Title + "Update to :" + m.LastDramaTitle + ", from chanel" + m.ClassName + ", Intro:" + m.Intro
                });
            }

            Response.Clear();
            Voodoo.other.SEO.Rss.GetRss(items, SystemSetting.SiteName, SystemSetting.SiteUrl, SystemSetting.Description, SystemSetting.Copyright);
        }
Beispiel #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int       id = WS.RequestInt("id");
         MovieInfo mv = MovieInfoView.GetModelByID(id.ToS());
         txt_BookTitle.Text = mv.Title;
     }
 }
Beispiel #12
0
 /// <summary>
 /// 生成搜索剧集
 /// </summary>
 /// <param name="id"></param>
 protected void CreateDramaPage(long id)
 {
     MovieDrama d = MovieDramaView.GetModelByID(id.ToS());
     if (d.Id > 0)
     {
         Class c = MovieInfoView.GetClass(d);
         Voodoo.Basement.CreatePage.CreateDramapage(d, c);
         Response.Write(string.Format("《{0}》-剧集列表《{1}》完成", d.MovieTitle, d.Title));
     }
 }
Beispiel #13
0
        protected void SaveDramas(int MovieID, List <Drama> dramas)
        {
            if (dramas.Count == 0)
            {
                return;
            }

            MovieInfo mv = MovieInfoView.GetModelByID(MovieID.ToS());

            List <MovieUrlBaidu> baidus  = new List <MovieUrlBaidu>();
            List <MovieUrlKuaib> kuaibos = new List <MovieUrlKuaib>();

            if (dramas[0].Type == "baidu")
            {
                baidus = MovieUrlBaiduView.GetModelList(string.Format("movieid={0}", MovieID));

                foreach (var drama in dramas)
                {
                    if (baidus.Where(p => p.Title == drama.Title).Count() == 0)
                    {
                        MovieUrlBaidu m = new MovieUrlBaidu();
                        m.Enable     = true;
                        m.MovieID    = mv.Id;
                        m.MovieTitle = mv.Title;
                        m.Title      = drama.Title;
                        m.UpdateTime = DateTime.UtcNow.AddHours(8);
                        m.Url        = drama.Url;
                        MovieUrlBaiduView.Insert(m);
                    }
                }
            }
            else
            {
                kuaibos = MovieUrlKuaibView.GetModelList(string.Format("movieid={0}", MovieID));
                foreach (var drama in dramas)
                {
                    if (kuaibos.Where(p => p.Title == drama.Title).Count() == 0)
                    {
                        MovieUrlKuaib m = new MovieUrlKuaib();
                        m.Enable     = true;
                        m.MovieID    = mv.Id;
                        m.MovieTitle = mv.Title;
                        m.Title      = drama.Title;
                        m.UpdateTime = DateTime.UtcNow.AddHours(8);
                        m.Url        = drama.Url;
                        MovieUrlKuaibView.Insert(m);
                    }
                }
            }
        }
Beispiel #14
0
 /// <summary>
 /// 生成快播页面
 /// </summary>
 /// <param name="id"></param>
 protected void CreateKuaiboPage(long id)
 {
     MovieUrlKuaib k = MovieUrlKuaibView.GetModelByID(id.ToS());
     if (k.Id > 0)
     {
         Class c = MovieInfoView.GetClass(k);
         Voodoo.Basement.CreatePage.CreateDramapage(k, c);
         Response.Write(string.Format("《{0}》-快播剧集《{1}》完成", k.MovieTitle, k.Title));
     }
     else
     {
         Response.Write("不存在");
     }
 }
Beispiel #15
0
 /// <summary>
 /// 生成百度影音剧集
 /// </summary>
 /// <param name="id"></param>
 protected void CreateBaiduPage(long id)
 {
     MovieUrlBaidu b = MovieUrlBaiduView.GetModelByID(id.ToS());
     if (b.Id > 0)
     {
         Class c = MovieInfoView.GetClass(b);
         Voodoo.Basement.CreatePage.CreateDramapage(b, c);
         Response.Write(string.Format("《{0}》-百度影音剧集《{1}》完成", b.MovieTitle, b.Title));
     }
     else
     {
         Response.Write("不存在");
     }
 }
Beispiel #16
0
        /// <summary>
        /// 获取年代列表
        /// </summary>
        /// <param name="m_where"></param>
        /// <param name="top"></param>
        /// <param name="templatestring"></param>
        /// <returns></returns>
        public static string getyearlist(string cutstring, string m_where, string top, string templatestring)
        {
            StringBuilder sb = new StringBuilder();

            var movies = MovieInfoView.GetModelList(m_where);

            var years = movies.GroupBy(p => p.PublicYear).OrderByDescending(p => p.Count()).Take(top.ToInt32(10));

            foreach (var year in years)
            {
                string tmp = templatestring;
                tmp = tmp.Replace("{name}", year.Key.Replace(":", ""));
                tmp = tmp.Replace("{fname}", year.Key.Replace(":", "").CutString(cutstring.ToInt32(100)));
                sb.AppendLine(tmp);
            }

            return(sb.ToS());
        }
Beispiel #17
0
        /// <summary>
        /// Saves changes to the movie instance
        /// </summary>
        public void saveMovie()
        {
            bool isSend = false;

            if (Movie.isValid)
            {
                isSend = Controller.Post(Movie);
            }
            if (isSend)
            {
                MovieInfoView view = new MovieInfoView()
                {
                    DataContext = childViewModel
                };

                childViewModel.Info = "Film o tytule '" + Movie.MovieTitle + "' został zapisany w bazie danych.";
                MovieView.GetInstance().Close();
                view.ShowDialog();
            }
        }
Beispiel #18
0
        /// <summary>
        /// 获取列表页面的页数
        /// </summary>
        /// <param name="id"></param>
        protected void GetClassPageCount(int id)
        {
            Class c = ClassView.GetModelByID(id.ToS());
            TemplateList t = TemplateListView.Find(string.Format("SysModel={0}", c.ModelID.ToS()));

            int pagecount = 0;
            switch (c.ModelID)
            {
                case 1:
                    //新闻
                    pagecount = NewsView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 2:
                    //图片
                    pagecount = ImageAlbumView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 3:
                    //问答
                    pagecount = QuestionView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 4:
                    //小说
                    pagecount = BookView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 5:
                    //分类
                    pagecount = InfoView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                case 6:
                    //影视
                    pagecount = MovieInfoView.Count(string.Format("classid in(select {0} union select id from Class where parentID={0})", id)).GetPageCount(t.ShowRecordCount);
                    break;
                default:
                    pagecount = 0;
                    break;
            }

            Response.Clear();
            Response.Write(pagecount);
        }
Beispiel #19
0
        /// <summary>
        /// 获取电影列表
        /// </summary>
        /// <param name="top">条数</param>
        /// <param name="custitle">标题截取</param>
        /// <param name="m_where">条件语句</param>
        /// <param name="htmlTemp">模板</param>
        /// <returns></returns>
        public static string getmovielist(string top, string custitle, string m_where, string htmlTemp)
        {
            StringBuilder sb = new StringBuilder();

            List <MovieInfo> movies = MovieInfoView.GetModelList(m_where, top.ToInt32());
            var i = 0;

            foreach (MovieInfo m in movies)
            {
                i++;
                string item = htmlTemp;
                item = item.Replace("{url}", BasePage.GetMovieUrl(m, MovieInfoView.GetClass(m)));
                item = item.Replace("{id}", m.Id.ToS());
                item = item.Replace("{authors}", m.Actors);
                item = item.Replace("{classid}", m.ClassID.ToS());
                item = item.Replace("{classname}", m.ClassName);
                item = item.Replace("{director}", m.Director);
                item = item.Replace("{faceimage}", m.FaceImage);
                item = item.Replace("{inserttime}", m.InsertTime.ToString("yyyy-MM-dd"));
                item = item.Replace("{intro}", m.Intro);
                item = item.Replace("{ismovie}", m.IsMove ? "电影" : "电视剧");
                item = item.Replace("{lastdramatitle}", m.LastDramaTitle);
                item = item.Replace("{location}", m.Location);
                item = item.Replace("{publicyear}", m.PublicYear);
                item = item.Replace("{status}", m.Status == 0 ? "更新中" : "完结");
                item = item.Replace("{tags}", m.Tags);
                item = item.Replace("{title}", m.Title);
                item = item.Replace("{ftitle}", m.Title.CutString(custitle.ToInt32()));
                item = item.Replace("{updatetime}", m.UpdateTime.ToString("yyyy-MM-dd"));
                item = item.Replace("{clickcount}", m.ClickCount.ToS());
                //item = item.Replace("{clickcount}", m.ClickCount.ToS());
                item = item.Replace("{replycount}", m.ReplyCount.ToS());
                item = item.Replace("{scoreavg}", m.ScoreAvg.ToS());
                item = item.Replace("{rownum}", i.ToS());
                item = item.Replace("{index}", (i - 1).ToS());
                sb.Append(item);
            }
            return(sb.ToS());
        }
Beispiel #20
0
        protected void btn_createPage_Click(object sender, EventArgs e)
        {
            Class c = ClassView.GetModelByID(cls.ToS());

            string[] ids = WS.RequestString("id").Split(',');
            foreach (string id in ids)
            {
                MovieInfo mv = MovieInfoView.GetModelByID(id);
                CreatePage.CreateContentPage(mv, c);
                var kuaibos = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0}", id));
                var baidus  = MovieUrlBaiduView.GetModelList(string.Format("MovieID={0}", id));
                var dramas  = MovieDramaView.GetModelList(string.Format("MovieID={0}", id));
                foreach (var kuaib in kuaibos)
                {
                    CreatePage.CreateDramapage(kuaib, c);
                }
                foreach (var baidu in baidus)
                {
                    CreatePage.CreateDramapage(baidu, c);
                }
                foreach (var drama in dramas)
                {
                    CreatePage.CreateDramapage(drama, c);
                }
            }

            if (cls > 0)
            {
                try
                {
                    CreatePage.CreateListPage(c, 1);
                }
                catch { }
            }
            CreatePage.GreateIndexPage();
            Js.Jump(url);
        }
Beispiel #21
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int       id = WS.RequestInt("id");
            MovieInfo mi = MovieInfoView.GetModelByID(id.ToS());

            mi.ClassID       = ddl_Class.SelectedItem.Value.ToInt32();
            mi.ClassName     = ddl_Class.SelectedItem.Text;
            mi.Title         = txt_Title.Text;
            mi.Director      = txt_Director.Text;
            mi.Actors        = txt_Actors.Text;
            mi.Tags          = txt_Tags.Text;
            mi.Location      = txt_Location.Text;
            mi.PublicYear    = txt_PublicYear.Text;
            mi.Intro         = txt_Intro.Text;
            mi.IsMove        = chk_IsMovie.Checked;
            mi.Status        = rbl_Status.SelectedValue.ToInt32();
            mi.Enable        = chk_Enable.Checked;
            mi.Info          = FCKeditor1.Value;
            mi.InsertTime    = DateTime.UtcNow.AddHours(8);
            mi.UpdateTime    = DateTime.UtcNow.AddHours(8);
            mi.LastClickTime = DateTime.UtcNow.AddHours(8);

            if (mi.Id > 0)
            {
                //update
                MovieInfoView.Update(mi);
            }
            else
            {
                MovieInfoView.Insert(mi);
            }

            //Deal Book face image
            if (file_Moviefacefile.FileName.IsNullOrEmpty() == false)
            {
                file_Moviefacefile.SaveAs(Server.MapPath("/u/MoviekFace/" + mi.Id + ".jpg"));
                mi.FaceImage = "/u/MoviekFace/" + mi.Id + ".jpg";
                MovieInfoView.Update(mi);
            }

            //Class c=MovieInfoView.GetClass(mi);

            ////Create statis pages
            //CreatePage.CreateContentPage(mi, c);

            //var kuaibos = MovieUrlKuaibView.GetModelList(string.Format("MovieID={0}", mi.Id));
            //var baidus = MovieUrlBaiduView.GetModelList(string.Format("MovieID={0}", mi.Id));
            //var dramas = MovieDramaView.GetModelList(string.Format("MovieID={0}", mi.Id));
            ////foreach (var kuaib in kuaibos)
            //{
            //    CreatePage.CreateDramapage(kuaib, c);
            //}
            //foreach (var baidu in baidus)
            //{
            //    CreatePage.CreateDramapage(baidu, c);
            //}
            //foreach (var drama in dramas)
            //{
            //    CreatePage.CreateDramapage(drama, c);
            //}

            Response.Redirect(url);
        }
Beispiel #22
0
        /// <summary>
        /// 保存影视信息
        /// </summary>
        /// <param name="mv"></param>
        protected void SaveMovie(MovieInfo mv, bool IsSearchRule, string SiteName)
        {
            #region 处理分类
            Class cls = ClassView.Find(string.Format("ClassName=N'{0}'", mv.ClassName));
            if (cls.ID <= 0)
            {
                cls.IsLeafClass = true;
                cls.Alter       = mv.ClassName;
                cls.ClassForder = mv.ClassName;
                cls.ShowInNav   = true;
                cls.ParentID    = 0;
                cls.ClassName   = mv.ClassName;
                cls.ModelID     = 6;

                ClassView.Insert(cls);
            }
            mv.ClassID = cls.ID;
            #endregion

            #region 保存影视
            MovieInfo sysMv = MovieInfoView.Find(string.Format("Title=N'{0}' and ClassName=N'{1}'", mv.Title, mv.ClassName));
            if (sysMv.Id <= 0)
            {
                sysMv            = mv;
                sysMv.ClickCount = 0;
                sysMv.Enable     = true;
                sysMv.InsertTime = DateTime.UtcNow.AddHours(8);
                sysMv.ReplyCount = 0;
                sysMv.ScoreAvg   = 10;
                sysMv.ScoreTime  = 0;//评分次数
                sysMv.Status     = 0;
                sysMv.TjCount    = 0;
                sysMv.UpdateTime = DateTime.UtcNow.AddHours(8);

                MovieInfoView.Insert(sysMv);
            }
            else
            {
                sysMv.BaiduDramas  = mv.BaiduDramas;
                sysMv.KuaiboDramas = mv.KuaiboDramas;
            }
            #endregion

            #region  载封面
            try
            {
                Url.DownFile(sysMv.FaceImage, Server.MapPath(string.Format("~/u/MoviekFace/{0}.jpg", sysMv.Id)));
                sysMv.FaceImage = string.Format("/u/MoviekFace/{0}.jpg", sysMv.Id);
            }
            catch
            {
                sysMv.FaceImage = "/u/MoviekFace/0.jpg";
            }

            MovieInfoView.Update(sysMv);
            #endregion

            #region 保存单集资源
            if (IsSearchRule == false)
            {
                #region  是电影搜索
                foreach (var drama in sysMv.BaiduDramas)
                {
                    var sysDrama = MovieUrlBaiduView.Find(string.Format("MovieID={0} and Title=M'{0}' ", sysMv.Id, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Title = drama.Title;
                        sysDrama.Url   = drama.Url;

                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = sysMv.Id;
                        sysDrama.MovieTitle = sysMv.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);

                        MovieUrlBaiduView.Insert(sysDrama);

                        sysMv.LastDramaTitle = sysDrama.Title;
                        sysMv.LastDramaID    = sysDrama.Id;
                        MovieInfoView.Update(sysMv);

                        CreatePage.CreateDramapage(sysDrama, cls);//生成

                        Response.Write(string.Format("百度影音《{0}》《{1}》保存成功!:-D<br />", sysDrama.MovieTitle, sysDrama.Title));
                    }
                    else
                    {
                        Response.Write(string.Format("已经存在%>_<%<br />"));
                    }
                }

                foreach (var drama in sysMv.KuaiboDramas)
                {
                    var sysDrama = MovieUrlKuaibView.Find(string.Format("MovieID={0} and Title=N'{0}' ", sysMv.Id, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Title = drama.Title;
                        sysDrama.Url   = drama.Url;

                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = sysMv.Id;
                        sysDrama.MovieTitle = sysMv.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);

                        MovieUrlKuaibView.Insert(sysDrama);

                        sysMv.LastDramaTitle = sysDrama.Title;
                        sysMv.LastDramaID    = sysDrama.Id;
                        MovieInfoView.Update(sysMv);

                        CreatePage.CreateDramapage(sysDrama, cls);

                        Response.Write(string.Format("快播《{0}》《{1}》保存成功!:-D<br />", sysDrama.MovieTitle, sysDrama.Title));
                    }
                    else
                    {
                        Response.Write(string.Format("已经存在%>_<%<br />"));
                    }
                }
                #endregion
            }
            else
            {
                //电影搜索不需要保存资源地址 只需要保存 新建剧集和播放页面地址
                #region 快播地址
                foreach (var drama in mv.KuaiboDramas)
                {
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);
                        MovieDramaView.Insert(sysDrama);
                    }

                    var sysUrl = MovieDramaUrlView.Find(string.Format("MovieID={0} and MovieDramaID={1} and SourceSite=N'{2}'", drama.MovieID, drama.Id, SiteName));
                    if (sysUrl.Id <= 0)
                    {
                        sysUrl.Enable          = true;
                        sysUrl.MovieDramaID    = drama.Id;
                        sysUrl.MovieDramaTitle = drama.Title;
                        sysUrl.MovieID         = mv.Id;
                        sysUrl.MovieTitle      = mv.Title;
                        sysUrl.SourceSite      = SiteName;
                        sysUrl.Title           = drama.Title;
                        sysUrl.UpdateTime      = DateTime.UtcNow.AddHours(8);
                        sysUrl.Url             = drama.PlayUrl.IsNull(mv.Url);
                    }
                }
                #endregion

                #region 百度影音

                foreach (var drama in mv.BaiduDramas)
                {
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = DateTime.UtcNow.AddHours(8);
                        MovieDramaView.Insert(sysDrama);
                    }

                    var sysUrl = MovieDramaUrlView.Find(string.Format("MovieID={0} and MovieDramaID={1} and SourceSite=N'{2}'", drama.MovieID, drama.Id, SiteName));
                    if (sysUrl.Id <= 0)
                    {
                        sysUrl.Enable          = true;
                        sysUrl.MovieDramaID    = drama.Id;
                        sysUrl.MovieDramaTitle = drama.Title;
                        sysUrl.MovieID         = mv.Id;
                        sysUrl.MovieTitle      = mv.Title;
                        sysUrl.SourceSite      = SiteName;
                        sysUrl.Title           = drama.Title;
                        sysUrl.UpdateTime      = DateTime.UtcNow.AddHours(8);
                        sysUrl.Url             = drama.PlayUrl.IsNull(mv.Url);
                    }
                }

                #endregion
            }


            #endregion

            #region 生成

            Response.Write(string.Format("生成《{0}》信息页<br />", sysMv.Title));
            CreatePage.CreateContentPage(sysMv, cls);

            Response.Write(string.Format("生成“{0}”分类<br />", cls.ClassName));
            CreatePage.CreateListPage(cls, 1);

            #endregion
        }
Beispiel #23
0
        /// <summary>
        /// 旧的电影采集
        /// </summary>
        protected void OldCollect()
        {
            Response.Buffer = false;


            //打开列表页面
            Response.Write("打开列表页面<br/>");
            string listUrl = "http://kuaib.tv.sohu.com/html/more_list21.htm";

openurl:
            string html_List = Url.GetHtml(listUrl, "utf-8");

            //打开信息页面
            Match m_list = html_List.GetMatchGroup("<img src=\"(?<image>.*?)\" width=\"120\" height=\"165\" alt=\"\" />[\\s\\S]*?<h4><a href=\"(?<url>.*?)\" target=\"_blank\">(?<title>.*?)</a></h4>");

            while (m_list.Success)
            {
                //判断是否存在
                if (MovieInfoView.Exist(string.Format("Title=N'{0}'", m_list.Groups["title"].Value)))
                {
                    m_list = m_list.NextMatch();
                    continue;
                }

                Response.Write("下载封面<br/>");
                //如果不存在,则先下载封面,内容页面是没有封面的
                try
                {
                    Url.DownFile(m_list.Groups["image"].Value, Server.MapPath("~/config/movieface.jpg"));
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message + "<br/>");
                }
                //打开内容页面
                Response.Write("打开内容页面<br/>");
                string html_content = Url.GetHtml(m_list.Groups["url"].Value, "utf-8");
                Match  m_movie      = html_content.GetMatchGroup("<em id='specialID'>《(?<title>.*?)》</em>[\\s\\S]*?<param name='URL' value='(?<url>.*?)'>[\\s\\S]*?<div id=\"introID\">[\\s]*?<p>(?<intro>[\\s\\S]*?)</p>[\\s\\S]*?var VRS_DIRECTOR=\"(?<director>.*?)\";[\\s\\S]*?var VRS_CATEGORY=\"(?<tags>.*?)\";[\\s\\S]*?var VRS_ACTOR=\"(?<actor>.*?)\";[\\s\\S]*?var VRS_AREA=\"(?<location>.*?)\";[\\s\\S]*?var VRS_PLAY_YEAR=\"(?<year>.*?)\";");
                if (!m_movie.Success)
                {
                    Response.Write("!!!!!内容匹配失败<br/>");
                }
                string title    = m_movie.Groups["title"].Value;
                string intro    = m_movie.Groups["intro"].Value;
                string director = m_movie.Groups["director"].Value;
                string actor    = m_movie.Groups["actor"].Value;
                string location = m_movie.Groups["location"].Value;
                string url      = m_movie.Groups["url"].Value;
                string year     = m_movie.Groups["year"].Value;
                string tags     = m_movie.Groups["tags"].Value;

                Response.Write("处理类别:" + location + "<br/>");
                Class cls = ClassView.Find(string.Format("classname=N'{0}'", location));
                if (cls.ID <= 0)
                {
                    cls.Alter         = location;
                    cls.ClassKeywords = location + "在线观看";
                    cls.ClassName     = location;
                    cls.IsLeafClass   = true;
                    cls.ShowInNav     = true;
                    cls.ClassForder   = location;
                    cls.ModelID       = 6;

                    ClassView.Insert(cls);
                }

                MovieInfo mv = new MovieInfo();
                mv.Actors     = actor;
                mv.ClassID    = cls.ID;
                mv.ClassName  = cls.ClassName;
                mv.ClickCount = 0;
                mv.Director   = director;
                mv.Enable     = true;
                mv.InsertTime = DateTime.Now;
                mv.Intro      = intro;
                mv.IsMove     = true;
                mv.Location   = location;
                mv.PublicYear = year;
                mv.ReplyCount = 0;
                mv.ScoreAvg   = 10;
                mv.ScoreTime  = 0;
                mv.Status     = 1;
                mv.Tags       = tags;
                mv.Title      = title;
                mv.TjCount    = 0;
                mv.UpdateTime = DateTime.Now;

                Response.Write("保存:" + title + "<br/>");
                MovieInfoView.Insert(mv);

                //设置封面
                Response.Write("设置封面<br/>");
                mv.FaceImage = string.Format("/u/MoviekFace/{0}.jpg", mv.Id);
                try
                {
                    Voodoo.IO.File.Move(Server.MapPath("~/config/movieface.jpg"), Server.MapPath(mv.FaceImage));
                }
                catch
                {
                    Voodoo.IO.File.Copy(Server.MapPath("~/config/0.jpg"), Server.MapPath(mv.FaceImage));
                }

                MovieInfoView.Update(mv);

                //添加地址
                Response.Write("添加地址:" + url + "<br/>");
                MovieUrlKuaib mk = new MovieUrlKuaib();
                mk.Enable     = true;
                mk.MovieID    = mv.Id;
                mk.MovieTitle = mv.Title;
                mk.Title      = "全集";
                mk.UpdateTime = DateTime.Now;
                mk.Url        = url;
                MovieUrlKuaibView.Insert(mk);

                //生成
                Response.Write("生成<br/>");
                //CreatePage.CreateDramapage(mk,cls);

                //CreatePage.CreateContentPage(mv,cls);

                //CreatePage.CreateListPage(cls,0);

                //CreatePage.GreateIndexPage();

                Response.Write(title + "-完成<br/><br/><br/>");

                m_list = m_list.NextMatch();
            }

            //处理列表下一页

            Match m_next = html_List.GetMatchGroup("<a href='(?<key>[^'/]*?)'>下一页</a>");

            if (m_next.Success)
            {
                listUrl = m_next.Groups["key"].Value.AppendToDomain(listUrl);
                goto openurl;
            }
        }
Beispiel #24
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            movieID = WS.RequestInt("movieid", 0);
            MovieInfo movie = MovieInfoView.GetModelByID(movieID.ToS());

            #region deal
            switch (type)
            {
            case "kuaib":
                var kuaibUrl = MovieUrlKuaibView.GetModelByID(id.ToS());
                kuaibUrl.MovieTitle = movie.Title;
                kuaibUrl.Title      = txt_Title.Text;
                kuaibUrl.Url        = txt_Url.Text;
                kuaibUrl.MovieID    = movie.Id;
                kuaibUrl.UpdateTime = DateTime.Now;
                if (kuaibUrl.Id > 0)
                {
                    MovieUrlKuaibView.Update(kuaibUrl);
                }
                else
                {
                    MovieUrlKuaibView.Insert(kuaibUrl);
                }
                break;

            case "baidu":
                var baiduUrl = MovieUrlBaiduView.GetModelByID(id.ToS());
                baiduUrl.MovieTitle = movie.Title;
                baiduUrl.Title      = txt_Title.Text;
                baiduUrl.Url        = txt_Url.Text;
                baiduUrl.MovieID    = movie.Id;
                baiduUrl.UpdateTime = DateTime.Now;
                if (baiduUrl.Id > 0)
                {
                    MovieUrlBaiduView.Update(baiduUrl);
                }
                else
                {
                    MovieUrlBaiduView.Insert(baiduUrl);
                }
                break;

            case "mag":
                var magUrl = MovieUrlMagView.GetModelByID(id.ToS());
                magUrl.MovieTitle = movie.Title;
                magUrl.Title      = txt_Title.Text;
                magUrl.Url        = txt_Url.Text;
                magUrl.MovieID    = movie.Id;
                magUrl.UpdateTime = DateTime.Now;
                if (magUrl.Id > 0)
                {
                    MovieUrlMagView.Update(magUrl);
                }
                else
                {
                    MovieUrlMagView.Insert(magUrl);
                }
                break;
            }
            #endregion

            Response.Redirect("UrlList.aspx?type=" + type + "&movieid=" + movieID);
        }
Beispiel #25
0
        /// <summary>
        /// 获取保存电影详细信息
        /// </summary>
        /// <param name="rulename">规则名称</param>
        /// <param name="url">地址</param>
        /// <param name="cls">分类名称</param>
        /// <param name="title">标题</param>
        /// <param name="director">导演</param>
        /// <param name="actors">演员</param>
        /// <param name="tags">tag</param>
        /// <param name="location">位置</param>
        /// <param name="publicyear">上映年代</param>
        /// <param name="intro">简介</param>
        /// <param name="image">图片</param>
        protected void GetMovieInfo(string rulename, string url, string cls, string title, string director, string actors, string tags, string location, string publicyear, string intro, string image)
        {
            url = url.UrlDecode();
            MovieRule _r = Rules.Where(p => p.Name == rulename).First();
            MovieRule r  = _r.Clone();

            Class c = new Class();

            string html   = Url.GetHtml(url, r.Encoding);
            Match  m_info = html.GetMatchGroup(r.InfoRule);

            MovieInfo mv = MovieInfoView.Find(string.Format("title=N'{0}'", m_info.Groups["title"].Value));

            if (mv.Id <= 0)
            {
                if (m_info.Success)
                {
                    //开始获取信息
                    mv.Actors     = m_info.Groups["actors"].Value.IsNull(actors).TrimHTML();
                    mv.ClassName  = m_info.Groups["class"].Value.IsNull(cls).IsNull(r.DefaultClass);
                    mv.Director   = m_info.Groups["director"].Value.IsNull(director);
                    mv.Enable     = true;
                    mv.FaceImage  = m_info.Groups["image"].Value.IsNull(image).AppendToDomain(url);
                    mv.Intro      = m_info.Groups["intro"].Value.IsNull(intro).TrimHTML();
                    mv.Location   = m_info.Groups["location"].Value.IsNull(location);
                    mv.PublicYear = m_info.Groups["publicyear"].Value.IsNull(publicyear);
                    mv.Tags       = m_info.Groups["tags"].Value.IsNull(tags);
                    mv.Title      = m_info.Groups["title"].Value.IsNull(title);


                    mv.Info = Regex.Replace(mv.Intro, "<a.*?>", "", RegexOptions.IgnoreCase);
                    mv.Info = Regex.Replace(mv.Intro, "</a>", "", RegexOptions.IgnoreCase);

                    mv.Intro = mv.Info.TrimHTML().CutString(200);

                    mv.ClickCount    = 0;
                    mv.InsertTime    = DateTime.UtcNow.AddHours(8);
                    mv.IsMove        = r.IsMovie;
                    mv.ReplyCount    = 0;
                    mv.ScoreAvg      = 10;
                    mv.ScoreTime     = 0;
                    mv.Status        = 0;
                    mv.TjCount       = 0;
                    mv.DayClick      = 0;
                    mv.WeekClick     = 0;
                    mv.MonthClick    = 0;
                    mv.LastClickTime = DateTime.UtcNow.AddHours(8);
                    mv.UpdateTime    = DateTime.UtcNow.AddHours(8);

                    #region 处理分类
                    c = ClassView.Find(string.Format("ClassName=N'{0}'", mv.ClassName));
                    if (c.ID <= 0)
                    {
                        c.IsLeafClass = true;
                        c.Alter       = mv.ClassName;
                        c.ClassForder = mv.ClassName;
                        c.ShowInNav   = true;
                        c.ParentID    = 0;
                        c.ClassName   = mv.ClassName;
                        c.ModelID     = 6;

                        ClassView.Insert(c);
                    }
                    mv.ClassID = c.ID;
                    #endregion


                    //不存在这个电影就要保存到数据库
                    MovieInfoView.Insert(mv);

                    #region  载封面
                    try
                    {
                        Url.DownFile(mv.FaceImage, Server.MapPath(string.Format("~/u/MoviekFace/{0}.jpg", mv.Id)));
                        mv.FaceImage = string.Format("/u/MoviekFace/{0}.jpg", mv.Id);
                    }
                    catch
                    {
                        mv.FaceImage = "/u/MoviekFace/0.jpg";
                    }
                    MovieInfoView.Update(mv);
                    #endregion
                }
                else
                {
                    throw new Exception("电影信息匹配失败!");
                }
            }
            else
            {
                c = ClassView.GetModelByID(mv.ClassID.ToString());
            }


            mv.BaiduDramas  = new List <MovieUrlBaidu>();
            mv.KuaiboDramas = new List <MovieUrlKuaib>();


            #region 获取快播剧集
            Match m_kuaiboArea = html.GetMatchGroup(r.KuaibAreaRule);
            if (m_kuaiboArea.Success && r.KuaibAreaRule.IsNullOrEmpty() == false)
            {
                string html_kuaiboArea = m_kuaiboArea.Groups[1].Value;

                Match m_kuaibo = html_kuaiboArea.GetMatchGroup(r.KuaibDramaRule);
                while (m_kuaibo.Success)
                {
                    //判断是够存在
                    if (MovieUrlKuaibView.Exist(string.Format("MovieId={0} and Title=N'{1}'", mv.Id, m_kuaibo.Groups["title"].Value)))
                    {
                        m_kuaibo = m_kuaibo.NextMatch();
                        continue;
                    }
                    mv.KuaiboDramas.Add(new MovieUrlKuaib()
                    {
                        MovieID    = mv.Id,
                        Enable     = true,
                        PlayUrl    = m_kuaibo.Groups["playurl"].Value.AppendToDomain(url),
                        MovieTitle = mv.Title,
                        Title      = m_kuaibo.Groups["title"].Value.IsNull("全集"),
                        UpdateTime = DateTime.UtcNow.AddHours(8),
                        Url        = m_kuaibo.Groups["url"].Value
                    });
                    m_kuaibo = m_kuaibo.NextMatch();
                }
            }
            #endregion

            #region 获取百度剧集
            Match m_baiduArea = html.GetMatchGroup(r.BaiduAreaRule);
            if (m_baiduArea.Success && r.BaiduAreaRule.IsNullOrEmpty() == false)
            {
                string html_baiduArea = m_baiduArea.Groups[1].Value;

                Match m_baidu = html_baiduArea.GetMatchGroup(r.BaiduDramaRule);
                while (m_baidu.Success)
                {
                    //判断是够存在
                    if (MovieUrlBaiduView.Exist(string.Format("MovieId={0} and Title=N'{1}'", mv.Id, m_baidu.Groups["title"].Value)))
                    {
                        m_baidu = m_baidu = m_baidu.NextMatch();
                        continue;
                    }
                    mv.BaiduDramas.Add(new MovieUrlBaidu()
                    {
                        MovieID    = mv.Id,
                        Enable     = true,
                        PlayUrl    = m_baidu.Groups["playurl"].Value.AppendToDomain(url),
                        MovieTitle = mv.Title,
                        Title      = m_baidu.Groups["title"].Value.IsNull("全集"),
                        UpdateTime = DateTime.UtcNow.AddHours(8),
                        Url        = m_baidu.Groups["url"].Value
                    });
                    m_baidu = m_baidu = m_baidu.NextMatch();
                }
            }
            #endregion

            #region 如果是搜索系统,则只保存播放地址即可
            if (r.IsSearchRule)
            {
                foreach (var drama in mv.KuaiboDramas)
                {
                    #region 处理剧集
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = drama.UpdateTime;
                        MovieDramaView.Insert(sysDrama);
                    }
                    #endregion

                    #region 处理播放地址
                    var playUrl = MovieDramaUrlView.Find(string.Format("MovieDramaID={0} and Url=N'{1}'", sysDrama.Id, drama.PlayUrl.IsNull(url)));
                    if (playUrl.Id <= 0)
                    {
                        playUrl.Enable          = true;
                        playUrl.MovieDramaID    = sysDrama.Id;
                        playUrl.MovieDramaTitle = sysDrama.Title;
                        playUrl.MovieID         = mv.Id;
                        playUrl.MovieTitle      = mv.Title;
                        playUrl.SourceSite      = r.SiteName;
                        playUrl.Title           = r.SiteName;
                        playUrl.UpdateTime      = DateTime.Now.AddHours(8);
                        playUrl.Url             = drama.PlayUrl.IsNull(url);
                        MovieDramaUrlView.Insert(playUrl);
                    }
                    #endregion
                }

                foreach (var drama in mv.BaiduDramas)
                {
                    #region 处理剧集
                    var sysDrama = MovieDramaView.Find(string.Format("MovieTitle=N'{0}' and Title=N'{1}'", drama.MovieTitle, drama.Title));
                    if (sysDrama.Id <= 0)
                    {
                        sysDrama.Enable     = true;
                        sysDrama.MovieID    = mv.Id;
                        sysDrama.MovieTitle = mv.Title;
                        sysDrama.Title      = drama.Title;
                        sysDrama.UpdateTime = drama.UpdateTime;
                        MovieDramaView.Insert(sysDrama);
                    }
                    #endregion

                    #region 处理播放地址
                    var playUrl = MovieDramaUrlView.Find(string.Format("MovieDramaID={0} and Url=N'{1}'", sysDrama.Id, drama.PlayUrl.IsNull(url)));
                    if (playUrl.Id <= 0)
                    {
                        playUrl.Enable          = true;
                        playUrl.MovieDramaID    = sysDrama.Id;
                        playUrl.MovieDramaTitle = sysDrama.Title;
                        playUrl.MovieID         = mv.Id;
                        playUrl.MovieTitle      = mv.Title;
                        playUrl.SourceSite      = r.SiteName;
                        playUrl.Title           = r.SiteName;
                        playUrl.UpdateTime      = DateTime.Now.AddHours(8);
                        playUrl.Url             = drama.PlayUrl.IsNull(url);
                        MovieDramaUrlView.Insert(playUrl);
                    }
                    #endregion
                }
                if (mv.BaiduDramas.Count > 0)
                {
                    mv.LastDramaTitle = mv.BaiduDramas.Last().Title;
                    mv.UpdateTime     = DateTime.UtcNow.AddHours(8);
                    MovieInfoView.Update(mv);
                }
            }
            #endregion

            #region 处理快播和百度影音
            else
            {
                bool needCreate = false;

                foreach (var drama in mv.KuaiboDramas)
                {
                    if (drama.Url.IsNullOrEmpty() == false)
                    {
                        var sysDrama = MovieUrlKuaibView.Find(string.Format("MovieID={0} and Title=N'{1}'", mv.Id, drama.Title));
                        if (sysDrama.Id <= 0)
                        {
                            MovieUrlKuaibView.Insert(drama);

                            //保存完成 生成
                            //CreatePage.CreateDramapage(drama, c);
                            //needCreate = true;
                        }
                    }
                }

                foreach (var drama in mv.BaiduDramas)
                {
                    if (drama.Url.IsNullOrEmpty() == false)
                    {
                        var sysDrama = MovieUrlBaiduView.Find(string.Format("MovieID={0} and Title=N'{1}'", mv.Id, drama.Title));
                        if (sysDrama.Id <= 0)
                        {
                            MovieUrlBaiduView.Insert(drama);
                            //保存完成 生成
                            //CreatePage.CreateDramapage(drama, c);
                            //needCreate = true;
                        }
                    }
                }
                if (needCreate)
                {
                    //CreatePage.CreateContentPage(mv, c);
                }
                if (mv.BaiduDramas.Count > 0)
                {
                    mv.LastDramaTitle = mv.BaiduDramas.Last().Title;
                    mv.UpdateTime     = DateTime.UtcNow.AddHours(8);
                    MovieInfoView.Update(mv);
                }
            }
            #endregion

            // 完成咯
            Response.Clear();
            Response.Write(JsonConvert.SerializeObject(mv));
        }