/// <summary> /// 单维度扩展接口 /// </summary> public string TagsEx(TagsFilter filter) { try { var tags = TagCache.Instance.Items[new TagNodeKey() { Dimension = filter.dimension, Type = filter.type }]; var key = new VideoNodeKey(filter.platform, filter.type, filter.auth); var xml = new XElement("tags"); var filters = VideoNodesUtil.FormateVodFilter(filter); xml.Add(from tag in tags where tag.Channels.ContainsKey(key) let count = GetChannelCount(tag, key, filter, filters) where count > 0 select new XElement("tag", new XElement("name", tag.Language[filter.lang].Title), new XElement("count", count) )); return(xml.ToString(SaveOptions.DisableFormatting)); } catch (KeyNotFoundException) { return(NoPlatForm()); } catch (Exception ex) { return(BoxUtils.FormatErrorMsg(ex)); } }
public string NavLists(NavFilter filter) { try { var key = new VideoNodeKey(filter.platform, 0, filter.auth); var pars = VideoParsUtils.FormateSearchVideoPars(filter); var filters = VideoNodesUtil.FormateVodFilter(filter); var rel = RecommandCache.Instance.Dictionary[filter.navid]; var query = rel.Channels[key].Where(v => { bool result = true; var video = ListCache.Instance.Dictionary[v]; foreach (var f in filters) { result = result && f(video, filter); } return(result); }); return(CreatePageList(rel, query, filter, pars, false)); } catch (KeyNotFoundException) { return(NoPlatformNav()); } catch (Exception ex) { return(BoxUtils.FormatErrorMsg(ex)); } }
public string NavEx(NavFilter filter) { try { var res = RecommandCache.Instance.Items[filter.mode]; var xml = new XElement("navs"); var key = new VideoNodeKey(filter.platform, 0, filter.auth); var filters = VideoNodesUtil.FormateVodFilter(filter); xml.Add(from re in res let count = GetChannelCount(re, key, filter, filters) where count > 0 select new XElement("nav", new XElement("navid", re.Id), new XElement("name", re.Language[filter.lang].Title), new XElement("count", count), new XElement("image", re.PicLink) )); return(xml.ToString(SaveOptions.DisableFormatting)); } catch (KeyNotFoundException) { return(NoModeNav()); } catch (Exception ex) { return(BoxUtils.FormatErrorMsg(ex)); } }
/// <summary> /// 多维度扩展接口 /// </summary> public string MultiTagsEx(TagsFilter filter) { try { var dimensions = filter.dimension.Split(SplitArray.LineArray, StringSplitOptions.RemoveEmptyEntries).Distinct(); var xml = new XElement("tags"); foreach (var dimension in dimensions) { var tags = TagCache.Instance.Items[new TagNodeKey() { Dimension = dimension, Type = filter.type }]; var key = new VideoNodeKey(filter.platform, filter.type, filter.auth); var dimensionxml = new XElement("dimension", new XAttribute("name", dimension)); var filters = VideoNodesUtil.FormateVodFilter(filter); dimensionxml.Add(from tag in tags where tag.Channels.ContainsKey(key) let count = GetChannelCount(tag, key, filter, filters) where count > 0 select new XElement("tag", new XElement("name", tag.Language[filter.lang].Title), new XElement("count", count) )); xml.Add(dimensionxml); } return(xml.ToString(SaveOptions.DisableFormatting)); } catch (KeyNotFoundException) { return(NoPlatForm()); } catch (Exception ex) { return(BoxUtils.FormatErrorMsg(ex)); } }