Esempio n. 1
0
        /// <summary>
        /// 初始化分类表
        /// </summary>
        /// <param name="LocalClassList">本地的分类表,本参数预留给以后扩展</param>
        public virtual void InitClassList(List <MaxcmsClassItem> LocalClassList = null)
        {
            MaxcmsRequestOptions requestOptions = new MaxcmsRequestOptions(ServerUrl, MaxcmsAccess.list);
            MaxcmsHttp           http           = new MaxcmsHttp(requestOptions);

            if (http.isComplete)
            {
                var ClassItem = new MaxcmsParser(http.XmlDoc).Rss.type;
                if (ClassItem != null)
                {
                    ServerClassList = ClassItem as List <MaxcmsClassItem>;
                }
                if (LocalClassList == null)
                {
                    return;
                }
                for (int i = 0; i < ServerClassList.Count; i++)
                {
                    for (int j = 0; j < LocalClassList.Count; j++)
                    {
                        if (ServerClassList[i].ID == LocalClassList[j].BindID)
                        {
                            ServerClassList[i].BindID = LocalClassList[j].ID;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 采集视频列表
        /// </summary>
        /// <param name="maxcmsRequestOptions"></param>
        /// <param name="AutoAllCollect"></param>
        public virtual void VideoListCollect(MaxcmsRequestOptions requestOptions, bool AutoAllCollect = false)
        {
            MaxcmsHttp http = new MaxcmsHttp(requestOptions);

            if (http.isComplete)
            {
                MaxcmsRssList VideoLists = new MaxcmsParser(http.XmlDoc).Rss.list;
                string        idstring   = "";
                VideoLists.ListVideo.ForEach(x => idstring += "," + x.ToString());
                VideoInfoCollect(new MaxcmsRequestOptions(ServerUrl, MaxcmsAccess.videolist)
                {
                    ids = idstring.TrimStart(new char[] { ',' })
                });
                if (AutoAllCollect)
                {
                    var page = VideoLists.page + 1;
                    if (VideoLists.page > VideoLists.pagecount)
                    {
                        return;
                    }
                    requestOptions.page = page.ToString();
                    VideoListCollect(requestOptions, AutoAllCollect);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 视频采集(原始方法)
        /// </summary>
        /// <param name="requestOptions"></param>
        /// <param name="AutoAllCollect"></param>
        public virtual void VideoInfoCollect(MaxcmsRequestOptions requestOptions, bool AutoAllCollect = false)
        {
            requestOptions.access = MaxcmsAccess.videolist;
            MaxcmsHttp http = new MaxcmsHttp(requestOptions);

            if (http.isComplete)
            {
                var Rss = new MaxcmsParser(http.XmlDoc).Rss;
                if (Rss != null)
                {
                    Rss.list.ListVideo.ForEach(x =>
                    {
                        if (OnComplet != null)
                        {
                            VideoInfo n = x as VideoInfo;
                            OnComplet(ServerName, n);
                        }
                    });
                    if (AutoAllCollect)
                    {
                        var page = Rss.list.page + 1;
                        if (page > Rss.list.pagecount)
                        {
                            return;
                        }
                        requestOptions.page = page.ToString();
                        VideoInfoCollect(requestOptions, AutoAllCollect);
                    }
                }
            }
        }