/// <summary> /// 点播节目单带节目介绍输出 /// </summary> public static XElement ConLenListRes(VideoNode video, ExFilterBase filter, bool isEx) { var res = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight); var flag = video.Flags.FormatListToStr(SplitArray.Line); var v = new XElement("v", new XElement("vid", video.Main.ChannelID), new XElement("playlink", BoxUtils.GetXmlCData(video.PlayLink)), new XElement("title", video.Language[filter.lang].ChannelName), new XElement("subtitle", video.Language[filter.lang].SubTitle), new XElement("type", video.Type), new XElement("catalog", video.Language[filter.lang].CatalogTags), new XElement("director", video.Language[filter.lang].Directors), new XElement("act", video.Language[filter.lang].Actors), new XElement("year", video.YearTags), new XElement("area", video.Language[filter.lang].AreaTags), new XElement("imgurl", video.ResImage), new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)), new XElement("state", video.State), new XElement("total_state", video.BKInfo.Episode), 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", flag), new XElement("duration", video.Main.TimeLength / 60), new XElement("content", BoxUtils.GetXmlCData(video.Language[filter.lang].Introduction.FormateSubStr(filter.conlen))), new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")) ); return v; }
/// <summary> /// 后端接口XML输出 /// </summary> /// <param name="video"></param> /// <returns></returns> public static XElement ResponseBack(VideoNode video) { var cname = video.Main.Name.Replace("#", " "); var flag = video.Flags.FormatListToStr(SplitArray.Line); var res = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight); var v = new XElement("v", new XElement("vid", video.Main.ChannelID), new XElement("playlink", BoxUtils.GetXmlCData(CreatePlayLink(video))), new XElement("title", cname), new XElement("type", video.Type), new XElement("catalog", video.Language[CustomArray.LanguageArray[0]].CatalogTags), new XElement("director", video.BKInfo.Directors), new XElement("act", video.BKInfo.Actors), new XElement("year", video.YearTags), new XElement("area", video.Language[CustomArray.LanguageArray[0]].AreaTags), new XElement("imgurl", video.ResImage), new XElement("state", video.State), new XElement("note", BoxUtils.GetXmlCData(video.BKInfo.Introduction)), new XElement("mark", video.BKInfo.Score), new XElement("hot", video.BKInfo.Score), new XElement("bitrate", video.Main.BitRate), new XElement("resolution", res), new XElement("flag", flag), new XElement("duration", video.Main.TimeLength / 60), new XElement("online-time", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")), new XElement("last-update-time", video.Main.ModifyTime.ToString("yyyy-MM-dd HH:mm:ss")) ); return v; }
/// <summary> /// 一代播放串 /// </summary> private static void CreateLinkVer1(VideoNode video,DetailFilter filter, XElement xml) { var link = new XElement("video_list", new XAttribute("maxBytes", video.Language[filter.lang].MaxBytes), new XAttribute("maxChars", video.Language[filter.lang].MaxChars), new XAttribute("isNumber", video.IsNumber) ); if (video.ViceChannels == null) throw new ApplicationException("该节目为二代节目,请将参数ver设置为2"); if (video.ViceChannels.Count > 0) { video.ViceChannels.PageDetailVer1(filter, link, xml); xml.Add(new XElement("video_list_page_count", PageUtils.PageCount(video.StateCount, filter.c))); } else { xml.Add(new XElement("countInPage", 1), new XElement("page", 1), new XElement("video_list_page_count", 1) ); link.Add(new XElement("video", new XAttribute("id", video.Main.ChannelID), new XAttribute("title", video.Language[filter.lang].ChannelName), BoxUtils.GetXmlCData(video.PlayLink) )); } xml.Add(link); }
public override bool Equals(object obj) { VideoNode node = obj as VideoNode; if (obj == null) { return(false); } return(Main.ChannelID == node.Main.ChannelID); }
public static void ProcessLang(VideoNode video) { video.Language = new Dictionary<string, ChannelLanguageNode>(AppSettingCache.LanguageNum); video.YearTags = VideoUtils.FormatBoxTag(video.TagsRank, CustomArray.YearDimension, 15); var cnode = new ChannelLanguageNode(); cnode.ChannelName = video.ChannelName; cnode.SubTitle = video.Main.AliasName; cnode.Mark = ListUtils<VideoNode>.SetMark(video); cnode.AreaTags = VideoUtils.FormatBoxTag(video.TagsRank, CustomArray.AreaDimension); cnode.CatalogTags = VideoUtils.FormatBoxTag(video.TagsRank, CustomArray.CatalogDimension); cnode.Actors = video.BKInfo.Actors; cnode.Directors = video.BKInfo.Directors; cnode.Introduction = video.BKInfo.Introduction; video.Language[CustomArray.LanguageArray[0]] = cnode; ListUtils<VideoNode>.SetViceMaxNum(video, CustomArray.LanguageArray[0]); if (AppSettingCache.Instance["LanauageTW"] == "1") { var node = new TraditionChannelNode(cnode); video.Language[CustomArray.LanguageArray[1]] = node; ListUtils<VideoNode>.SetViceMaxNum(video, CustomArray.LanguageArray[1]); //var node = new ChannelLanguageNode(); //node.ChannelName = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].ChannelName); //node.SubTitle = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].SubTitle); //node.Mark = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].Mark); //node.AreaTags = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].AreaTags); //node.CatalogTags = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].CatalogTags); //node.Actors = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].Actors); //node.Directors = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].Directors); //node.Introduction = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].Introduction); //video.Language[CustomArray.LanguageArray[1]] = node; //ListUtils<VideoNode>.SetViceMaxNum(video, CustomArray.LanguageArray[1]); } if (AppSettingCache.Instance["LanauageEN"] == "2") { var node = new ChannelLanguageNode(); node.ChannelName = video.Main.NameEng; node.SubTitle = "unknow"; node.Mark = "unknow"; //node.AreaTags = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].AreaTags); //node.CatalogTags = LanguageUtils.FormatTraditionChinese(video.Language[CustomArray.LanguageArray[0]].CatalogTags); node.Actors = video.BKInfo.ActorsEng; node.Directors = video.BKInfo.DirectorsEng; node.Introduction = video.BKInfo.IntroductionEng; video.Language[CustomArray.LanguageArray[2]] = node; ListUtils<VideoNode>.SetViceMaxNum(video, CustomArray.LanguageArray[2]); } }
public void AddVideo(VideoNode video) { if (video.Main.TableType == 0) { All.Add(video.Main.ChannelID); } else if (video.Main.TableType == 1) { All.Add(video.Main.ChannelID); _virtuals.Add(video.Main.ChannelID); } else { All.Add(video.Main.ChannelID); _group.Add(video.Main.ChannelID); } }
private static string CreatePlayLink(VideoNode video) { var cname = video.Main.Name.Replace("#", " "); StringBuilder sb = new StringBuilder(); if (video.ViceChannels != null && video.ViceChannels.Count > 0) { foreach (ViceNode vice in video.ViceChannels) { var title = vice.Language[CustomArray.LanguageArray[0]].Title.Replace("#", " "); if (sb.Length != 0) sb.AppendFormat("#{0}({1})${2}${3}", cname, title, vice.PlayLink, "ppvod"); else sb.AppendFormat("{0}({1})${2}${3}", cname, title, vice.PlayLink, "ppvod"); } } else sb.AppendFormat("{0}${1}${2}", cname, video.PlayLink, "ppvod"); return sb.ToString(); }
public void Process(VideoNode 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)].AddVideo(video); _dic[VideoNodeKeyArray.Instance.FindKey(plat.PlatformName, video.Type, plat.Licence)].AddVideo(video); FormateImage(plat, video); FormateChannelName(plat, video); } } if (!hasFlat) //不属于任何平台的频道 { _dic[VideoNodeKeyArray.Instance.FindKey(AuthNode.NoPlatFormName, 0, AuthNode.NoPlatFormLicence)].AddVideo(video); FormateImage(video); FormateChannelName(video); } }
public static string ResList(VideoNode video, DetailFilter filter, bool isEx) { var xml = new XElement("v"); var res = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight); var flag = video.Flags.FormatListToStr(SplitArray.Line); xml.Add( new XElement("vid", video.Main.ChannelID), new XElement("title", video.Language[filter.lang].ChannelName), new XElement("subtitle", video.Language[filter.lang].SubTitle), new XElement("type", video.Type), new XElement("catalog", video.Language[filter.lang].CatalogTags), new XElement("director", video.Language[filter.lang].Directors), new XElement("act", video.Language[filter.lang].Actors), new XElement("year", video.YearTags), new XElement("area", video.Language[filter.lang].AreaTags), new XElement("imgurl", video.ResImage), new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)), new XElement("state", video.State), new XElement("total_state", video.BKInfo.Episode), 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", flag), new XElement("duration", video.Main.TimeLength / 60), new XElement("content", BoxUtils.GetXmlCData(video.Language[filter.lang].Introduction)), new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")), new XElement("video_list_count", video.StateCount) ); if (filter.ver <= 1) { CreateLinkVer1(video, filter, xml); } else { CreateLinkVer2(video, filter, xml, isEx); } return xml.ToString(SaveOptions.DisableFormatting); }
private static string SegmentKeyWord(VideoNode video) { var builder = new StringBuilder(50); var segment = new Segment(); var words = segment.DoSegment(video.ChannelName); foreach (var word in words) { if (word == null) continue; builder.AppendFormat("{0}^{1}.0 ", word.Word, (int)Math.Pow(3, word.Rank)); } //if (!string.IsNullOrEmpty(video.Language[CustomArray.LanguageArray[0]].CatalogTags)) //{ // var catalogs = video.Language[CustomArray.LanguageArray[0]].CatalogTags.FormatStrToArray(SplitArray.DHArray); // foreach (var catalog in catalogs) // { // builder.AppendFormat("{0}^{1}.0 ", catalog, 3); // } //} //if(!string.IsNullOrEmpty(video.BKInfo.Actors)) //{ // var acs = video.BKInfo.Actors.FormatStrToArray(SplitArray.DHArray); // foreach (var ac in acs) // { // builder.AppendFormat("{0}^{1}.0 ", ac, 2); // } //} //if(!string.IsNullOrEmpty(video.Language[CustomArray.LanguageArray[0]].AreaTags)) //{ // var areas = video.Language[CustomArray.LanguageArray[0]].AreaTags.FormatStrToArray(SplitArray.DHArray); // foreach (var area in areas) // { // builder.AppendFormat("{0}^{1}.0 ", area, 1); // } //} return builder.ToString(); }
public static void AddVideo(VideoNode video, IndexBase indexBase) { var builder = new StringBuilder(); foreach (var authnode in video.PlatForms) { if (authnode.SearchTypeIndexList.Contains(video.Type)) { builder.Append(VideoNodeKeyArray.Instance.Items[VideoNodeKeyArray.Instance.FindKey(authnode.PlatformName, 0, authnode.Licence)]); builder.Append(SplitArray.DH); } } if (builder.Length < 2) return; var node = new IndexNode(); var indexnames = new List<KeyValuePair<string, string>>(10); var name = new KeyValuePair<string, string>(EpgIndexNode.Name, video.Language[CustomArray.LanguageArray[0]].ChannelName); var cnname = new KeyValuePair<string, string>(EpgIndexNode.CnName, string.Format("{0}{1}", video.Language[CustomArray.LanguageArray[0]].ChannelName, SplitArray.IndexCnName)); var flag = video.Flags.FormatListToStr(SplitArray.Line, 16); var catalog = new KeyValuePair<string, string>(EpgIndexNode.Catalog, string.Format("{0}{1}", video.Language[CustomArray.LanguageArray[0]].CatalogTags, SplitArray.IndexFlag)); var area = new KeyValuePair<string, string>(EpgIndexNode.Area, string.Format("{0}{1}", video.Language[CustomArray.LanguageArray[0]].AreaTags, SplitArray.IndexFlag)); var year = new KeyValuePair<string, string>(EpgIndexNode.Year, string.Format("{0}{1}", video.YearTags, SplitArray.IndexFlag)); var act = new KeyValuePair<string, string>(EpgIndexNode.Act, string.Format("{0}{1}", video.BKInfo.Actors, SplitArray.IndexFlag)); var director = new KeyValuePair<string, string>(EpgIndexNode.Director, string.Format("{0}{1}", video.BKInfo.Directors, SplitArray.IndexFlag)); var flags = new KeyValuePair<string, string>(EpgIndexNode.Flags, flag); var pindex = new KeyValuePair<string, string>(EpgIndexNode.PlatformIndex, string.Format("{0}{1}", builder.Remove(builder.Length - 1, 1), SplitArray.IndexFlag)); var fbcode = new KeyValuePair<string, string>(EpgIndexNode.ForbiddenCode, string.Format("{0},{1}", string.Join(",", ForbiddenAreaCache.Instance.ForbiddenNames.Except(video.ForbiddenAreas).ToArray()), SplitArray.IndexFlag)); indexnames.Add(name); indexnames.Add(cnname); indexnames.Add(catalog); indexnames.Add(area); indexnames.Add(year); indexnames.Add(act); indexnames.Add(director); indexnames.Add(flags); indexnames.Add(pindex); indexnames.Add(fbcode); var indexvalues = new List<KeyValuePair<string, string>>(6); var vid = new KeyValuePair<string, string>(EpgIndexNode.IndexValue, video.Main.ChannelID.ToString()); var vipflag = new KeyValuePair<string, string>(EpgIndexNode.VipFlag, video.Main.VipFlag.ToString()); var tabletype = new KeyValuePair<string, string>(EpgIndexNode.TableType, video.Main.TableType.ToString()); var screen = new KeyValuePair<string, string>(EpgIndexNode.Screen, video.Main.TableType == 1 ? "1" : "0"); var group = new KeyValuePair<string, string>(EpgIndexNode.IsGroup, video.IsGroup ? "1" : "0"); var type = new KeyValuePair<string, string>(EpgIndexNode.Type, video.Type.ToString()); indexvalues.Add(vid); indexvalues.Add(vipflag); indexvalues.Add(tabletype); indexvalues.Add(screen); indexvalues.Add(group); indexvalues.Add(type); var indexnumerices = new List<KeyValuePair<string, int>>(3); var bitrate = new KeyValuePair<string, int>(EpgIndexNode.BitrateRange, video.Main.BitRate); var hight = new KeyValuePair<string, int>(EpgIndexNode.HightRange, video.Main.VideoHeight); var width = new KeyValuePair<string, int>(EpgIndexNode.WidthRange, video.Main.VideoWidth); indexnumerices.Add(bitrate); indexnumerices.Add(hight); indexnumerices.Add(width); node.IndexNames = indexnames; node.IndexValues = indexvalues; node.IndexNumerices = indexnumerices; LuceneNetUtils.AddIndex(node, indexBase); }
private static void CreateLinkVer2(VideoNode video, DetailFilter filter, XElement xml, bool isEx) { var vir = video.Virtuals == null ? 0 : 1; xml.Add(new XElement("virtual", vir)); var first = video; if (vir == 1) //虚拟频道,取第一条子频道 first = ListCache.Instance.Dictionary[video.Groups[0]]; if (first.StateCount <= 1) //不带分集的正常频道 { //var first = ListCache.Instance.Dictionary[video.Groups[0]]; var link = new XElement("video_list2", new XAttribute("maxBytes", first.Language[filter.lang].MaxBytes), new XAttribute("maxChars", first.Language[filter.lang].MaxChars), new XAttribute("isNumber", first.IsNumber) ); xml.Add(new XElement("countInPage", 1), new XElement("page", 1), new XElement("video_list_page_count", 1) ); var p = new XElement("playlink2", new XAttribute("id",first.Main.ChannelID), new XAttribute("title", first.ChannelName), new XAttribute("duration", first.Main.TimeLength) //new XAttribute("start_point", 60.22), //new XAttribute("end_point", 289.22) ); var maxbit = 0; var maxres = string.Empty; IEnumerable<int> groups = first.Groups; if (isEx && first.Groups.Count > 1) { var filters = VideoNodesUtil.FormateTagFilter(filter); groups = first.Groups.Where(v => { var result = true; VideoNode gv = ListCache.Instance.Dictionary[v]; foreach (var f in filters) //过滤不符合的子频道 { result = result && f(gv, filter); } return result; }); } foreach (var g in groups) { VideoNode gv = ListCache.Instance.Dictionary[g]; var res = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight); if (maxbit < gv.Main.BitRate) { maxbit = gv.Main.BitRate; maxres = res; } p.Add(new XElement("source", new XAttribute("mark", gv.Language[filter.lang].Mark), new XAttribute("bitrate", gv.Main.BitRate), new XAttribute("filelength", gv.Main.TimeLength * gv.Main.BitRate * (1024 / 8)), new XAttribute("resolution", res), BoxUtils.GetXmlCData(gv.PlayLink)) ); } link.Add(p); xml.Add(link); if (xml.Element("bitrate") != null) { xml.Element("bitrate").SetValue(maxbit); xml.Element("resolution").SetValue(maxres); } } else { var maxbit = 0; var maxres = string.Empty; List<VideoNode> vices = null; if (isEx && first.Groups.Count > 1) //扩展接口,过滤分组子频道 { var filters = VideoNodesUtil.FormateTagFilter(filter); vices = first.Groups.Where(v => { var result = true; VideoNode gv = ListCache.Instance.Dictionary[v]; var res = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight); if (maxbit < gv.Main.BitRate) //最大码率赋值给主频道 { maxbit = gv.Main.BitRate; maxres = res; } foreach (var f in filters) //过滤不符合的子频道 { result = result && f(gv, filter); } return result; }).Select(v => ListCache.Instance.Dictionary[v]).ToPerfectList(); } else //非扩展接口 { vices = first.Groups.Where(v => { VideoNode gv = ListCache.Instance.Dictionary[v]; var res = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight); if (maxbit < gv.Main.BitRate) { maxbit = gv.Main.BitRate; maxres = res; } return true; }).Select(v => ListCache.Instance.Dictionary[v]).ToPerfectList(); } if (vices.Count < 1) //分组里没有子集 { xml.Add(new XElement("video_list_page_count", 0)); xml.Element("video_list_count").SetValue(0); xml.Element("bitrate").SetValue(0); xml.Element("resolution").SetValue(0); return; } if (xml.Element("bitrate") != null) { xml.Element("bitrate").SetValue(maxbit); xml.Element("resolution").SetValue(maxres); } var link = new XElement("video_list2", new XAttribute("maxBytes", vices[0].Language[filter.lang].MaxBytes), new XAttribute("maxChars", vices[0].Language[filter.lang].MaxChars), new XAttribute("isNumber", vices[0].IsNumber) ); xml.Add(new XElement("video_list_page_count", PageUtils.PageCount(video.StateCount, filter.c))); vices.PageDetailVer2(filter, link, xml, first.StateCount); xml.Add(link); } if (vir == 1) { IEnumerable<int> virtuals = video.Virtuals; if (isEx) { var filters = VideoNodesUtil.FormateTagFilter(filter); virtuals.Where(v => { var result = true; VideoNode gv = ListCache.Instance.Dictionary[v]; foreach (var f in filters) //过滤不符合的子频道 { result = result && f(gv, filter); } return result; }); } var virs = new XElement("virtual_list"); foreach (var virid in virtuals) { VideoNode virnode = ListCache.Instance.Dictionary[virid]; virs.Add(new XElement("virtual", new XAttribute("vid", virid), new XAttribute("title", virnode.ChannelName), new XAttribute("imgurl", virnode.ResImage) )); } xml.Add(virs); } }
public static string ResOnlyset(VideoNode video, DetailFilter filter, bool isEx) { var xml = new XElement("v"); xml.Add( new XElement("vid", video.Main.ChannelID), new XElement("title", video.Language[filter.lang].ChannelName), new XElement("subtitle", video.Language[filter.lang].SubTitle), new XElement("type", video.Type), new XElement("imgurl", video.ResImage), new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)), new XElement("state", video.State), new XElement("total_state", video.BKInfo.Episode), new XElement("mark", video.BKInfo.Score), new XElement("video_list_count", video.StateCount) ); if (filter.ver <= 1) { CreateLinkVer1(video, filter, xml); } else { CreateLinkVer2(video, filter, xml, isEx); } return xml.ToString(SaveOptions.DisableFormatting); }
public static string ResWithoutset(VideoNode video, DetailFilter filter, bool isEx) { var xml = new XElement("v"); var res = VideoUtils.FormatStrArray(10, video.Main.VideoWidth, "|", video.Main.VideoHeight); var flag = video.Flags.FormatListToStr(SplitArray.Line); xml.Add( new XElement("vid", video.Main.ChannelID), new XElement("title", video.Language[filter.lang].ChannelName), new XElement("subtitle", video.Language[filter.lang].SubTitle), new XElement("type", video.Type), new XElement("catalog", video.Language[filter.lang].CatalogTags), new XElement("director", video.Language[filter.lang].Directors), new XElement("act", video.Language[filter.lang].Actors), new XElement("year", video.YearTags), new XElement("area", video.Language[filter.lang].AreaTags), new XElement("imgurl", video.ResImage), new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)), new XElement("state", video.State), new XElement("total_state", video.BKInfo.Episode), new XElement("note", ""), new XElement("mark", video.BKInfo.Score), new XElement("hot", video.Hot), new XElement("pv", video.PV), new XElement("bitrate", video.Main.BitRate), new XElement("resolution", res), new XElement("flag", flag), new XElement("duration", video.Main.TimeLength / 60), new XElement("content", BoxUtils.GetXmlCData(video.Language[filter.lang].Introduction)), new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")), new XElement("video_list_count", video.StateCount) ); if (filter.ver >= 2) { var vir = video.Virtuals == null ? 0 : 1; xml.Add(new XElement("virtual", vir)); if (vir == 1) { IEnumerable<int> virtuals = video.Virtuals; if (isEx) { var filters = VideoNodesUtil.FormateTagFilter(filter); virtuals.Where(v => { var result = true; VideoNode gv = ListCache.Instance.Dictionary[v]; foreach (var f in filters) //过滤不符合的子频道 { result = result && f(gv, filter); } return result; }); } var virs = new XElement("virtual_list"); foreach (var virid in virtuals) { VideoNode virnode = ListCache.Instance.Dictionary[virid]; virs.Add(new XElement("virtual", new XAttribute("vid", virid), new XAttribute("title", virnode.ChannelName), new XAttribute("imgurl", virnode.ResImage) )); } xml.Add(virs); } var maxbit = 0; var maxres = string.Empty; IEnumerable<int> vices = null; if (isEx) //扩展接口,过滤分组子频道 { var filters = VideoNodesUtil.FormateTagFilter(filter); vices = video.Groups.Where(v => { var result = true; VideoNode gv = ListCache.Instance.Dictionary[v]; if (maxbit < gv.Main.BitRate) //最大码率赋值给主频道 { maxbit = gv.Main.BitRate; maxres = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight); } foreach (var f in filters) //过滤不符合的子频道 { result = result && f(gv, filter); } return result; }); var count = vices.Count(); if (count < 1) //分组里没有子集 { xml.Element("video_list_count").SetValue(0); xml.Element("bitrate").SetValue(0); xml.Element("resolution").SetValue(0); } else { xml.Element("bitrate").SetValue(maxbit); xml.Element("resolution").SetValue(maxres); } } } return xml.ToString(SaveOptions.DisableFormatting); }
/// <summary> /// 二代点播节目单不带节目介绍输出 /// </summary> public static XElement CustomListResVer2(VideoNode video, ExFilterBase filter, bool isEx) { var flag = video.Flags.FormatListToStr(SplitArray.Line); var v = new XElement("v", new XElement("vid", video.Main.ChannelID) ); var first = ListCache.Instance.Dictionary[video.Groups[0]]; var p = new XElement("playlink2", new XAttribute("duration", first.ViceChannels != null && first.ViceChannels.Count > 0 ? first.ViceChannels[0].Duration : first.Main.TimeLength) //new XAttribute("start_point", 60.22), //new XAttribute("end_point", 289.22) ); var maxbit = 0; var maxres = string.Empty; IEnumerable<int> groups = video.Groups; if (isEx && video.Groups.Count > 1) { var filters = VideoNodesUtil.FormateTagFilter(filter); groups = video.Groups.Where(vod => { var result = true; var gv = ListCache.Instance.Dictionary[vod]; foreach (var f in filters) //过滤不符合的子频道 { result = result && f(gv, filter); } return result; }); } foreach (var g in groups) { VideoNode gv = ListCache.Instance.Dictionary[g]; var res = VideoUtils.FormatStrArray(10, gv.Main.VideoWidth, "|", gv.Main.VideoHeight); if (maxbit < gv.Main.BitRate) { maxbit = gv.Main.BitRate; maxres = res; } p.Add(new XElement("source", new XAttribute("mark", gv.Language[filter.lang].Mark), new XAttribute("bitrate", gv.Main.BitRate), new XAttribute("filelength", gv.ViceChannels != null && gv.ViceChannels.Count > 0 ? gv.ViceChannels[0].Duration * gv.Main.BitRate * (1024 / 8) : gv.Main.TimeLength * gv.Main.BitRate * (1024 / 8)), new XAttribute("resolution", res), BoxUtils.GetXmlCData(gv.PlayLink) )); } v.Add( p, new XElement("title", video.Language[filter.lang].ChannelName), new XElement("subtitle", video.Language[filter.lang].SubTitle), new XElement("type", video.Type), new XElement("catalog", video.Language[filter.lang].CatalogTags), new XElement("director", video.Language[filter.lang].Directors), new XElement("act", video.Language[filter.lang].Actors), new XElement("year", video.YearTags), new XElement("area", video.Language[filter.lang].AreaTags), new XElement("imgurl", video.ResImage), new XElement("sloturl", ImplUtils.SlogImageJoin(video.SlotImage)), new XElement("state", video.State), new XElement("total_state", video.BKInfo.Episode), new XElement("note", ""), new XElement("mark", video.BKInfo.Score), new XElement("hot", ImplUtils.ConvertHot(video.Hot)), new XElement("pv", video.PV), new XElement("virtual", video.Virtuals == null ? 0 : 1), new XElement("bitrate", maxbit), new XElement("resolution", maxres), new XElement("flag", flag), new XElement("duration", video.Main.TimeLength / 60), new XElement("onlinetime", video.Main.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")) ); return v; }