Ejemplo n.º 1
0
 /// <summary>
 /// 点播节目请求参数处理
 /// </summary>
 public static VideoPars FormatVideoPars(ListFilter filter)
 {
     var vp = new VideoPars();
     if (filter.ver <= 1)
     {
         if (!string.IsNullOrEmpty(filter.tag))
         {
             var tags = filter.tag.FormatStrToArrayEmpty(SplitArray.LineArray);
             var dimensiontags = new List<string>(tags.Length);
             for (int i = 0; i < tags.Length; i++)
             {
                 var childetags = tags[i].FormatStrToArray(SplitArray.DHArray);
                 if (i == 0 && childetags.Length > 0)
                 {
                     dimensiontags.AddEnumerator(childetags.Select(v => VideoUtils.FormatStrArray(v.Length + 8, v, ":", CustomArray.CatalogDimension)));
                 }
                 else if (i == 1 && childetags.Length > 0)
                 {
                     dimensiontags.AddEnumerator(childetags.Select(v => VideoUtils.FormatStrArray(v.Length + 8, v, ":", CustomArray.AreaDimension)));
                 }
                 else if (i == 2 && childetags.Length > 0)
                 {
                     dimensiontags.AddEnumerator(childetags.Select(v => VideoUtils.FormatStrArray(v.Length + 8, v, ":", CustomArray.YearDimension)));
                 }
                 else if (i == 3 && childetags.Length > 0)
                 {
                     dimensiontags.AddEnumerator(childetags.Select(v => VideoUtils.FormatStrArray(v.Length + 8, v, ":", CustomArray.ActDimension)));
                 }
                 else if (i == 4 && childetags.Length > 0)
                 {
                     dimensiontags.AddEnumerator(childetags.Select(v => VideoUtils.FormatStrArray(v.Length + 12, v, ":", CustomArray.DirectorDimension)));
                 }
             }
             if (dimensiontags.Count > 0 && filter.order == "s")
             {
                 vp.SortTag = dimensiontags[0];
                 dimensiontags.RemoveAt(0);
             }
             vp.Tags = dimensiontags;
         }
     }
     else
     {
         if (!string.IsNullOrEmpty(filter.ntags))
         {
             var ntags = filter.ntags.FormatStrToArray(SplitArray.LineArray);
             if (ntags.Length > 0 && filter.order == "s")
             {
                 vp.SortTag = ntags[0];
             }
             vp.Tags = ntags;
         }
     }
     if (!string.IsNullOrEmpty(filter.flag))
     {
         vp.Flags = filter.flag.FormatStrToArray(SplitArray.LineArray);
     }
     if (filter.conlen == 0)
     {
         if (filter.ver <= 1)
             vp.ResponseFun = VideoResponseUtils.CustomListRes;
         else
             vp.ResponseFun = VideoResponseUtils.CustomListResVer2;
     }
     else
     {
         if (filter.ver <= 1)
             vp.ResponseFun = VideoResponseUtils.ConLenListRes;
         else
             vp.ResponseFun = VideoResponseUtils.ConLenListResVer2;
     }
     if (filter.forbidden)
     {
         filter.forbidden = VideoNodeKeyArray.Instance.Forbidden[new VideoNodeKey(filter.platform, 0, filter.auth)];
         if (filter.forbidden)
         {
             if (ForbiddenAreaCache.Instance.Items.ContainsKey(filter.fbcode))
             {
                 vp.ForbiddenName = ForbiddenAreaCache.Instance.Items[filter.fbcode].ForbiddenAreaName;
             }
             else
             {
                 filter.forbidden = false;
             }
         }
     }
     return vp;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// LuceneNet搜索请求参数处理
 /// </summary>
 public static VideoPars FormateSearchVideoPars(ExFilterBase filter)
 {
     var vp = new VideoPars();
     if (filter.conlen == 0)
     {
         if (filter.ver <= 1)
             vp.ResponseFun = VideoResponseUtils.CustomListRes;
         else
             vp.ResponseFun = VideoResponseUtils.CustomListResVer2;
     }
     else
     {
         if (filter.ver <= 1)
             vp.ResponseFun = VideoResponseUtils.ConLenListRes;
         else
             vp.ResponseFun = VideoResponseUtils.ConLenListResVer2;
     }
     return vp;
     //var vp = new VideoPars();
     //if (filter.conlen == 0)
     //    vp.ResponseFun = VideoResponseUtils.CustomListRes;
     //else
     //    vp.ResponseFun = VideoResponseUtils.ConLenListRes;
     //return vp;
 }
Ejemplo n.º 3
0
 public static VideoPars FormatListByTags(ListFilter filter)
 {
     var vp = new VideoPars();
     var ntags = filter.ntags.FormatStrToArray(SplitArray.LineArray);
     if (ntags.Length > 0 )
     {
         vp.SortTag = ntags[0];
     }
     vp.Tags = ntags.Skip(1);
     if (!string.IsNullOrEmpty(filter.flag))
     {
         vp.Flags = filter.flag.FormatStrToArray(SplitArray.LineArray);
     }
     if (filter.conlen == 0)
     {
         vp.ResponseFun = VideoResponseUtils.CustomListResVer2;
     }
     else
     {
         vp.ResponseFun = VideoResponseUtils.ConLenListResVer2;
     }
     if (filter.forbidden)
     {
         filter.forbidden = VideoNodeKeyArray.Instance.Forbidden[new VideoNodeKey(filter.platform, 0, filter.auth)];
         if (filter.forbidden)
         {
             if (ForbiddenAreaCache.Instance.Items.ContainsKey(filter.fbcode))
             {
                 vp.ForbiddenName = ForbiddenAreaCache.Instance.Items[filter.fbcode].ForbiddenAreaName;
             }
             else
             {
                 filter.forbidden = false;
             }
         }
     }
     return vp;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 直播搜索请求参数处理
 /// </summary>
 public static VideoPars FormatLiveSearchVideoPars(LiveSearchFilter filter)
 {
     var vp = new VideoPars();
     if (!string.IsNullOrEmpty(filter.flag))
     {
         vp.Flags = filter.flag.FormatStrToArray(SplitArray.LineArray);
     }
     if (filter.forbidden)
     {
         filter.forbidden = VideoNodeKeyArray.Instance.Forbidden[new VideoNodeKey(filter.platform, 0, filter.auth)];
         if (filter.forbidden)
         {
             if (ForbiddenAreaCache.Instance.Items.ContainsKey(filter.fbcode))
             {
                 vp.ForbiddenName = ForbiddenAreaCache.Instance.Items[filter.fbcode].ForbiddenAreaName;
             }
             else
             {
                 filter.forbidden = false;
             }
         }
     }
     return vp;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 搜索请求参数处理
 /// </summary>
 public static VideoPars FormatSearchVideoPars(ListFilter filter)
 {
     VideoPars vp = new VideoPars();
     if (!string.IsNullOrEmpty(filter.flag))
     {
         vp.Flags = filter.flag.FormatStrToArray(SplitArray.LineArray);
     }
     if (filter.conlen == 0)
         vp.ResponseFun = VideoResponseUtils.CustomListRes;
     else
         vp.ResponseFun = VideoResponseUtils.ConLenListRes;
     if (filter.forbidden)
     {
         filter.forbidden = VideoNodeKeyArray.Instance.Forbidden[new VideoNodeKey(filter.platform, 0, filter.auth)];
         if (filter.forbidden)
         {
             if (ForbiddenAreaCache.Instance.Items.ContainsKey(filter.fbcode))
             {
                 vp.ForbiddenName = ForbiddenAreaCache.Instance.Items[filter.fbcode].ForbiddenAreaName;
             }
             else
             {
                 filter.forbidden = false;
             }
         }
     }
     return vp;
 }
Ejemplo n.º 6
0
        public static int PageList <T>(this IEnumerable <T> source, LiveFilter filter, VideoPars pars, XElement root, bool isEx) where T : LiveVideoNode
        {
            var index = (filter.s - 1) * filter.c;
            var max   = index + filter.c;
            int num   = 0;

            using (IEnumerator <T> enumerator = source.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (index <= num && num < max)
                    {
                        root.Add(VideoResponseUtils.CustomLiveListRes(enumerator.Current, filter, filter.type, isEx));
                    }
                    num++;
                }
            }
            return(num);
        }
Ejemplo n.º 7
0
        public static int PageList(this IEnumerable <int> source, ExFilterBase filter, VideoPars pars, XElement root, bool isEx)
        {
            var index = (filter.s - 1) * filter.c;
            var max   = index + filter.c;
            int num   = 0;

            using (var enumerator = source.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (index <= num && num < max)
                    {
                        root.Add(pars.ResponseFun(ListCache.Instance.Dictionary[enumerator.Current], filter, isEx));
                    }
                    num++;
                }
            }
            return(num);
        }
Ejemplo n.º 8
0
        public static int PageList <T>(this IEnumerable <T> source, ExFilterBase filter, VideoPars pars, XElement root, bool isEx) where T : VideoNode
        {
            var index = (filter.s - 1) * filter.c;
            var max   = index + filter.c;
            int num   = 0;

            using (IEnumerator <T> enumerator = source.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (index <= num && num < max)
                    {
                        root.Add(pars.ResponseFun(enumerator.Current, filter, isEx));
                    }
                    num++;
                }
            }
            return(num);
        }