Ejemplo n.º 1
0
        public static void ProcessLang(LiveVideoNode video)
        {
            video.Language = new Dictionary <string, LiveChannelLanguageNode>(AppSettingCache.LanguageNum);
            var cnode = new LiveChannelLanguageNode();

            cnode.ChannelName = video.ChannelName;
            cnode.Mark        = ListUtils <LiveVideoNode> .SetMark(video);

            cnode.Introduction = video.BKInfo.Introduction;
            video.Language[CustomArray.LanguageArray[0]] = cnode;
            if (AppSettingCache.Instance["LanauageTW"] == "1")
            {
                var node = new TraditionLiveChannelNode(cnode);
                //var node = new LiveChannelLanguageNode();
                //node.ChannelName = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].ChannelName);
                //node.Mark = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].Mark);
                //node.Introduction = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].Introduction);
                video.Language[CustomArray.LanguageArray[1]] = node;
            }
            if (AppSettingCache.Instance["LanauageEN"] == "2")
            {
                var node = new LiveChannelLanguageNode();
                node.ChannelName  = video.Main.NameEng;
                node.Mark         = "unknow";
                node.Introduction = video.BKInfo.IntroductionEng;
                video.Language[CustomArray.LanguageArray[2]] = node;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 建立以节目预告名称为索引的字典
        /// </summary>
        private static List <IndexNode> CreateNewNode(LiveVideoNode video, string builder)
        {
            var flag = video.Flags.FormatListToStr(SplitArray.Line, 16);
            var list = new List <IndexNode>(video.Items.Count + 1);

            list.Add(AddNameVideo(video, builder, flag));
            foreach (var parade in video.Items)
            {
                IndexNode node         = new IndexNode();
                var       indexnames   = new List <KeyValuePair <string, string> >(5);
                var       paradename   = new KeyValuePair <string, string>(LiveEpgNode.ParadeName, parade.Language[CustomArray.LanguageArray[0]].Title);
                var       paradecnname = new KeyValuePair <string, string>(LiveEpgNode.ParadeCnName, string.Format("{0}{1}", parade.Language[CustomArray.LanguageArray[0]].Title, SplitArray.IndexCnName));
                var       flags        = new KeyValuePair <string, string>(LiveEpgNode.Flags, flag);
                var       pindex       = new KeyValuePair <string, string>(LiveEpgNode.PlatformIndex, string.Format("{0}{1}", builder, SplitArray.IndexFlag));
                var       fbcode       = new KeyValuePair <string, string>(LiveEpgNode.ForbiddenCode, string.Format("{0},{1}", string.Join(",", ForbiddenAreaCache.Instance.ForbiddenNames.Except(video.ForbiddenAreas).ToArray()), SplitArray.IndexFlag));
                indexnames.Add(paradename);
                indexnames.Add(paradecnname);
                indexnames.Add(flags);
                indexnames.Add(pindex);
                indexnames.Add(fbcode);

                List <KeyValuePair <string, string> > indexvalues = new List <KeyValuePair <string, string> >(5);
                KeyValuePair <string, string>         vid         = new KeyValuePair <string, string>(LiveEpgNode.IndexValue, parade.ID.ToString());
                KeyValuePair <string, string>         paradeid    = new KeyValuePair <string, string>(LiveEpgNode.ParadeId, parade.ID.ToString());
                KeyValuePair <string, string>         vipflag     = new KeyValuePair <string, string>(LiveEpgNode.VipFlag, video.Main.VipFlag.ToString());
                var tabletype = new KeyValuePair <string, string>(LiveEpgNode.TableType, video.Main.TableType.ToString());
                var group     = new KeyValuePair <string, string>(LiveEpgNode.IsGroup, video.IsGroup ? "1" : "0");
                indexvalues.Add(vid);
                indexvalues.Add(paradeid);
                indexvalues.Add(vipflag);
                indexvalues.Add(tabletype);
                indexvalues.Add(group);

                List <KeyValuePair <string, int> > indexnumerices  = new List <KeyValuePair <string, int> >(3);
                KeyValuePair <string, int>         bitrate         = new KeyValuePair <string, int>(LiveEpgNode.BitrateRange, video.Main.BitRate);
                KeyValuePair <string, int>         hight           = new KeyValuePair <string, int>(LiveEpgNode.HightRange, video.Main.VideoHeight);
                KeyValuePair <string, int>         width           = new KeyValuePair <string, int>(LiveEpgNode.WidthRange, video.Main.VideoWidth);
                KeyValuePair <string, int>         paradebegintime = new KeyValuePair <string, int>(LiveEpgNode.ParadeBeginTime, video.Main.VideoWidth);
                indexnumerices.Add(bitrate);
                indexnumerices.Add(hight);
                indexnumerices.Add(width);

                var indexlongs = new List <KeyValuePair <string, long> >(1);
                KeyValuePair <string, long> begintime = new KeyValuePair <string, long>(LiveEpgNode.ParadeBeginTime, parade.StartTime.Ticks);
                indexlongs.Add(begintime);

                node.IndexNames     = indexnames;
                node.IndexValues    = indexvalues;
                node.IndexNumerices = indexnumerices;
                node.IndexLongs     = indexlongs;
                list.Add(node);
            }
            return(list);
        }
Ejemplo n.º 3
0
        public static void DeleteVideo(LiveVideoNode video, IndexBase index)
        {
            var terms = new List <Term>(video.Items.Count + 1);

            terms.Add(new Term(LiveEpgNode.ChannelId, video.Main.ChannelID.ToString()));
            foreach (var parade in video.Items)
            {
                terms.Add(new Term(LiveEpgNode.ParadeId, parade.ID.ToString()));
            }
            index.DeleteDocument(terms.ToArray());
        }
Ejemplo n.º 4
0
        public void Process(LiveVideoNode video)
        {
            bool hasFlat = false;

            video.PlatForms = new List <AuthNode>();
            var platformids = video.Main.PlatformIDs.Split(SplitArray.DHArray, StringSplitOptions.RemoveEmptyEntries);

            foreach (AuthNode plat in _plats)
            {
                if (!plat.IsVisable)                              //判断该平台是否显示隐藏频道
                {
                    if (!video.Main.IsVisible)
                    {
                        continue;
                    }
                }
                if (!string.IsNullOrEmpty(plat.NotContainsNames))  //判断该平台应过滤的频道名称
                {
                    string[] names  = plat.NotContainsNames.Split(SplitArray.DHArray, StringSplitOptions.RemoveEmptyEntries);
                    bool     result = false;
                    foreach (string name in names)
                    {
                        result = result || video.Main.Name.ToLower().Contains(name.ToLower());
                    }
                    if (result)
                    {
                        continue;
                    }
                }
                if (platformids.Contains(plat.PlatformId))
                {
                    hasFlat = true;
                    if (!video.PlatForms.Contains(plat))
                    {
                        video.PlatForms.Add(plat);
                    }
                    _dic[VideoNodeKeyArray.Instance.FindKey(plat.PlatformName, 0, plat.Licence)].Add(video);
                    foreach (var type in video.Types)
                    {
                        _dic[VideoNodeKeyArray.Instance.FindKey(plat.PlatformName, type, plat.Licence)].Add(video);
                    }
                    FormateImage(plat, video);
                    FormateChannelName(plat, video);
                }
            }
            if (!hasFlat)                                        //不属于任何平台的频道
            {
                _dic[VideoNodeKeyArray.Instance.FindKey(AuthNode.NoPlatFormName, 0, AuthNode.NoPlatFormLicence)].Add(video);
                FormateImage(video);
                FormateChannelName(video);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 输出频道预告列表
        /// </summary>
        private string CreateParades(LiveVideoNode video, IEnumerable <ChannelLiveItemsNode> parades, LiveFilter filter)
        {
            var root = new XElement("v",
                                    new XElement("vid", video.Main.ChannelID),
                                    new XElement("title", video.Language[filter.lang].ChannelName),
                                    new XElement("parade-date", filter.date.ToString("yyyy-MM-dd"))
                                    );
            var paradelist = new XElement("parade_list");

            paradelist.Add(from parade in parades select VideoResponseUtils.LiveListParade(parade, filter));
            root.Add(paradelist);
            return(root.ToString(SaveOptions.DisableFormatting));
        }
Ejemplo n.º 6
0
        public static void InsertVideo(LiveVideoNode video, IndexBase index)
        {
            var builder = new StringBuilder();

            foreach (var authnode in video.PlatForms)
            {
                builder.Append(VideoNodeKeyArray.Instance.Items[VideoNodeKeyArray.Instance.FindKey(authnode.PlatformName, 0, authnode.Licence)]);
                builder.Append(SplitArray.DH);
            }
            if (builder.Length < 2)
            {
                return;
            }
            var nodes = CreateNewNode(video, builder.ToString());

            index.InsertIndex(nodes);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 建立以频道名称为索引的字典
        /// </summary>
        private static IndexNode AddNameVideo(LiveVideoNode video, string builder, string flag)
        {
            IndexNode node       = new IndexNode();
            var       indexnames = new List <KeyValuePair <string, string> >(5);
            var       name       = new KeyValuePair <string, string>(LiveEpgNode.Name, video.ChannelName);
            var       cnname     = new KeyValuePair <string, string>(LiveEpgNode.CnName, string.Format("{0}{1}", video.ChannelName, SplitArray.IndexCnName));
            var       flags      = new KeyValuePair <string, string>(LiveEpgNode.Flags, flag);
            var       pindex     = new KeyValuePair <string, string>(LiveEpgNode.PlatformIndex, string.Format("{0}{1}", builder, SplitArray.IndexFlag));
            var       fbcode     = new KeyValuePair <string, string>(LiveEpgNode.ForbiddenCode, string.Format("{0},{1}", string.Join(",", ForbiddenAreaCache.Instance.ForbiddenNames.Except(video.ForbiddenAreas).ToArray()), SplitArray.IndexFlag));

            indexnames.Add(name);
            indexnames.Add(cnname);
            indexnames.Add(flags);
            indexnames.Add(pindex);
            indexnames.Add(fbcode);

            List <KeyValuePair <string, string> > indexvalues = new List <KeyValuePair <string, string> >(5);
            KeyValuePair <string, string>         vid         = new KeyValuePair <string, string>(LiveEpgNode.IndexValue, video.Main.ChannelID.ToString());
            KeyValuePair <string, string>         channelid   = new KeyValuePair <string, string>(LiveEpgNode.ChannelId, video.Main.ChannelID.ToString());
            KeyValuePair <string, string>         vipflag     = new KeyValuePair <string, string>(LiveEpgNode.VipFlag, video.Main.VipFlag.ToString());
            var tabletype = new KeyValuePair <string, string>(LiveEpgNode.TableType, video.Main.TableType.ToString());
            var group     = new KeyValuePair <string, string>(LiveEpgNode.IsGroup, video.IsGroup ? "1" : "0");

            indexvalues.Add(vid);
            indexvalues.Add(channelid);
            indexvalues.Add(vipflag);
            indexvalues.Add(tabletype);
            indexvalues.Add(group);

            List <KeyValuePair <string, int> > indexnumerices = new List <KeyValuePair <string, int> >(3);
            KeyValuePair <string, int>         bitrate        = new KeyValuePair <string, int>(LiveEpgNode.BitrateRange, video.Main.BitRate);
            KeyValuePair <string, int>         hight          = new KeyValuePair <string, int>(LiveEpgNode.HightRange, video.Main.VideoHeight);
            KeyValuePair <string, int>         width          = new KeyValuePair <string, int>(LiveEpgNode.WidthRange, video.Main.VideoWidth);

            indexnumerices.Add(bitrate);
            indexnumerices.Add(hight);
            indexnumerices.Add(width);

            node.IndexNames     = indexnames;
            node.IndexValues    = indexvalues;
            node.IndexNumerices = indexnumerices;
            return(node);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 直播节目单带节目介绍输出
        /// </summary>
        public static XElement CustomLiveListRes(LiveVideoNode video, ExFilterBase filter, int type, bool isEx)
        {
            var      res      = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight);
            var      flags    = video.Flags.FormatListToStr(SplitArray.Line);
            XElement playlink = null;

            if (filter.ver < 2)
            {
                playlink = new XElement("playlink", BoxUtils.GetXmlCData(video.Main.PlayLink));
            }
            else
            {
                playlink = CreateLivePlayLinkVer2(video.Main.ChannelID, filter, isEx);
            }
            var v = new XElement("v",
                                 new XElement("vid", video.Main.ChannelID),
                                 playlink,
                                 new XElement("title", video.Language[filter.lang].ChannelName),
                                 new XElement("type", type),
                                 new XElement("imgurl", video.ResImage),
                                 new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)),
                                 new XElement("note", ""),
                                 new XElement("mark", video.BKInfo.Score),
                                 new XElement("hot", ImplUtils.ConvertHot(video.Hot)),
                                 new XElement("pv", video.PV),
                                 new XElement("bitrate", video.Main.BitRate),
                                 new XElement("resolution", res),
                                 new XElement("flag", flags),
                                 new XElement("content", BoxUtils.GetXmlCData(video.Language[filter.lang].Introduction)),
                                 new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"))
                                 );

            if (filter.nowplay)
            {
                var flag = false;
                for (var i = 0; i < video.Items.Count; i++)
                {
                    if (video.Items[i].StartTime > DateTime.Now)
                    {
                        if (i != 0)
                        {
                            v.Add(new XElement("nowplay",
                                               new XAttribute("begin_time", video.Items[i - 1].StartTime.TimeOfDay.ToString()),
                                               video.Items[i - 1].Language[filter.lang].Title)
                                  );
                        }
                        v.Add(new XElement("willplay",
                                           new XAttribute("begin_time", video.Items[i].StartTime.TimeOfDay.ToString()),
                                           video.Items[i].Language[filter.lang].Title)
                              );
                        flag = true;
                        break;
                    }
                }
                if (!flag && video.Items.Count > 0 && video.Items[video.Items.Count - 1].StartTime.Date.Equals(DateTime.Now.Date))
                {
                    v.Add(new XElement("nowplay",
                                       new XAttribute("begin_time", video.Items[video.Items.Count - 1].StartTime.TimeOfDay.ToString()),
                                       video.Items[video.Items.Count - 1].Language[filter.lang].Title)
                          );
                }
            }
            return(v);
        }