Пример #1
0
        /// <summary>
        /// 分享新视频
        /// </summary>
        /// <param name="model">新视频模型</param>
        public void NewVideo(NewVideoModel model)
        {
            ShareThread st = null;

            VideoShareProvider.ParseHtml(model.RawUrl, ref st);
            string identify = DateTime.Now.Ticks.ToString();

            //如果评论为空则用视频默认标题
            string subject = string.IsNullOrEmpty(model.Comment) ? st.Subject : model.Comment;

            string finalSubject = "<a href='##' onclick=\"playVideo('" + identify + "')\" >" + subject + "</a>";

            //视频内容html
            string content = "<div class='video' id='prev_" + identify + "' style='background-image: url(" + st.ThumbnailUrl + ");'><a onclick=\"playVideo('" + identify + "')\" href='###'>播放</a></div>";

            content += "<div class='blogPicOri' id='disp_" + identify + "' style='visibility: visible; display: none; '><p><cite><a onclick=\"stopVideo('" + identify + "')\" title='收起' href='###'>收起</a></cite><cite class='MIB_line_l'>|</cite><cite class='MIB_line_l'>|</cite></p>";

            //播放器脚本
            content += "<embed id='JSONP_167HAG6ED_9' height='356' allowscriptaccess='always' style='visibility: visible;' pluginspage='http://get.adobe.com/cn/flashplayer/' flashvars='playMovie=true&amp;auto=1&amp;adss=0' width='380' allowfullscreen='true' quality='hight' src='" + st.PlayUrl + "' type='application/x-shockwave-flash' wmode='transparent'></div>";

            NewFeedModel fmodel = new NewFeedModel()
            {
                Sharer = model.Sharer, Type = FeedType.NewVideo, Subject = finalSubject, Content = content
            };
            BlogService         bservice     = new BlogService();
            ShareThreadService  shareservice = new ShareThreadService();
            NewShareThreadModel sharemodel   = new NewShareThreadModel()
            {
                Body = st.Body, PlayUrl = st.PlayUrl, RawUrl = model.RawUrl, ShareTime = DateTime.Now, Source = "博客", Subject = st.Subject, ThumbnailUrl = st.ThumbnailUrl
            };

            shareservice.CreateShareThread(sharemodel);
            bservice.CreateFeed(fmodel);
        }
Пример #2
0
        public void CreateShareThread(NewVideoModel model, string url, string source, string title)
        {
            ShareThread st = null;

            VideoShareProvider.ParseHtml(model.RawUrl, ref st);
            string subject  = string.Empty;
            string toDelete = " - 视频 - 优酷视频 - 在线观看";

            if (string.IsNullOrEmpty(title))
            {
                if (st.Subject.IndexOf(toDelete) >= 0)
                {
                    subject = st.Subject.Substring(0, st.Subject.IndexOf(toDelete));//并不是每一个网站都使用此过滤标记,暂时使用
                }
                else
                {
                    subject = st.Subject;
                }
            }
            else
            {
                subject = title;
            }
            ShareThreadService  mservice = new ShareThreadService();
            NewShareThreadModel newmodel = new NewShareThreadModel()
            {
                Body = st.Body, PlayUrl = st.PlayUrl, RawUrl = url, ShareTime = DateTime.Now, Subject = subject, ThumbnailUrl = st.ThumbnailUrl, Source = source
            };

            this.CreateShareThread(newmodel);
        }
Пример #3
0
        public void CreateShareThread(NewVideoModel model, string url, string source)
        {
            ShareThread st = null;

            VideoShareProvider.ParseHtml(model.RawUrl, ref st);
            ShareThreadService  mservice = new ShareThreadService();
            NewShareThreadModel newmodel = new NewShareThreadModel()
            {
                Body = st.Body, PlayUrl = st.PlayUrl, RawUrl = url, ShareTime = DateTime.Now, Subject = st.Subject, ThumbnailUrl = st.ThumbnailUrl, Source = source
            };

            this.CreateShareThread(newmodel);
        }
Пример #4
0
        /// <summary>
        /// 创建分享视频
        /// </summary>
        /// <param name="model">新建分享视频模型</param>
        public void CreateShareThread(NewShareThreadModel model)
        {
            IRepository <ShareThread> rep = Factory.Factory <IRepository <ShareThread> > .GetConcrete <ShareThread>();

            try
            {
                //public ShareThread(string rawUrl,string playUrl,MediaType mtype,string subject,string body,string thumbnailUrl)
                rep.Add(new ShareThread(model.RawUrl, model.PlayUrl, MediaType.Video, model.Subject, model.Body, model.ThumbnailUrl, DateTime.Now, model.Source));
                rep.PersistAll();
            }
            catch {
            }
        }